Help with Automation not firing please

I created this automation and cannot figure out why it just won’t fire at all… I’ve been through it several times since this morning and I just cannot get it to work. I believe I’ve followed the logic and cannot see why it just isn’t working… Any help and/or suggestions would be greatly appreciated… I’m sure I missed something simple…
Thank you all!

- alias: 11 - Bed Presence Light Voice Prompt
  id: Bed Table Lamps

  triggers:
    - trigger: state
      entity_id:
        - binary_sensor.bed_presence_c175fc_bed_occupied_left
      from: "off"
      to: "on"
    - trigger: state
      entity_id:
        - binary_sensor.bed_presence_c175fc_bed_occupied_right
      from: "off"
      to: "on"
  conditions:
    - or:
        - condition: state
          entity_id: switch.john_light_shelly
          state: "on"
        - condition: state
          entity_id: switch.girl_light_shelly
          state: "on"

  actions:
    - action: assist_satellite.ask_question
      data:
        entity_id: assist_satellite.bedroom_assist_satellite
        preannounce: true
        question: "The lights are on would you like to turn one or all of them off?"
        answers:
          - id: "girl_side"
            sentences:
              - girl side
          - id: "my_side"
            sentences:
              - my side
          - id: "both"
            sentences:
              - both
          - id: "no"
            sentences:
              - nope
              - no Thank you
              - Please no
        response_variable: answer

    - choose:
        # Turn off girl's side
        - conditions: "{{ answer.id == 'girl side' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id: switch.girl_light_shelly

        # Turn off my side
        - conditions: "{{ answer.id == 'my_side' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id: switch.john_light_shelly

        # Turn off Both
        - conditions: "{{ answer.id == 'both' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id:
                  - switch.girl_light_shelly
                  - switch.john_light_shelly

        # Turn off None
        - conditions: "{{ answer.id == 'no' }}"
          sequence:
            - action: assist_satellite.announce
              data:
                message: "Ok, Thank you John"
                preannounce: false
              target:
                entity_id: assist_satellite.bedroom_assist_satellite

  mode: single

That would mean this automation has no traces because neither of its two State Triggers have ever triggered.

Before we proceed with debugging the two State Triggers and their binary_sensors, can you confirm there are no traces?

If there are traces, post the (properly formatted JSON) contents of the most recent one.

ohhhhhhhhhhh well I can see your point and something I just thought of… it won’t work unless both triggers are met?

Is it possible to do a if one or both triggers are met?

No, multiple triggers are, by default, logically ORed, not ANDed, so all it takes is just one of the two to trigger. You cannot configure triggers to be logically ANDed.


Your automation is designed to trigger if either of the two bed binary_sensors changes from off to on and if either of the two light switches is on.

So are there any traces for this automation?

I found the issues using Traces…

response_variable: answer — was off 2 spaces… back space once… now it works…

Here is the entire working automation hoping it can help someone else.
As always Thank you for the help with this!!

- alias: 11 - Bed Presence Light Voice Prompt
  id: Bed Table Lamps

  triggers:
    - trigger: state
      entity_id:
        - binary_sensor.bed_presence_c175fc_bed_occupied_left
      from: "off"
      to: "on"
    - trigger: state
      entity_id:
        - binary_sensor.bed_presence_c175fc_bed_occupied_right
      from: "off"
      to: "on"
  conditions:
    - and:
        - condition: state
          entity_id: "lock.front_door_lock"
          state: "locked"
    - or:
        - condition: state
          entity_id: switch.john_light_shelly
          state: "on"
        - condition: state
          entity_id: switch.girl_light_shelly
          state: "on"

  actions:
    - action: assist_satellite.ask_question
      data:
        entity_id: assist_satellite.bedroom_assist_satellite
        preannounce: true
        question: "The lights are on would you like to turn one or all of them off?"
        answers:
          - id: "girl"
            sentences:
              - girl
          - id: "mine"
            sentences:
              - mine
          - id: "both"
            sentences:
              - both
              - all
          - id: "no"
            sentences:
              - nope
              - no Thank you
              - Please no
      response_variable: answer

    - choose:
        # Turn off girl's side
        - conditions: "{{ answer.id == 'girl' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id: switch.girl_light_shelly

        # Turn off my side
        - conditions: "{{ answer.id == 'mine' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id: switch.john_light_shelly

        # Turn off Both
        - conditions: "{{ answer.id == 'both' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id:
                  - switch.girl_light_shelly
                  - switch.john_light_shelly

        # Turn off None
        - conditions: "{{ answer.id == 'no' }}"
          sequence:
            - action: assist_satellite.announce
              data:
                message: "Ok, Thank you John"
                preannounce: false
              target:
                entity_id: assist_satellite.bedroom_assist_satellite

  mode: single

Glad to hear the trace led to the source of the problem.

For future reference, if an automation has traces it means it was triggered (at bare minimum, one of its triggers had triggered and it executed its conditions if any existed).

So when you said “it just won’t fire at all” it implied it failed to trigger. However, that’s a misrepresentation of what ailed this automation.

The automation’s triggers had “fired” because it generated traces. What it failed to do was execute its action (because of a syntax error).

1 Like

You are 100% correct, Thank you!!!

Here is a very extended version of what I was building… working

Thank you again for all the help!!

- alias: 97 - Bed Presence - Lock Then Lights
  id: bed_presence_lock_then_lights
  mode: single

  triggers:
    - trigger: state
      entity_id:
        - binary_sensor.bed_presence_c175fc_bed_occupied_left
        - binary_sensor.bed_presence_c175fc_bed_occupied_right
      from: "off"
      to: "on"

  actions:
    ############################################################
    # 1️⃣ CHECK DOOR FIRST
    ############################################################
    - choose:
        - conditions:
            - condition: state
              entity_id: input_boolean.lock
              state: "off"
          sequence:
            - action: assist_satellite.ask_question
              data:
                entity_id: assist_satellite.bedroom_assist_satellite
                preannounce: true
                question: "John, I see you're in bed. The front door is unlocked. Do you want me to lock it for you?"
                answers:
                  - id: "yes"
                    sentences:
                      - oh yes
                      - yes please
                      - yeah
                  - id: "no"
                    sentences:
                      - no please
                      - no thank you
                      - nope
              response_variable: door_answer

            - choose:
                - conditions: "{{ door_answer.id == 'yes' }}"
                  sequence:
                    - action: lock.lock
                      target:
                        entity_id: lock.front_door_lock

                    - wait_for_trigger:
                        - trigger: state
                          entity_id: lock.front_door_lock
                          to: "locked"
                      timeout: "00:00:05"
                      continue_on_timeout: true

                    - choose:
                        - conditions: "{{ is_state('lock.front_door_lock', 'locked') }}"
                          sequence:
                            - action: assist_satellite.announce
                              target:
                                entity_id: assist_satellite.bedroom_assist_satellite
                              data:
                                message: "The front door is now locked"
                                preannounce: false
                      default:
                        - action: assist_satellite.announce
                          target:
                            entity_id: assist_satellite.bedroom_assist_satellite
                          data:
                            message: "Locking failed, you need to check the lock"
                            preannounce: false

                - conditions: "{{ door_answer.id == 'no' }}"
                  sequence:
                    - action: assist_satellite.announce
                      target:
                        entity_id: assist_satellite.bedroom_assist_satellite
                      data:
                        message: "The front door remains unlocked"
                        preannounce: false

    ############################################################
    # 2️⃣ THEN CHECK LAMPS
    ############################################################
    - choose:
        - conditions:
            - condition: or
              conditions:
                - condition: state
                  entity_id: switch.john_light_shelly
                  state: "on"
                - condition: state
                  entity_id: switch.girl_light_shelly
                  state: "on"
          sequence:
            - action: assist_satellite.ask_question
              data:
                entity_id: assist_satellite.bedroom_assist_satellite
                preannounce: true
                question: "The bedroom table lights are on. Would you like to jjust turn one them or both of them off?"
                answers:
                  - id: "girl"
                    sentences:
                      - girls
                      - girls please
                      - just girls
                      - just girls side
                  - id: "mine"
                    sentences:
                      - mine
                      - mine please
                      - my side
                      - just mine
                  - id: "both"
                    sentences:
                      - both sides
                      - both
                      - all
                  - id: "no"
                    sentences:
                      - not right now
                      - no thank you
                      - no please
              response_variable: light_answer

            - choose:
                - conditions: "{{ light_answer.id == 'girl' }}"
                  sequence:
                    - action: switch.turn_off
                      target:
                        entity_id: switch.girl_light_shelly

                - conditions: "{{ light_answer.id == 'mine' }}"
                  sequence:
                    - action: switch.turn_off
                      target:
                        entity_id: switch.john_light_shelly

                - conditions: "{{ light_answer.id == 'both' }}"
                  sequence:
                    - action: switch.turn_off
                      target:
                        entity_id:
                          - switch.girl_light_shelly
                          - switch.john_light_shelly

                - conditions: "{{ light_answer.id == 'no' }}"
                  sequence:
                    - action: assist_satellite.announce
                      target:
                        entity_id: assist_satellite.bedroom_assist_satellite
                      data:
                        message: "Ok, Thank you John"
                        preannounce: false