Page 1 of 1

Using domoticz.devices(idx) for unused device returns nothing. Is this wanted behavior?

Posted: Friday 05 February 2021 18:10
by Timmiej93
My z-wave setup for domoticz is quite flaky. On a reboot, it has a 50/50 chance of getting up and running without needing help. Since I only have a couple of devices connected through z-wave, I'm not really interested in fixing it (since it's most likely due to me using a RaZberry v1), and I'd rather just set up an automated check, by looking at the last update for a device. However, the only value that updates regularly on the piece of hardware I'm interested in, is its power consumption data. The other 'devices' are things like the RGB channels, so they only change whenever the item gets used.

Now comes the issue though: If I try to get the device through domoticz.devices(deviceIdx), I get nothing for the power consumption device, most likely because it's not set to "used" in the devices tab, and I don't want it to be, since I don't care about the usage data, I only care about when it was last updated.

Is this wanted behavior? I feel like it's a bit weird for when I'm targeting a device directly by its index. Unused devices not showing up in the list when iterating through all devices, I can understand (although that probably should be an option too), but when I target a device directly by index, I expect to get its data, regardless if it's set to used or unused.

If this is wanted behavior, is there any way to get around it?

Re: Using domoticz.devices(idx) for unused device returns nothing. Is this wanted behavior?

Posted: Friday 05 February 2021 19:18
by waaren
Timmiej93 wrote: Friday 05 February 2021 18:10 If this is wanted behavior, is there any way to get around it?
It is wanted behavior. If you have a unused device, you cannot expect it to be usable by dzVents or any other system.
Changing this behavior would mean that for many users the amount of device objects passed to dzVents will double or triple causing degraded response times.
The work around for users who want to get information in dzVents from unused devices would be to use a combination of openURL and httpResponses and process the result of http://<domoticz IP:domoticz PORT>/json.htm?type=devices&used=false

Re: Using domoticz.devices(idx) for unused device returns nothing. Is this wanted behavior?

Posted: Friday 05 February 2021 19:32
by Timmiej93
Hmm, that's odd to me. Nevertheless, thank you for your reply and suggestion.