Page 1 of 1

how use idx iso names

Posted: Friday 28 February 2025 13:23
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

Re: how use idx iso names

Posted: Friday 28 February 2025 19:20
by waltervl
Just replace names with the appropriate IDX.
And instead of
If device.name == 'myDevice'
use
If device.idx == 1234

Re: how use idx iso names

Posted: Friday 28 February 2025 19:25
by BartSr
I just learned using names is more stable so I keep it with names.

Re: how use idx iso names

Posted: Friday 28 February 2025 19:39
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)

Re: how use idx iso names

Posted: Saturday 01 March 2025 11:19
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 429 times

Re: how use idx iso names

Posted: Sunday 02 March 2025 9:02
by BartSr
Thanks. Good Tip!