Improve ZigBee automation reliability

Dear HA community,

I’m guessing I’m not the first one with this question but have trouble in looking for right solution from forums. Here is my problem: this summer I had a ZigBee plug that controlled pump for watering my plants. It happened several times that it didn’t execute the command and every time it was a problem for my plants. I have also noticed that I would like to have some kind of double check mechanism for our terrarium light. I’m not looking to improve ZigBee reliability (this is separate story) but just want to get notified when something is not working so I can manually fix it. I need something generic which I can apply to different devices. Here is logic that I would like to implement:

  1. Define a variable “status” which will be used for compare the wanted state and actual state
  2. if “status” is on and ZigBee plug is off then send a command to ZigBee plug to turn on the switch
  3. If “status” is off and ZigBee plug is on then send a command to ZigBee plug to turn off the switch
  4. A few seconds after previous commands execution:
    4.1 If “status” is on but a) ZigBee plug reports power consumption different than e.g. 4W (detects that my pump is broken or disconnected etc) b) ZigBee plug doesn’t report anything (detecting that my ZigBee plug is gone bad) then raise notification (I already have setup Telegram group where I get messages for outstanding situations from my HA)
    4.2 If “status” is off but ZigBee plug reports power consumption other than 0W then raise notification

I’m a bit confused on which one HA mechanism is most suitable for me (automation, blueprints, templates, scripts, …). It should be parametrized with selection of: on/off device, expected power range (min,max), a notification device and a text for notification.
Can you recommend me where to start from?

Thank you in advance!

Aleksandar

Hello aleksandarzivkovic,

Well, blueprints are premade(by other community members or you) automations, scripts, or now templates. So your question is lacking a bit of background knowledge.

I don’t follow what you are looking for, but it is likely an automation. checking that something didn’t happen is not the most fun task to take on. You didn’t want to hear it, but adding a zigbee routing device between a solid part of the network and the outside device id likely what you need to happen,

Anyway…
I’m sure that can be done. Also having someone or something writing it for you means the second it misbehaves, you will be struggling back to find someone to fix it for you.
The best way to learn is to just try. Run thru the docs on getting started with the automation editor. If you get stuck, come back with what you have done.

and
The Home Assistant Cookbook - Index.

You might have a look at the Retry integration from HACS, which repeats an action if it hasn’t worked the first time.