Page 1 of 1

Sending two commands to the same device

Posted: Tuesday 21 August 2018 15:01
by ukwizard
How do I send two commands to the same device.

I have a fan and need to send 'off' to stop the fan and 'light' to turn off the light. Can I do this in a single lua script?

commandArray[c] = "off"
commandArray[c] = "light"

fails as the last one is the only one that gets actioned.

Help!

Re: Sending two commands to the same device

Posted: Tuesday 21 August 2018 15:31
by l0gic
Try
commandArray[1] = "off"
commandArray[2] = "light"

Re: Sending two commands to the same device

Posted: Tuesday 21 August 2018 19:50
by ukwizard
Thanks, but I should have included..

c = 'Dining Room Light'

So 1 and 2 do not reference the light. Are there ways to pass two arguments to a device in the same line?

Re: Sending two commands to the same device

Posted: Tuesday 21 August 2018 20:04
by ukwizard
Thanks for the push in the right direction.

The following has worked...

commandArray[1]={[c] = 'light'}
commandArray[2]={[c] = 'med AFTER 1'}

Re: Sending two commands to the same device

Posted: Wednesday 22 August 2018 10:58
by l0gic
Glad you have sorted it.
Yeah, I should have looked closer, I saw the commandArray[c]= and immediately went off on the wrong tangent.
Sorry, but glad you are sorted.