Automation doesn;t work properly, help please

this automation doesn’t work - the light turned on late after sunrise… any idea?

alias: Outside motion
description: ""
trigger:
  - type: motion
    platform: device
    device_id: db6f630efb7fd3eee1f2af771875debb
    entity_id: binary_sensor.motion_yard
    domain: binary_sensor
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: input_boolean.shabes_mode
        state: "off"
      - condition: sun
        after: sunset
        before: sunrise
action:
  - type: turn_on
    device_id: db7cd2ac9ebf3658ce8cb7f6e3f3df94
    entity_id: switch.on_off_light_58
    domain: switch
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: db7cd2ac9ebf3658ce8cb7f6e3f3df94
    entity_id: switch.on_off_light_58
    domain: switch
mode: single

It’s an or-condition. So if input_boolean.shabes_mode is off, the light turns on, regardless.

1 Like