If Then Else issue

I am having an issue with one of my automations. When it runs, it executes the code in the ‘then’ section, and also executed the code in the ‘else’ section. This code is to turn on a lightstrip in the morning. I have a simple boolean switch, which if ‘on’ will not turn on the lightstrip. I want the boolean to be set back to ‘off’, so the next day the lightstrip will turn on.

What is happening when this automation runs when the boolean is set to ‘on’ is:

  1. The boolean is set to off
  2. The lightstrip turns on

It seems like such a simple thing, but I can’t figure out what is going on. Am I missing something completely obvious?

if:
  - condition: state
    entity_id: input_boolean.override_set_no_school_lightstrip
    state: "on"
then:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.override_set_no_school_lightstrip
else:
  - service: script.lightstrip_turn_on_sunrise
    data: {}

Please show the full automation.
You wouldn’t have another one triggered on input_boolean.override_set_no_school_lightstrip, by any chance?

Oh wow. I was only looking at the visual editor for the entire automation and not the Yaml. I swear that in the visual editor, there is only one main if/then action. In Yaml there are two. It seems I figured out the problem and can fix it in Yaml, but wow that is weird. It must be some missed cleanup from the workday sensor that was changed in last months release.

alias: "Wake Up: Lightstrip"
description: ""
trigger:
  - platform: time
    at: input_datetime.time_bedroom_light_strip_wake_up
condition: []
action:
  - if:
      - condition: state
        entity_id: binary_sensor.workday_sensor
        state: "on"
    then:
      - if:
          - condition: state
            state: "on"
            entity_id: input_boolean.override_set_no_school_lightstrip
        then:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id:
                - input_boolean.override_set_no_school_lightstrip
        else:
          - service: script.lightstrip_turn_on_sunrise
            data: {}
    else:
      - if:
          - condition: state
            state: "on"
            entity_id: input_boolean.override_set_no_school_lightstrip
        then:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id:
                - input_boolean.override_set_no_school_lightstrip
  - if:
      - condition: state
        entity_id: binary_sensor.workday
        state: "on"
    then:
      - if:
          - condition: state
            entity_id: input_boolean.override_set_no_school_lightstrip
            state: "on"
        then:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.override_set_no_school_lightstrip
        else:
          - service: script.lightstrip_turn_on_sunrise
            data: {}
mode: single

It is better practice to use a Choose action instead of nesting If/Then actions:

alias: "Wake Up: Lightstrip"
description: ""
trigger:
  - platform: time
    at: input_datetime.time_bedroom_light_strip_wake_up
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: 
              - binary_sensor.workday_sensor
              - input_boolean.override_set_no_school_lightstrip
            state: "on"
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id:
                - input_boolean.override_set_no_school_lightstrip
      - conditions:
          - condition: state
            entity_id: binary_sensor.workday_sensor
            state: "on"
        sequence:
          - service: script.lightstrip_turn_on_sunrise
            data: {}