dzVents says device does not exist

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
Kedi
Posts: 624
Joined: Monday 20 March 2023 14:41
Target OS: Linux
Domoticz version: latest
Location: Somewhere in NL
Contact:

dzVents says device does not exist

Post by Kedi »

I have a some 30 devices that start with the name 'Zolder' and 1 group called 'Zolder'
All devices work fine and some are controlled by dzVents.
I have 1 device (switch) called 'Zolder Airco' which dzVents does not know about.
sName = dz.devices('Zolder Airco') give nil for sName
Half of the devices have a space in the name after 'Zolder' the other half not.
If I change the name to 'Zolder_Airco' (notice the underscore) then the dzVents scripts works fine.
There are no duplicate names that start with 'Zolder'
I deleted the device and let Domoticz create it again, but the problem is still present.

Has anyone a solution or knows what the problem is?
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
habahabahaba
Posts: 288
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: dzVents says device does not exist

Post by habahabahaba »

The solution is to use idx of device
Kedi
Posts: 624
Joined: Monday 20 March 2023 14:41
Target OS: Linux
Domoticz version: latest
Location: Somewhere in NL
Contact:

Re: dzVents says device does not exist

Post by Kedi »

That's not a solution, but a workaround.
I don't use idx in my scripts, it is meaningless.
From a name you can follow the flow of a script.
I have scripts that use more then 3 devices, and then it hard to follow the flow when idxes are used.
Some of those script sizes are greater then 10 Kb (including comments and comments may be 60%)
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
habahabahaba
Posts: 288
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: dzVents says device does not exist

Post by habahabahaba »

Meaningless??!! This is the only correct solution IMHO to avoid getting confused by device names if you have quite a lot of them.
What if you suddenly decide to rename a device? Will you look for all the scripts in which it is involved?

And if you know the device’s ID, there’s no problem with logging its name.
User avatar
imautohuttraeger
Posts: 482
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: dzVents says device does not exist

Post by imautohuttraeger »

I also use IDX in scripts in order to avoid problems when a device is renamed. For better "readability", I simply put the name of the device in a comment in the same line.
Stop, look and listen.
Post Reply