Ikea on/off button

hi I have an Ikea on / off button which is connected to HA. I can get the Ikea button to turn the light on and off and turn it up and down, but when I turn the light off and on again Then it sets the bulb to 1% some who can help

When you call the service to turn on the light you can also set the brightness to 100%:


action:
  - service: light.turn_on
    data:
      brightness_pct: 100
    target:
      entity_id: light.garage_zgroup_zha_group_0x0002
mode: single

it is a blueprint

Then edit the blueprint to add the data…

blueprint:
  name: ZHA - IKEA Tradfri on/off switch
  description: '"Control your light(s) with IKEA Tradfri on/off switch


    Select the Tradfri remote and your lights.

    You can turn the lights On / Off, or hold the buttons to dim the lights"

    '
  domain: automation
  input:
    remote:
      name: Remote
      description: The remote that will control the lights
      selector:
        device:
          integration: zha
          manufacturer: IKEA of Sweden
          model: TRADFRI on/off switch
    light:
      name: Light
      description: The lights that will be controlled
      selector:
        target:
          entity:
            domain: light
  source_url: https://community.home-assistant.io/t/zha-ikea-tradfri-on-off-switch-incl-dimmer/255412
mode: restart
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "remote"
action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      cluster_id: "{{ trigger.event.data.cluster_id }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
  - choose:
      - conditions:
          - "{{ command == 'on' }}"
          - "{{ cluster_id == 6 }}"
          - "{{ endpoint_id == 1 }}"
        sequence:
          - service: light.turn_on
            target: !input "light"
            data:
              transition: 1

      - conditions:
          - "{{ command == 'off' }}"
          - "{{ cluster_id == 6 }}"
          - "{{ endpoint_id == 1 }}"
        sequence:
          - service: light.turn_off
            target: !input "light"
            data:
              transition: 1
      - conditions:
          - "{{ command == 'move_with_on_off' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
        sequence:
          repeat:
            while:
              - condition: template
                value_template: "{{ repeat.index < 10 }}"
            sequence:
              - service: light.turn_on
                target: !input "light"
                data:
                  transition: 1
                  brightness_step_pct: 60
              - delay: 1
      - conditions:
          - "{{ command == 'move' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
        sequence:
          repeat:
            while:
              - condition: template
                value_template: "{{ repeat.index < 10 }}"
            sequence:
              - service: light.turn_on
                target: !input "light"
                data:
                  transition: 1
                  brightness_step_pct: -30
              - delay: 1
      - conditions:
          - "{{ command == 'stop' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
        sequence:
          - service: light.turn_on
            target: !input "light"

this is the code, what should i change?

i want it to use last used brightness

Doesn’t that depend on your Zigbee driver?