Don't run automation when a light switch has manually been pressed

In that case think you don’t even have to turn the helper on/off (as it is already toggled from HA)

So then it becomes something like this:

alias: Automatic on motion between 20:30 and 07:00, manual when turned on manual
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.kitchenlight_manual_helper
    from: "off"
    to: "on"
    id: switch_on
  - platform: state
    entity_id:
      - input_boolean.kitchenlight_manual_helper
    from: "on"
    to: "off"
    id: switch_off
  - platform: state
    entity_id:
      - binary_sensor.lounge_presence_sensor_kitchen
    from: "off"
    to: "on"
    id: motion
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - switch_on
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id: light.kitchen_cabinets
      - conditions:
          - condition: trigger
            id:
              - switch_off
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.kitchen_cabinets
      - conditions:
          - condition: trigger
            id:
              - motion
          - condition: time
            after: "20:30:00"
            before: "07:00:00"
          - condition: state
            entity_id: kitchenlight_manual_helper
            state: "off"
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id: light.kitchen_cabinets
          - delay:
              hours: 0
              minutes: 0
              seconds: 30
              milliseconds: 0
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.kitchen_cabinets
mode: restart

Here as long as the kitchenlight_manual_helper equals ‘on’ , the motion will not be active:

          - condition: state
            entity_id: kitchenlight_manual_helper
            state: "off"

And when the kitchenlight_manual_helper equals ‘off’, this condition still needs to be met:

          - condition: time
            after: "20:30:00"
            before: "07:00:00"

If not, it still won’t pass :wink: