Device state fails to trigger automation


I have an automation set up that should be triggered when the Sonoff POWR2 device becomes unavailable.

This means that I have lost power from the grid and I need to then switch off other heavy consumers of power that are attached to an inverter (long story as to why they are connected to the inverter but they are).

The automation is set up as per attached jpg- but it fails to trigger

The logs and history shows that the device does become unavailable but for some reason this does not trigger the automation.

Any assistance would be appreciated

The attached file is for when the POWR2 device is in an off state / I have another automation for when it is in an on state - - I split them out for troubleshooting and simplification purposes - but none of them trigger.

As you can see the status does change in the HASS log and the device is automated through Google Home - so it can be controlled


First thing I’d do is remove the ‘from’ == ‘off’ clause in your state trigger? Wouldn’t you want it to fire unavailable from any state?


Thanks for the quick reply - yes this is something I am going to try shortly -

I currently have 2 automations from on and off (as I was concerned the or condition was causing the problem)

I did not register that the “from” was optional and you are correct I need it to fire irrespective of the ‘from’ state.

I have disabled one of the automations and have removed the “from” state in the other one and will test accordingly.