Motion script do not work correctly _ light does not turn on [done]

‘Dear community, can anyone of you help me out and tell me why the light does not turn on. The switch off works without any problems.’

alias: Büro Bewegungsmelder
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.0x00158d000237535a_occupancy
    from: "off"
    to: "on"
    id: normal
  - platform: state
    entity_id:
      - binary_sensor.aqara_motion_buero_occupancy
    to: "off"
    for:
      hours: 0
      minutes: "{{ states.input_number.buero_licht_timer_min.state | int }}"
      seconds: 0
    id: vergessen
condition: []
action:
  - if:
      - condition: trigger
        id: normal
    then:
      - service: light.turn_on
        data:
          brightness_pct: 35
        target:
          entity_id: light.buero
    else:
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.buero
mode: single

Can I suggest:

Could you use Developer tools - States to see what the motion sensor state is shown as when there is no motion and when there is motion.

Also, is a trace produced when motion occurs?

sorry, I have entered the wrong motion sensor …(0x00158d000237535a_occupancy is from toilet) I am the stupidest
has been done, now it works.

Thanks for the help :slight_smile:

No worries. We’ve all been there!