Sending two commands to the same device

Moderator: leecollings

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

Sending two commands to the same device

Post 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!
User avatar
l0gic
Posts: 107
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 »

Try
commandArray[1] = "off"
commandArray[2] = "light"
Non credus crepitus
ukwizard
Posts: 7
Joined: Saturday 04 August 2018 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sending two commands to the same device

Post 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?
ukwizard
Posts: 7
Joined: Saturday 04 August 2018 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sending two commands to the same device

Post by ukwizard »

Thanks for the push in the right direction.

The following has worked...

commandArray[1]={[c] = 'light'}
commandArray[2]={[c] = 'med AFTER 1'}
User avatar
l0gic
Posts: 107
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 »

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: No registered users and 1 guest