Alert me when Power is ON or OFF using IFTTT or Advanced Plan

Hello,

I am looking for a smart device that can alert me when power in my house is ON or OFF.

So far, I can achieve it using the Sonoff S26 plug by receiving ON notifications when the device recovers from power outage (via the Power On State).

I can also use eWeLink advanced subscription to create a scene such as:

Scene: If Device is ON > Run a webhook (can be used to communicate with third-party services that support webhooks).

However, the problem I’m facing is that I also need to be notified when power goes OFF.

I am aware that the eWeLink app has an option for offline alert. When the device has gone offline for 5 minutes, it will push a notification to me. But this does not allow me to run scenes/automations.

With eWeLink advanced, I can only create scenes as such: IF device is ON or OFF, not if device is Offline.

I am specifically looking to create the following scene:

Scene 2: If Device is Offline > Run a webhook (can be used to communicate with third-party services that support webhooks as mentioned on top).

But it is not possible to create the scene above with eWelink advanced dashboard.

Can you please suggest a solution?

Alternatively, I am considering using a smart light sensor made by one of your competitors (Tuya or Aqara) by plugging the light sensor into a separate power source at my house (such as a ups or portable power station). It would keep measuring the light in a small storage room at my house that has a simple/traditional (non-smart) light bulb connected to the main power at my house, and which is always turned on (the bulb).

If the light sensor detects that it’s dark (this means the power is OFF at the house and there’s no electricity since the bulb is turned off)

If the light sensor detects that there’s light (this means the power is ON at the house and there’s electricity since the bulb is turned on)

The light sensor would be compatible with IFTTT, and would allow me to run applets such as:

IF Light sensor brightness is above OR below 50 lux for example > THEN: Run X Action (such as a webhook, or anything that IFTTT can do).

P.S. I know that IFTTT sometimes has delays. That’s not a problem since speed is not a critical factor in my project.

Can you please help me determine how can I achieve the above project with SONOFF? because I really like your products, and prefer not to buy competitor products.

Thank you in advance for your support

I have a solution that I use for my home to detect if the grid power is off or on, so that I can control other devices such as water heaters etc. I use a Sonoff Mini R2, with the S1 and S2 terminals connected to a relay. The relay is powered from the mains (not via UPS or inverter). When power to the relay is removed, its NO / NC state changes, and the Mini interprets this as an on / off operation and triggers a smart scene. In my case, I also send a WhasApp message to my phone via iHost Node Red. You would get a notification on your eWeLink App anyway from the Mini assuming there is an active internet connection, and you have push notifications enabled on the Mini device.
My system is connected to my inverter with PV and battery backup, which takes care also of my internet connection. If you do not have this, I would suggest a small UPS to power essentials such as the Mini device and your router.
Hope this helps…

1 Like

8 months… OP is probably far away with this situation.

Very clever move indeed. I had the same problem until this morning. I did what you have done, it works great. here in Kimberley South Africa we have lots of load shedding as they call it, because of useless people in our government. With your idea, it works great, thanks.

1 Like

Hi Pierred358, any chance you could let us know what relay you used in conjunction with the Sonoff Mini R2 for the power off notications. Many Thanks Jonathan

In my case, my inverter switch-over uses a mechanical contactor switch-over when the grid fails, and the contactor has a NO (normally open) auxiliary relay that I could connect the Mini R2 with (using the S1/S2 contacts).

If you do nor have something similar, you could use any good quality relay, which you power from the mains to give you a NC (normally closed) contact point for the Mini R2. When the mains power fails, the NC contacts will open to give your Mini R2 the state change. These relays could be free-standing (plugged into a wall socket) or wired into your DB. Of course, keep in mind that you must have backup power for your MiniR2 and your network…
Do not use a cheap relay - it is worth spending some money on a good quality relay. The cheapies sometimes overheat and fail when you most need them…

1 Like

Hi Pierre
Just what I was looking for!!!
I’m in the process of installing a back up system with lithium batteries and its complicated to define the “essentials” in my house, because some of the appliances or devices that I want to be backed up are in the same circuit whit other things I don’t want to back up

So I was thinking about installing sonoff basics in the appliances that I don’t want to back up and create a scene that turn them off when there is no grid

And installing the device that you mention in the backed up line

The question is, If there is no internet for some reason the scenes wont work

Can you use the sonoff HUB so you can have the scenes running ?

Thanks for the help

Sonoff devices without Internet access lose scenes and several other things.
A potential solution to this is an iHost or a standalone hub made in-house based on Home Assistant or something similar.
Apparently Sonoff ZigBee Bridge Pro also supports local scenes but of course only for ZigBee.
However, you can forget about accessing IFTTT without the Internet for obvious reasons. :slight_smile:

Cool idea. If the router is powered by a UPS, it could also be solved completely programmatically by installing OpenWRT on it and, for example, running a script from cron that ping some Sonoff device and, if there is no response (if it does not respond, it has probably lost power), sends us an SMS/e-mail with information.

Apologies for the very slow response - I was away for quite a while. @morgan did touch on it in his reply. I have played with three different scenarios to ensure that I can control critical devices.

  1. My network (including internet access) and critical Sonoff devices are on small UPS just to make sure the Inverter failover does not disrupt anything. This has worked well with no issues.
  2. I installed iHost and migrated smart scenes there, and later started using NodeRed. Works very well. Except for two occasions that my iHost decided to act up :frowning:
  3. I later installed Home Assistant on Raspberry PI with SonoffLAN - this actually works more robust than the iHost. Often devices show offline on the iHost, but I can reach them and control them on Home Assitant.

So, I had good results with all three approaches, but a good practise is to after an event (e.g. loss of grid power) to quickly check on the app that all the smart scenes executed as designed. Just in case - for that 1% of the times that something goes wrong…