Sending two commands to the same device

Post Reply
ukwizard
Posts: 7
Joined: Saturday 04 August 2018 12:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Sending two commands to the same device

Post by ukwizard » Tuesday 21 August 2018 15:01

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!

l0gic
Posts: 154
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Sending two commands to the same device

Post by l0gic » Tuesday 21 August 2018 15:31

Try
commandArray[1] = "off"
commandArray[2] = "light"
Non credus crepitus

ukwizard
Posts: 7
Joined: Saturday 04 August 2018 12:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Sending two commands to the same device

Post by ukwizard » Tuesday 21 August 2018 19:50

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?

ukwizard
Posts: 7
Joined: Saturday 04 August 2018 12:09
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Sending two commands to the same device

Post by ukwizard » Tuesday 21 August 2018 20:04

Thanks for the push in the right direction.

The following has worked...

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

l0gic
Posts: 154
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Sending two commands to the same device

Post by l0gic » Wednesday 22 August 2018 10:58

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.
Non credus crepitus

Post Reply

Who is online

Users browsing this forum: Google [Bot], viriathus and 1 guest