Differences in Lua commandArray 'UpdateDevice' and OpenURL 'udevice'

Moderator: leecollings

Post Reply
Toni
Posts: 66
Joined: Monday 20 July 2015 14:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Differences in Lua commandArray 'UpdateDevice' and OpenURL 'udevice'

Post by Toni »

I'm writing some event code based on virtual switches. Now I'm wondering about an inconsistency about the firing of subsequent events. I.e. my event script should cause device updates which fire other events.

So, if my Lua event script updates the status of an another device, I can do it in two ways: But why only the second alternative causes an event to be fired on the device I'm updating?
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Differences in Lua commandArray 'UpdateDevice' and OpenURL 'udevice'

Post by Siewert308SW »

What about the following in for example a script_device_something.lua

When something triggers Lights to go ON then do something:
if devicechanged['Lights'] == 'On' then
commandArray['Do_Something']='On'
end

When something triggers Lights to go OFF then do something
if devicechanged['Lights'] == 'Off' then
commandArray['Do_Something']='On'
end

When something triggers Lights to go ON or OFF then do something
if devicechanged['Lights'] then
commandArray['Do_Something']='On'
end

Or do i misunderstand you?
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
Toni
Posts: 66
Joined: Monday 20 July 2015 14:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Differences in Lua commandArray 'UpdateDevice' and OpenURL 'udevice'

Post by Toni »

It's not that simple. What I want to update in my event script is a set of multiselectors, and I want the multiselector event to fire when the multiselector value is updated through the event script.

So I need to use the "commandArray['UpdateDevice'] = idx|nValue|sValue" format, instead of the "commandArray['Devicename'] = status". The UpdateDevice command does not fire an event on the updated device.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest