It happened that my RP3 was accidentally disconnected from internet today while wife was doing some housekeeping. I will be moving my RP3 into safe area soon but for now want to set notification alert when system goes down.
Looking at the manuals this can be done by creating notification action and place it in rules to send alert to mobile devices registered. There is example shown with rule for Front Door notification when the door are open. But can’t find anywhere how to implement it for system error - when the system is offline which is critical alert , notification will be sent.
Can I please ask you for help with this one.
You can’t implement this in OH Rules or Items because when OH goes down, it has no way to report that it has gone down. Either it has lost network connectivity so I can’t send the message, or OH itself is down so there is nothing running to send the message in the first place.
So you must have something outside of OH to send this online/offline message. It used to be the case that openHAB Cloud would send these messages but that got turned off for a time because it was causing problems. I don’t know why it hasn’t been turned back on.
There is an open issue on this: https://github.com/openhab/openhab-cloud/issues/212
@rlkoshak thank you for information.
I don’t suppose there is any update on this ticket since you opened it in September.
If this function could be reinstated in the future that would be brilliant.
In the meantime what would the best temporary solution to detect openHAB server failure/off state ? Really interested to hear from everyone in the community how everyone is dealing with this issue. Please list your suggestions.
You can open the link above and see. Add a comment to the issue to bump it back to the top of the list.
You need something external to OH that can detect when OH goes down. But the question is how external does it need to be?
Well if all you need is an alert when OH itself goes down it just needs to be running separately from OH, preferably on physically separate hardware.
I you need to detect when your network goes down too, well then you need to put this sensor outside your network (Amazon AWS instance perhaps?).
Probably the easiest thing to do would be to use CloudMQTT (there is a tutorial on the forum for working with certificates to encrypt the traffic) and configure a Last Will and Testament topic and message in mqtt.cfg. This message will get published to the given topic when OH fails to respond to a heartbeat message between OH and the broker.
Then you need something to read that MQTT message and publish it to some alerting service like Prowl or PushBullet. mqttwarn is a great choice for this. The only real challenge will be hosting mqttwarn somewhere outside of your network. I’m sure there are dozens of tutorials for how to set up a free or nearly free server on AWS or Azure or the like. Configure mqttwarn to subscribe to the LWT topic and publish the alert through the supported alerting service of your choice.
As for how everyone else is handling this issue, for me and I think for many, we are not. The cost benefit is not good enough for me to implement this. When OH goes down it is usually readily apparent fairly quickly and it is easy enough to check manually.