Failed Condition Automation Notification

I have a cat feeder that runs two times per day. If my wife and I aren’t home we don’t want the cat feeder to run so I configured two conditions that checked for our zone status. If one of us aren’t home the automation still runs however if we both aren’t home the automation cancels (we have a dog who LOVES cat food! :slight_smile: )

My question is, sometimes we forget to feed the cats so I was hoping I could configure some sort of notification that will send if the automation doesn’t run because we both aren’t home.

I tried using the search function but everything had to do with failing. This has to do with conditions that aren’t met.

Here’s my code:

alias: Cat Food
description: “”
triggers:

  • trigger: time
    at: “06:00:00”
  • trigger: time
    at: “18:00:00”
    conditions:
  • condition: or
    conditions:
    • condition: zone
      entity_id: person.sam
      zone: zone.home
    • condition: or
      conditions:
      • condition: zone
        entity_id: person.pugliese_hh
        zone: zone.home
        actions:
  • device_id: 3ce9893943989f3207315cd1dc865900
    domain: number
    entity_id: e9f57b95b3f9c970e3aeb403ada31d31
    type: set_value
    value: 4
    mode: single

As currently configured, the second Or condition isn’t doing anything.

Instead of placing your presence conditions in the condition block, use them in an If/Then or Choose action.

1 Like

I got this working to handle the first issue but wasn’t able to get the If/Then statement to run:

alias: Cat Food
description: “”
mode: single
triggers:

  • at: “06:00:00”
    trigger: time
  • at: “18:00:00”
    trigger: time
    conditions:
  • condition: template
    value_template: “{{ state_attr(‘zone.home’, ‘persons’) | count > 0 }}”
    actions:
  • device_id: 3ce9893943989f3207315cd1dc865900
    domain: number
    entity_id: e9f57b95b3f9c970e3aeb403ada31d31
    type: set_value
    value: 4

Here was my attempt at the if/then:

alias: Cat Food
description: “”
mode: single
triggers:

  • at: “06:00:00”
    trigger: time
  • at: “18:00:00”
    trigger: time
    conditions:
  • condition: state
  • if:
    • alias: “People are home!”
      condition: numeric_state
      entity_id: zone.home
      above: 0
      then:
    • alias: “Feed the cats!”
      actions:
      • device_id: 3ce9893943989f3207315cd1dc865900
        domain: number
        entity_id: e9f57b95b3f9c970e3aeb403ada31d31
        type: set_value
        value: 4
        else:
      • action: notify.notify
        data:
        message: “The cats were not fed because no one was home.”

I know there are indent issues but what’s going on with it?

Never mind, I got it! I went the choose route. Here’s what I came up with:

alias: Cat Food
description: “”
mode: single
triggers:

  • at: “06:00:00”
    trigger: time
  • at: “18:00:00”
    trigger: time
    actions:
  • choose:
    • conditions:
      • condition: template
        value_template: “{{ state_attr(‘zone.home’, ‘persons’) | count > 0 }}”
        sequence:
      • device_id: 3ce9893943989f3207315cd1dc865900
        domain: number
        entity_id: e9f57b95b3f9c970e3aeb403ada31d31
        type: set_value
        value: 4
        default:
    • alias: Notify that no one is home
      data:
      message: No one is home! Rory didn’t get the cat food!
      action: notify.notify