Java Runtime Environment: which java platform is used and what version
openHAB version: 2.4
Issue of the topic: The status was not updated
I found that this script doesnt work :
var thingStatusInfo = getThingStatusInfo("zwave:device:c5155aa4:node2")
if ((thingStatusInfo !== null) && (thingStatusInfo.getStatus().toString() == "ONLINE")) {
logInfo("ThingStatus", "The thing is online.")
} else {
logError("ThingStatus", "The thing is offline or doesn't exist.")
}
When the yeelight ceiling light power plug was cut, the status remain “ONLINE” forever. Calling the thingStatusInfo.getStatus().toString() will also result in “ONLINE”. Any idea?
How do we detect if the lamp is OFFLINE because of power to that lamp being cut?
You’ll find many other example of Things behaving like that throughout openHAB. Why? Think of the Thing as showing the availability of the pathway to the device, rather than the device being operational. Here, the zwave network is working.
In zwave in particular, what would you expect a sleeping battery operated device to look like in this respect - it as after all working normally, and may send a message at any moment.
I don’t know but I think if you pull out your zwave stick your Thing will go offline.
As a generic solution; if you get regular updates from some device, you can use the expire binding to set a state of UNDEF for example, if the regular updates stop.
I am using Yeelight Ceiling light. Btw, i can do a simple ping to the device ip to know if the device is online/offline. however since i am new to openhab, any documentation how to write script to perform ping every 5s and update the item based on the result from ping?
No, there is a binding provided called network binding which can ping IP devices automatically and report their status, which is what you wanted to happen.
Doesn’t have anything to do with zwave Things you describe in your first post though.