Automation Issue when ZUI Restarts

When I restart zui, this automation kicks off. I am using it to send me a notification for when my sump pump turns off. The on notification works fine.

How do I add a condition to prevent it from going off when zui restarts or any other system issue?

alias: Pump is Off
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.well_pump_1_electric_a
    below: 2
conditions: []
actions:
  - action: notify.mobile_app_paddy_iphone
    metadata: {}
    data:
      message: The Pump Turned Off
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: The pump turned off at {{now()}}
mode: single

Here you go. Been using this one reliably for an identical automation for my washing machine:

condition: template
value_template: "{{ trigger.from_state.state not in ['unknown', 'unavailable'] }}"

Actually, there is a dedicated template function for this, nowadays

Should work with something like has_value(trigger.entity_id) or has_value(trigger.from_state.entity_id)

2 Likes

Where does it go in my yaml?

It’s a condition. It goes in the condition section. If you’re in doubt, use the UI & select template, then paste in everything within & including the curly braces {}

That works!! Thanks!!!

1 Like

Thanks for the suggestion.