Homey Community Forum

Power outage detection solution

I was struggling with reliable power outage detection. Both router and Homey is backed up with UPS. I wanted to know when there is power outage. So far I used central Aeo clamp power metering and calculation to detect the outage (if 3 consecutive power reading are the same, its most probably power outage). However I had several false alarms and it takes some time to detect the outage.
I was playing with cheap Aqara door sensor yesterday and realized that it can be easily used for this purpose in combination with with 230V relay like this one (230V relay).
You need to disassemble Aqara sensor and solder wires to magnetic contact detector - its easily accessible. Than connect it to relay and power the relay coil by 230V. In case of outage, relay will change its position and aqara will send command to Homey. Rest of the flows is obvious :slight_smile:
This way, you are able to detect power failure on any 230V outlet/device for reasonable price (7€ door sensor, 4€ relay + your work).

Wouldn’t clamp show zero on outage? If zero start countdown, in case countdown reach and still zero send notification?

No, in case of outage, power meter is without power and central unit (Homey) wont receive any new values from it. Thats why the last reported value remains still until the power is back and you can use this behavior for outage detection. But as I stated, you can get also false alarms (I get it once a 1-2weeks).

Ou. That’s the issue. I had similar need like you but with ups. I also wanted to know when power went down and idea was to detect power on the ups input. That way clamps are powered by ups while ups input was 0. Not 100% same as main input but more or less similar. I left that idea as clamp power meter was somewhat expensive.

@Igy @David_K
As you have a UPS the following would be a potential solution which would work properly.

There is a free open source package called NUTS - Network Ups ToolS. See - https://networkupstools.org/

You could have create a Homey app which monitors the state of the UPS via NUTS. Probably the simplest way is to have NUTS running on a VM or Raspberry Pi and for the Homey app to periodically query the NUTS client on that system.

The advantage of NUTS will be that it already supports many brands and models of UPS.

I actually have UPS connected to synology. If there would be some connection between synology UPS service and homey “voila”. Unfortunately, I can script but not write programs. Mainly some automation and C in my case. :smiley: :smiley:

There’s might be a (bit of a convoluted) way: create a custom SMS service provider on your Synology (Control Panel > Notification > SMS). You have to enter a URL, where you can point it towards your Homey (make sure it’s a POST request). Add at least two BODY fields, phone and message.

In the Advanced tab make sure that an SMS it send for all relevant UPS-related events (under Power Supply).

On Homey, use the HTTP request flow cards app to trigger on incoming POST requests. Hopefully you should be able to extract the exact reason why the event was sent.

I obviously did not tried it yet but for sure I will play with it and potentially send here my findings. Good tip.

There is a NUTS implementation already available to run on the Synology. You then just need an app on the Homey to monitor that.

The “just need an app” part is the main issue here, I think.

The “just need an app” part is the main issue here, I think.

Indeed. :smiley:

No, I dont have regular UPS, I have power supply with battery backup option. There is no such a think how to connect it to NAS or other platform (see this post).

This is how it looks like. Relay and door sensor fit inside the socket.

I have a old camera D-link that send to me a popup on the iphone (via app) if the power or the wifi is down from the server D-link.

i follow a similar solution from Homey or Ifttt. A software solution.

any idea?

It’s a very interesting solution, I have a spare door sensor (SonOFF) and I think I have found the same relay you are using (Finder can you share the pinout connections please?

Thank you

Here you go with pictures.


Thank you very much! I’ll try to do it myself tomorrow! it’s a very clever idea!

If I’m reading the datasheet correctly, that’s a 24V relay. You want a 240V relay, number

1 Like

Thank you for pointing it out!!! I was in rush to find a suitable relay on Amazon with delivery for tomorrow and I misread the numbers!! Ordered the 240V version now!

Oh well, the only one available is a but from the datasheet the only difference is 2 CO 8A instead of 1 CO 16 A, the connections should be the same I think…