Adding time conditions to notification

I have a garage door open alert:

garage_door:
  name: Garage door is open
  entity_id: binary_sensor.garage_door_open
  state: "on"
  repeat:
    - 10
    - 20
    - 30
    - 60
    - 120
  can_acknowledge: true
  skip_first: true
  title: "Garage door"
  message: >
    The garage door is open
  done_message: "The garage door is now closed"
  notifiers:
    - PushoverAlexa

The notifier ‘PushoverAlexa’ is a service that sends to both Pushover and Alexa. I also have a PushoverOnly notifier.

What I want to do here is add both notifiers and trigger the PushoverOnly one if the time is 20:00 - 07:00, else trigger the PushoverAlexa notifier.

Is that possible here? Thanks!

1 Like

Not within the Alert configuration itself. See the docs for advice:

template:
  - binary_sensor:
      - name: "Garage door open 2000-0700"
        state: "{{ 'off' if 7 < now().hour < 20 else states('binary_sensor.garage_door_open') }}"

then you’d need two Alerts.

Thanks!

Doesn’t look like it’s possible to add time conditions to the notify config either.

What do people generally do when they want different notify destinations at different times?

Two sensors and two Alerts, one for each sensor with the appropriate notifier.

template:
  - binary_sensor:
      - name: "Garage door open 2000-0700"
        state: "{{ 'off' if 7 < now().hour < 20 else states('binary_sensor.garage_door_open') }}"
      - name: "Garage door open 0700-2000"
        state: "{{ states('binary_sensor.garage_door_open') if 7 < now().hour < 20 else 'off' }}"
1 Like

Thank you!