I want to know when a zwave device(thing) goes offline the moment it goes offline.
An example of mine is that i have a smart switch that is wall plugged and I see in paperui that this smartswitch is online. When I unplug the smartswitcfh, openhab shows the smartswitch offline after 10 mins(best scenario).
i have tried some workarounds experimenting with openzwave python api and i found out that if i send a NIF (send_information() method from openzwave python api) i can detect that the smartswitch is offline the time it actually gets offline.
Is there any best practice to query a thing from openhab to see if it is offline the moment it gets offline?
Thanks a lot in advance!
Is there a best practice to know
In general, there are ways. In zwave, most of them wouldn’t make sense because many zwave devices sleep for long periods to conserve battery. The zwave philosophy of device-driven events isn’t well suited for this.
OpenHAB does allow you to send REFRESH commands to Items. Some bindings support that, I don’t know about zwave.
Some bindings will update an Item’s state to UNDEF on a read failure, which you can detect with a rule. I don’t know if zwave does that - probably not, due to devices sleeping.
I think the original request is about how to detect if the thing is offline? I think the link @sihui provided is the correct way to do this - you can simply get the thing state in a rule.
you can also use the Logreader Binding LogReader binding and define your own custom search strings… and add this to rules, notification managers like telegram, like i do