Creating an automation to alert when smart plug power goes off

dear all

i have a smart plug with power monitoring by polling powered by zigbee. i put this in my server room that is backed up by a UPS. my UPS is old school, there is no notification to let me know if power is down and it is running on its battery supply.

i bought this smart plug with the intention of keeping it power on so that when the power goes out, i get a notification and a bunch of automation to shut down power sensitive equipment in the server room.

however this is not working. when power cuts, the smart plug just stops polling instead of going into power off. the power draw also remains as the last drawn power, instead of going to 0. can anyone guide me how to create or monitor such a situation with my smart plug , or any other ideas? thank you so much community

Are you using ZHA or Zigbee2Mqtt?

For Z2M there is this setting:

This will cause mains powered devices to become unavailable 10 minutes after the last received transmission (1500 minutes for battery powered devices).

The time periods are user adjustable. You don’t want to make the time any lower than the maximum reporting interval of your device. Or it will appear to flap on /offline continuously.

thank you. yes i use Z2M. how does this alert me in automation please?

You can detect when the entity becomes unavailable with a state trigger.

thanks @tom_l

does this mean that my poll interval is 60 seconds and i should not put lesser than 1 minute for the availability setting?


thank you. last question… it is now offline

but this does not get triggered

is there a specific entity i should use?

here is the list

i tried switch and update entities… both doesn’t seem to trigger

Did you create the automation before the device’s state changed to unavailable or after it had changed?

1 Like

Use the switch entity because it represents the physical device whose availability you have configured in Zigbee2MQTT. Or at least I think it is. What is the actual device (model name)?


It appears to be a smart plug.

1 Like

And a reminder this will be used to trigger a UPS automation eventually (points at original post)

They will want a timer on that trigger to prevent false positive and flappy zigbee

it’s this. somehow going from available to offline does not trigger for me

That’s odd. Your screenshot indicates TS011F as the device’s model (not BSD29_1).

BSD29_1 is correct. the earlier screenshot is the zigbee model, at the bottom of the page there is this model. i have tried switch entity, it doesn’t trigger

Then I don’t understand why you posted a screenshot for another device.

It will trigger only when the switch’s state changes to unavailable. It’s the change from one state to another that serves as a trigger.

It won’t trigger if the switch’s current state is unavailable.

You should be looking at the switch’s state as shown in Developer Tools > States. That view accurately reports the states of all entities.

as I said. I did not post a different device screenshot. take a look


That’s all that was visible in the original screenshot so naturally the assumed model was TS011F.

Your second screenshot shows all the available information so now it’s clearer.

really not sure if you are here to pinpoint on useless information or help. i already said in a post the model you asked for. and i explained but you refuse to read or listen. thanks for your time anyway.

You’re welcome and I hope you eventually understand how a State Trigger works.