Hello Guys, ( especially guys living in Lebanon ).
The problem is summarized as below:
1- you set the sonoff to ON when Grid is on
2- when grid not available the sonoff device is offline ( but it is still ON as a state not OFF, it keeps the last state before it went offline
3- When grid comes back on, ( the last state was ON before grid went offline, and the default state of the sonoff is device is ON) there is no change in state so the sonoff will not be triggered on the ON position thus this does not work.
I have found a workaround for this as follows but you have to use an extra device:
1- you set a sonoff device without an output to be used as a trigger only. The Default state of this sonoff device is ON and you set a loop timer to turn off after 1 minute always.
The scenarion becomes like this: ( you have to turn off notifications )
1-Grid comes on, sonoff turns ON you get notification ( 1 minute OFF Timer is counting )
2- After 1 minute , the sonoff device turns OFF.
3- Grid goes offline then online again
4- Last state of the sonoff was OFF and the new state is ON ( you get a trigger)
In order not to get notifications for the ON and OFF, you make an auto scene
if sonoff device ( trigger is ON ) then push notification ( and do something else )
Offline is not that accurate to consider it as a state. Offline state can exist when there is actual power but the wifi connection is lost. You can not rely on the offline state to control if power is actually on or off.
ON THE CONTRARY, Online state is very important and necessary.
You can check if the power is from GRID or GENERATOR by checking the online state.
if the device was ON before the power outage, then when the power is back ON, sonoff considers the state as unchanged thus the trigger will not work.
The solution is to trigger the new status whenever the device becomes ONLINE after powerup regardless of the last state ( not online after an offline due to wifi disconnection). or create a trigger called powerup ( when the device has no power and has power again regardless of the last and new state push the status the new status after powerup to be used as a trigger.
At the 30th second, I simulated powering down to take device A offline;
At minute 3, I simulated a power on to bring device A online;
When device A is powered on, it changes from off to on, which triggers the scenario “power on !!!”, and at the same time the scenario will execute “turn off device A” to turn off device A and wait for the next power off-power on trigger.
This solved the problem, i can know when EDL is restored using push notifications.
all it costs is a sacrificial device that acts like an alerting service
I receive 2 notifications:
The Device triggered ON because it was off before EDL was cut
The Device triggered OFF 5 minutes later (reload in order to be ready for the next cycle)
Been trying it for a week and it works like a charm
Thank you
The Power On state was working fine 2 months ago.
I was using A basic R2 on the main generator, once it goes online, I receive a notification on my mobile and it fires another automatic switch (heater).
Suddenly It stopped working, when the electricity is On, the state is not changing, which means no push notification is done, and no automation.
If I check the logs of the basic R2, there’s no record of the device being on. and if you open the application, you can see that the device is on.
i changed the Basic R2 with a mini R2 and same result.
Any idea?
I made such a device based on the sonoff door sensor +1-Bit AC220V Optocoupler door sensor from Aliexpress
I use this when the generator is turned on when the city power is turned off. After the city power is resumed, so that I receive an alert on the phone and the voice assistant says that the supply of electric power from the city is resumed and that I must switch the power from the generator to the city power
This forum is primarily used for user interaction and free discussion.
Raising a ticket via the App Feedback Channel or the Help center web portal if you meet any issues related to software-related ones (APP, WEB, CAST, Cloud Services) is highly recommended.
If it’s an issue related to SONOFF devices, raising a ticket HERE is the best way to get a response timely.
Mechanically, this can be solved in this way. The lack of power supply to the device ( A ) causes a change in the state of the 4CHR Pro device relay, which causes a change in the state on the S2 connector of the device B. (e.g. device ZBMINIR2, MINIR4, MINIR4M ).
Device B must have a separate power supply.