Help me fix my conditional logic

Hi,
I’m trying to automate a morning notification that tells me if our robotic vacuum is ready to run. Our kids named our Romba, “Babybot.”

I’m wanting a notification that says it’s ready to clean if it is currently docked and has more than 50% batter charge.

However, it’s not working. What I get is:

Babybot needs attention before it can start cleaning (100% charged) docked

Here is the automation:


alias: Roomba - Check
description: ""
triggers:
  - trigger: calendar
    entity_id: calendar.jarvis
    event: start
    offset: "-0:0:0"
conditions:
  - condition: template
    value_template: |-
      {% if trigger.calendar_event.location 
      == "Roomba Check" %}
      True
      {% else %}
      False
      {% endif %}
actions:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: vacuum.babybot
                state: docked
              - condition: numeric_state
                entity_id: vacuum.babybot
                attribute: battery_level
                above: 50
                below: 150
        sequence:
          - action: persistent_notification.create
            metadata: {}
            data:
              message: Babybot is ready to clean.
          - stop: No more work needed
      - conditions: []
        sequence:
          - action: notify.persistent_notification
            metadata: {}
            data:
              message: >-
                Babybot needs attention before it can start cleaning
                ({{states('sensor.babybot_battery')}}% charged) 
                {{states('vacuum.babybot')}}
mode: single

So, what have I done wrong? I just can’t see it.

Thanks in advance,
Mike.

Simplification, Conditions are and by default, so in your case don’t need these.

Double check in Open your Home Assistant instance and show your state developer tools. that that is indeed exactly one of the available states.

Check a tract to see what is happening, and chase the failure.

I could be wrong but we way this is written seems like it would be better as and if statement. Since you have no conditions on the second choice.

alias: Roomba - Check
description: ""
triggers:
  - trigger: calendar
    entity_id: calendar.jarvis
    event: start
    offset: "-0:0:0"
conditions:
  - condition: template
    value_template: |-
      {% if trigger.calendar_event.location 
      == "Roomba Check" %}
      True
      {% else %}
      False
      {% endif %}
actions:
  - if:
      - condition: and
        conditions:
          - condition: state
            entity_id: vacuum.babybot
            state: docked
          - condition: numeric_state
            entity_id: vacuum.babybot
            attribute: battery_level
            above: 50
            below: 150
    then:
      - action: persistent_notification.create
        metadata: {}
        data:
          message: Babybot is ready to clean.
      - stop: No more work needed
    else:
      - action: notify.persistent_notification
        metadata: {}
        data:
          message: >-
            Babybot needs attention before it can start cleaning
            ({{states('sensor.babybot_battery')}}% charged) 
            {{states('vacuum.babybot')}}
mode: single