Event in rule if public power failure in the house

Hello community,

I have a litte house in croatia and in this house I have a smarthome with OpenHAB2.
But there are always public power outages.

My main elements (Raspi, router, UMTS Stick) has a uninterruptible power supply.
Also I have a switch that I can read the voltage (230V). Now I store the volate all 5 minutes.
If I have no voltages on the switch, the public power is down and I need a massage over my telegram instance.

How can I do this?
Thank you for every hint!

If your UPS can interface with Network UPS Tools (NUT), then you can set up openHAB to monitor your UPS and create notification rules that fire when the UPS’s status changes. I wrote a guide for that, but it’s based on the 1.x NUT binding, which has been replaced in OH2.5.

I’ve just upgraded from OH2.4 to OH2.5 this week, and I’ll update the guide after I’ve gotten everything figured out.

If your switch is drawing from mains power (which I assume to be the case), it’s not going to be much help since it’ll just go offline. You could trigger notifications whenever it’s unreachable. But I think using your UPS with NUT would be more beneficial overall.

Of course, if your Internet access is down, none of this matters. I have my wifi router and cablemodem attached to my UPS so that OH can send me notifications (via the OH Android app), but if a public power outage also takes down my Internet provider, the notifications aren’t going to reach me.

Just like @rpwong says :smile:

If your UPS happens to be an APC unit, with a USB connection (which mine uses an RJ45 connector for… Go figure), then this might be of interest to you

APC UPS Binding

Just like Russell, my 2.3Kw APC powers all my network backbone & router.

What use is a message, if the messenger is dead ?

1 Like

unfortunately, my UPS has no interface, so this solution is not possible.

I have also attached my Raspi, router and UMTS stick to the UPS. And my connection with the internet is not cable, it is wireless. And if the public power down, the send masts from the communication companies (normaly) has power (emergency power unit - I don’t know) - so I can send to internet.

Yes, but how must I configurate openHAB that this work?
I think normaly the switch send the information and not the Server ask “do you live”.


Does your UPS have a network connection? If so then it will be running SNMP and there’s a binding for that, which means you should be able to work out a solution from that.

Unfortently no, so I need another solution for my requirement.

Here’s a curve ball thought…

What you need is a simple Pingable network device that is running BEFORE the UPS.

When that fails to respond to a Ping from the openHAB network binding ,you can be fairly sure that your power is down.


How about you buy a simple WiFi network access point (that won’t object too much to having it’s power cut / shut down without grace)

That way you get some better WiFi coverage in your house (*when the mains power is up) and you get a cheap way to pick up external power status…

Win Win :confetti_ball:

The solution by @MDARwould be a perfect use case for d1mini or node mcu

1 Like


Or a WiFi or Lan relay board, if you want to add some functionality to your home.

Likewise a TP-Link WiFi smart something.

I have a TP-Link smart plug that works well with openHAB and would be perfect for this, as it doesn’t live on a UPS protected circuit

1 Like

Do you mean that you already have the mains voltage available to you, as an Item in openHAB?

So you are just looking for a rule that runs when the voltage drops ?

That’s what I was thinking when I said, “trigger notifications whenever it’s unreachable”.

Find an old Ac/Dc power adapter (plugged into the same power source as your UPC) with output voltage small enough to use it as an input signal for RPi digital pin (use voltage divider if needed). Use the GPIO binding. When power drops your digital pin will go low. Now you can write a routine to send a notification.

1 Like