Completely opposite of a common problem; lights don't turn off AFTER turning on by the physical switch

My hardware is SonOff Zigbee Bridge (ZBBridge-P), SNZB-03P Zigbee motion sensor and MiniExtremeL2 switch.
To be clean and crisp I have configured two automations to turn the lights connected to MiniL2 switch on and off. The automations work flawlessly. However when I turn the switch on manually or from the card on HA or EWelink app, turn off automation never executes and lights keep open. I have to manually turn the physical switch off or click on the car on HA or EWelink.
I run HA on R.Pi, Core 2025.3.1.
Below are the YAML data of automations. I wiggled and corrupted them a little but still they work when I trigger the sensor and a few seconds pass, not detected.

I looked at the community but it seems everybody complains about the other way; turn the lights on manually but they don’t stay on, automation turns them off. I have the exact opposite position as problem. Physically turn the switch on > lights on but they never turn off automatically. If turned on by automation, they turn off by automation AND physically.

Could you help me?

alias: ISIK ON
description: ""
triggers:
  - type: motion
    device_id: 60713e93a19b8b6da21d8b1706edf3cf
    entity_id: 3d249ae200e19d98a198b80f18c86846
    domain: binary_sensor
    trigger: device
conditions:
  - condition: state
    entity_id: binary_sensor.sonoff_a4b001c989_light
    state: "off"
  - condition: device
    type: is_off
    device_id: 7b3ed0fdf2269c924d0f91b74959a9dc
    entity_id: 108f1d859eecfa1e0200c5a4323ae61a
    domain: switch
actions:
  - type: turn_on
    device_id: 7b3ed0fdf2269c924d0f91b74959a9dc
    entity_id: 108f1d859eecfa1e0200c5a4323ae61a
    domain: switch
  - choose: []
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: ISIK ACILDI
mode: single


alias: ISIK TURN OFF
description: ""
triggers:
  - type: no_motion
    device_id: 60713e93a19b8b6da21d8b1706edf3cf
    entity_id: 3d249ae200e19d98a198b80f18c86846
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 0
      seconds: 2
    enabled: false
  - trigger: state
    entity_id:
      - binary_sensor.sonoff_a4b001c989
    from: "on"
    to: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 1
conditions:
  - condition: state
    entity_id: binary_sensor.sonoff_a4b001c989
    state: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 1
    enabled: false
actions:
  - type: turn_off
    device_id: 7b3ed0fdf2269c924d0f91b74959a9dc
    entity_id: 108f1d859eecfa1e0200c5a4323ae61a
    domain: switch
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: ISIK KAPANDI
  - action: notify.mobile_app_2201116tg
    metadata: {}
    data:
      message: ISIK Hareket yok kapandı
  - action: notify.lg_webos_smart_tv
    metadata: {}
    data:
      message: ISIK KAPAndı
mode: single

Why all the conditions? And why in the “off” automation do you specify a small number of seconds in the trigger and the condition?

Most automations of this kind would be something like:

triggers:
  - trigger: state
    entity_id:
      - binary_sensor.yard_motion_sensor
    to: "on"
actions:
  - action: light.turn_on
    target:
      entity_id: light.yard

and…

triggers:
  - trigger: state
    entity_id:
      - binary_sensor.yard_motion_sensor
    to: "off"
    for:
      hours: 0
      minutes: 10
      seconds: 0
actions:
  - action: light.turn_off
    target:
      entity_id: light.yard

Conditions are set to be sure that if lights are off than run the ‘turn on’ action. And turn off the lights only after a certain amount of time passed with sensor state is ‘off’, if detected any movement, sensor state is off, don’t run the ‘off automation’ and turn off the lights.
“small number of seconds” because I am impatient to wait for minutes to see if the automation works. Let’s see what happens in a few seconds. :slightly_smiling_face:

If you turn on the lights when they are already on… nothing happens. :grin: