how use idx iso names

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

how use idx iso names

Post by BartSr »

this an example from the wiki
return
{
on =
{
devices = {
'myDetector',
'roomTemp'
}
},
execute = function(domoticz, device)
if ((device.name == 'myDetector' and device.active) or
(device.name == 'roomTemp' and device.temperature >= 45)) then
domoticz.notify('Fire', 'The room is on fire', domoticz.PRIORITY_EMERGENCY)
end
end
}
I am looking for a way to use IDX iso names as imho this is better to maintain once names should change
I think it's not that difficult but can't find the syntax
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
waltervl
Posts: 5852
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: how use idx iso names

Post by waltervl »

Just replace names with the appropriate IDX.
And instead of
If device.name == 'myDevice'
use
If device.idx == 1234
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: how use idx iso names

Post by BartSr »

I just learned using names is more stable so I keep it with names.
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
waltervl
Posts: 5852
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: how use idx iso names

Post by waltervl »

No, names should be unique. So when changing names they still should be unique.

I am used to using IDX in my dzvents script so when I change a name I do not need to care about my scripts. I only need to take care my names are unique (but that is in every use case an obligation)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
HvdW
Posts: 612
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: how use idx iso names

Post by HvdW »

A tip: When using dzVents scripts and devices I edit the devices involved and write the name of the script in the description to be able to find out where between all scripts this device is updated.
edit.jpg
edit.jpg (41.52 KiB) Viewed 426 times
Bugs bug me.
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: how use idx iso names

Post by BartSr »

Thanks. Good Tip!
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest