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:
Code: Select all
wget -qO - 'http://localhost:8080/json.htm?type=openzwavenodes&idx=2'
(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:
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
Hope this helps.