Hello all
I'm looking to get infos from the hardware controller to a LUA script or json
Is there a way ?
Maybe a API from the OZW ?
Thanks in advance
[Zwave nodes] Get status / Last seen
Moderator: leecollings
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: [Zwave nodes] Get status / Last seen
What is it exactly what you want?
If you want to get the data as displayed in the table, you can use the json call.
(see the hardware html page)
If you want to get the data as displayed in the table, you can use the json call.
(see the hardware html page)
Quality outlives Quantity!
- LiPeR
- Posts: 5
- Joined: Sunday 22 March 2015 21:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Switzerland
- Contact:
Re: [Zwave nodes] Get status / Last seen
Hello gizmocuz
I didn't found this page on wiki nor the PDF, can you give me the link ?
EDIT : The goal is to send a mail when a device is dead
Thanks
I didn't found this page on wiki nor the PDF, can you give me the link ?
EDIT : The goal is to send a mail when a device is dead
Thanks
-
- Posts: 1
- Joined: Monday 09 March 2015 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [Zwave nodes] Get status / Last seen
I was looking for the same thing. What I discovered:
For zwave devices, you actually see two different "last seen" timestamps. One of them is on the hardware-tab that is shown in first post. It get's information from openzwave and gives you timestamp "when was the last time your device was seen and alive", for example it was polled and it responded. The other "last seen" is on other tabs, for example switches-tab, where your device is shown. What it tells you, seems to be "last time your device state was updated". For example switch was switched from off to on or vice versa.
On lua scripts, you have "otherdevices_lastupdated" that refers to the "last time your device state was updated". That is usable in the garage door example. If you wan't to know if wave-device is alive, i.e. powered and on range (but state not changed), you need access to the zwave node information. I couldn't find a place to get that directly in lua.
However, you can get that information through json-interface. If you do something like this: (where idx=2 is you zwave-hardwareid), you get all the information that is seen on the zwave-hardware tab, including the real "Last seen", Status (Dead, Awake, Sleeping etc). From there you can drill to any information you need.
What I would eventually like to see is something like otherdevices_zwavenodeinfo -function in lua, that would return that information for given node. Using json-interface is a dirty trick, but it works.
Here is simple model to get the idea, using json library and wget:
Hope this helps.
For zwave devices, you actually see two different "last seen" timestamps. One of them is on the hardware-tab that is shown in first post. It get's information from openzwave and gives you timestamp "when was the last time your device was seen and alive", for example it was polled and it responded. The other "last seen" is on other tabs, for example switches-tab, where your device is shown. What it tells you, seems to be "last time your device state was updated". For example switch was switched from off to on or vice versa.
On lua scripts, you have "otherdevices_lastupdated" that refers to the "last time your device state was updated". That is usable in the garage door example. If you wan't to know if wave-device is alive, i.e. powered and on range (but state not changed), you need access to the zwave node information. I couldn't find a place to get that directly in lua.
However, you can get that information through json-interface. If you do something like this:
Code: Select all
wget -qO - 'http://localhost:8080/json.htm?type=openzwavenodes&idx=2'
What I would eventually like to see is something like otherdevices_zwavenodeinfo -function in lua, that would return that information for given node. Using json-interface is a dirty trick, but it works.
Here is simple model to get the idea, using json library and wget:
Code: Select all
commandArray = {}
json = require("json")
local handle
local nodes
local n
local node
local lastseen
local state
handle = io.popen("wget -qO - 'http://localhost:8080/json.htm?type=openzwavenodes&idx=2'")
nodes = json.decode(handle:read("*a"))
handle:close()
nodes = nodes['result']
for n=1,#nodes do
node=nodes[n]
-- Here you get access to all nodes one by one
-- node['NodeID'] tells you zwave id and
-- node['LastUpdate'] and node['State'] tells you state of device and last seen information
-- do whatever you want
end
-
- Posts: 32
- Joined: Tuesday 26 May 2015 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Seattle WA, USA
- Contact:
Re: [Zwave nodes] Get status / Last seen
I just get errors for
JSON:decode must be called in method format...?
JSON:decode must be called in method format...?
Re: [Zwave nodes] Get status / Last seen
While the above does work, the LastUpdate is way off from what is reported in OZW control panel as LastHeard, which seems to be more accurate to determine whether a node is dead or not. LastUpdate may not change for days or weeks while the node is still working normally.
Any idea how to get the LastHeard value? I tried numerous things but with no success.
Any idea how to get the LastHeard value? I tried numerous things but with no success.
Who is online
Users browsing this forum: No registered users and 0 guests