Check if devices are still functioning

Moderator: leecollings

Post Reply
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Check if devices are still functioning

Post by gerard76 »

I am trying to find a way to determine if devices are still functioning. Like a window/door sensor only has a lastupdate which is the last time the door/window opened. But some windows are hardly ever opened. Z-Wave does know the 'last seen' but I have no idea how to get this in Lua or from the son API.

I am building an alarm system and want to be able to check if all devices are still present and accounted for.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Check if devices are still functioning

Post by emme »

you can use otherdevices_lastupdate['DoorWindowName'] na make a time difference for the actual time...
if the value (in seconds) is higher than a specific value you could investigate better if the device is alive or not

you can also try to use a json api call:
http://localhost:8080/json.htm?type=ope ... es&idx=idx

and parsing the json reply
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Check if devices are still functioning

Post by gerard76 »

Thank you for your reply, but like I said, lastupdate will not work because a door/window sensor lastupdate will be the last time the state changed. I have sensors on windows that rarely open, so lastupdate will be days ago even though the device is working fine.

The API also does not report the 'last seen' that you can see in the Z-Wave 'setup' device list.
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Check if devices are still functioning

Post by gerard76 »

Took a while, but I found

Code: Select all

http://localhost:8080/json.htm?type=openzwavenodes&idx=2
where idx is the HardwareID from your z-wave transceiver found with

Code: Select all

http://localhost:8080/json.htm?type=devices&rid=113
with rid being the idx of the device you want zwave info over. The LastUpdate returned with the zwave info is actually the LastSeen status I was looking for, but improper named in the API so not the last time the status got updated as with LastUpdate elsewhere in the API, but the last time the z-wave controller actually had contact with the device.

I unfortunately found no pretty way to find the actual z-wave node that belongs to your domoticz device. In the end I used the name to automatically hook them together in code. So the domoticz devices 'living pir', 'living lux', 'living temp' etc belong to the zwave node named 'living'.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests