Hi
I have a script that I want to be triggered when any of a certain list of devices is changed.
For me, these are LightwaveRT devices, and I use an array in globalData to map the Domoticz device name to the LWRF device number (R1D1, etc)
What I'd ideally like to do is use the array in the on devices statement to select which devices trigger the script, rather than having to either list out each device in the script, or having to run the script for every device change.
Is this possible?
Use array of devices to trigger script? [Solved]
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Use array of devices to trigger script? [Solved]
In the 'on = ' section, domoticz.globalData is not accessible yet. It becomes accessible in the 'execute =' section.doh wrote: Friday 06 December 2019 14:24 I have a script that I want to be triggered when any of a certain list of devices is changed.
So you cannot use a table that you have in Global persistent data in an 'on =' section of a script
You can declare the table before the first 'return {' but if I understand your post correct that is not what you want. Another option to prevent including the complete table is using a naming convention for your devices that you can wildcard in the 'on = { devices ='
Something like LWRF_deviceA, LWRF_deviceB, LWRF_deviceC
and
on = { devices = { 'LWRF_*' }},
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: No registered users and 1 guest