Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

I need a character ignored for a VD???


Question

Posted

Hi all,

 

The code below forms the beginning of a scene where I only need my staff to populate the ID numbers of any qty of lights up to a maximum of ten and then the rest of the scene references those ID numbers.

 

The scene is working well but lets say I only have 8 lights (as below) what can I put in between the brackets (as below) that will not create an error. Almost like a 'dummy" number if you will. Keeping in mind the code then calls for the value of that ID further down. 

 

 

local light1 = (98) --garage flood--
local light2 = (114)--dining pendant--
local light3 = (159)--family room--
local light4 = (109)--backyard--
local light5 = (64)-- kitchen--
local light6 = (69)--island bench--
local light7 = (36)--lounge--
local light8 = (81) --toilet--
local light9 = () --name here--
local light10 =() --name here--
local light1v = tonumber (fibaro:getValue (light1, 'value'));
local light2v = tonumber (fibaro:getValue (light2, 'value'));
local light3v = tonumber (fibaro:getValue (light3, 'value'));
local light4v = tonumber (fibaro:getValue (light4, 'value'));
local light5v = tonumber (fibaro:getValue (light5, 'value'));
local light6v = tonumber (fibaro:getValue (light6, 'value'));
local light7v = tonumber (fibaro:getValue (light7, 'value'));
local light8v = tonumber (fibaro:getValue (light8, 'value'));
local light9v = tonumber (fibaro:getValue (light9, 'value'));
local light10v = tonumber (fibaro:getValue (light10, 'value'));

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

Why not just comment out the lines that aren't needed? Just put -- (2x -) before the line and that line doesn't work in that scene. The same as what you did before the room names.

 

When the line is needed, just remove the -- and put the ID between the brackets

Edited by kevin
  • 0
Posted

i don't know what you wanted too do but you can say

if light10v ~= nil then

  • Thanks 1
  • 0
Posted (edited)

You could start to store your values in a table. Ex

Please login or register to see this code.

 

Edited by jgab

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...