Automation repeat not working correctly

So I made an automation for a boolean with spicific commands for “on” aswell as “off”.
These automations work perfectly fine.

Now I wanted the automation to repeat the “on” function, this also works fine.
But now the “off” function won’t trigger correctly. It just repeats the “on” function until it’s turned off, but is does not start the “off” function.

Does anyone know what wen wrong?

alias: Opladen boolean
description: ''
trigger:
  - platform: state
    entity_id:
      - input_boolean.laden_met_3000w
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - platform: state
    entity_id:
      - input_boolean.laden_met_3000w
    to: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.laden_met_3000w
            state: 'on'
        sequence:
          - repeat:
              while:
                - condition: state
                  entity_id: input_boolean.laden_met_3000w
                  state: 'on'
              sequence:
                - service: rest_command.sonnen_manual
                  data: {}
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 3
                    milliseconds: 0
                - service: rest_command.sonnen_charge_3000w
                  data: {}
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 3
                    milliseconds: 0
      - conditions:
          - condition: state
            entity_id: input_boolean.laden_met_3000w
            state: 'off'
            for:
              hours: 0
              minutes: 0
              seconds: 10
        sequence:
          - service: rest_command.sonnen_discharge_0w
            data: {}
          - delay:
              hours: 0
              minutes: 0
              seconds: 5
              milliseconds: 0
          - service: rest_command.sonnen_automatic
            data: {}
    default: []
mode: single