Changed behaviour automation

Sorry if this seems to be a topic for another category.
I have a setup in my bathroom with:

  • Aeotec multisensor 7
  • Shelly dimmer 2

If it is evening or night I want the lights to dim to a certain level so I am not “blinded by the light”. In good times the automation worked flawless but since some weeks it is not that flawless anymore. I also have a brightness for daytime when there is not enough light. Evening and night are boolean switches.
What is happening is this. When I enter the bathroom in the evening or night the lights go on on day brightness and after 5 or 6 seconds they dim to the evening or night brightness. Not with a on/off behavior but dimming to the desired level.
I cannot find what is causing this. My automation below:

alias: Badkamer licht aan
description: Badkame licht aan
trigger:
  - platform: state
    entity_id:
      - binary_sensor.badkamer_beweging
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition:
  - condition: numeric_state
    entity_id: sensor.badkamer_lichtsterkte
    below: 50
action:
  - if:
      - condition: state
        entity_id: input_boolean.avond
        state: "on"
    then:
      - service: scene.turn_on
        data: {}
        target:
          entity_id: scene.badkamer_licht_avond
    else:
      - if:
          - condition: state
            entity_id: input_boolean.nacht
            state: "on"
        then:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.badkamer_licht_nacht
        else:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.badkamer_licht_dag
mode: single

I hope there is someone who can help me with this.