Page 1 of 1

understanding devicechanged vs. otherdevices

Posted: Thursday 12 January 2023 20:33
by RonkA
hello,
I have a problem understanding Devicechanged command,

Code: Select all

commandArray = {}
   if (otherdevices['Switch on display2004'] == 'On') then
   print('switch is on')
 end
return commandArray
This works ok, giving= LUA: switch is on

Code: Select all

commandArray = {}
   if (devicechanged['Switch on display2004'] == 'On') then
   print('switch is on')
 end
return commandArray
gives [string "commandArray = {}..."]:7: attempt to index a nil value (global 'devicechanged')

As far as i understand devicechanged can be a status or a value, a status is stated either 'On' or 'Off" and a value can be a number..
Please help :?:

Re: understanding

Posted: Thursday 12 January 2023 20:35
by jvdz
That array is not there for time events... So ensure you set the event type to device when using the internal editor!

Re: understanding devicechanged vs. otherdevices

Posted: Thursday 12 January 2023 20:39
by RonkA
Whoa Fast....

Lua is set on all, should i try device?

Re: understanding devicechanged vs. otherdevices

Posted: Thursday 12 January 2023 20:46
by jvdz
Yeap... But i already said that. ;)