Im trying to get a dimmer working

Hello.

Iam trying to get a IKEA E2001 to dim a lamp. But its not stopping when it get the “brightness_stop” command.

At the moment so am I dimming a helper to avoid making my wife to annoyed on the lamps.

alias: IKEA-T
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.k001_ikea_s1_action
    to: brightness_move_up
    id: Up
  - platform: state
    entity_id:
      - sensor.k001_ikea_s1_action
    to: brightness_move_down
    id: Down
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Up
        sequence:
          - repeat:
              until:
                - condition: state
                  entity_id: sensor.k001_ikea_s1_action
                  state: brightness_stop
              sequence:
                - service: input_number.increment
                  data: {}
                  target:
                    entity_id: input_number.dimmer_test
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 100
      - conditions:
          - condition: trigger
            id: Down
        sequence:
          - repeat:
              until:
                - condition: state
                  entity_id: sensor.k001_ikea_s1_action
                  state: brightness_stop
              sequence:
                - service: input_number.decrement
                  data: {}
                  target:
                    entity_id: input_number.dimmer_test
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 100
mode: restart

If anyone can point me in the right direction on how to get the automation stop dimming the helper or lamp when i release the button.

What are the states of sensor.k001_ikea_s1_action when button is pushed and then released?

It’s working when I starts to dim up or down.
But it’s not stopping when I release the button.

info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"brightness_move_up","action_rate":83,"battery":100,"linkquality":176,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"","battery":100,"linkquality":176,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1/action', payload 'brightness_move_up'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"brightness_stop","battery":100,"linkquality":172,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"","battery":100,"linkquality":172,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1/action', payload 'brightness_stop'

I use the “repeat while” on my dimmers, works the way you described you want. You could try that.

condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: dim-up-l1
        sequence:
          - repeat:
              while:
                - condition: trigger
                  id: dim-up-l1
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step: 5
                  target:
                    entity_id: light.dimmer_spisestue
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 200
      - conditions:
          - condition: trigger
            id: dim-down-l1
        sequence:
          - repeat:
              while:
                - condition: trigger
                  id: dim-down-l1
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step: -5
                  target:
                    entity_id: light.dimmer_spisestue
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 200
mode: restart

Thanks, but m2q only send the command once for me so it dosent dim the light at all.

Executed: December 7, 2022 at 2:23:20 PM
repeat
Executed: December 7, 2022 at 2:23:20 PM
Result:

result: false

repeat/while/0
Executed: December 7, 2022 at 2:23:20 PM
Result:

result: false

repeat/while/0/entity_id/0
Executed: December 7, 2022 at 2:23:20 PM
Result:

result: false
state: None
wanted_state: brightness_move_up

action:
  - choose:
      - conditions:
          - condition: trigger
            id: Up
        sequence:
          - repeat:
              while:
                - condition: state
                  entity_id: sensor.k004_ikea_t1_action
                  state: brightness_move_up
              sequence:
                - service: light.turn_on
                  data:
                    brightness_pct: 10
                    brightness_step_pct: 5
                  target:
                    entity_id: light.sovrum_edlyn
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 100
      - conditions:
          - condition: trigger
            id: Down
        sequence:
          - repeat:
              while:
                - condition: state
                  entity_id: sensor.k001_ikea_s1_action
                  state: brightness_move_down
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: -5
                  target:
                    entity_id: light.sovrum_edlyn
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 100
mode: restart

I repeat my question. Could you report in dev tools/states the state of sensor.k001_ikea_s1_action when the light is dimmed up, down and stopped. Just to make sure that when it is stopped, I guess whenever the dim button is released, the state is brightness_stop

info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"brightness_move_up","action_rate":83,"battery":100,"linkquality":176,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"","battery":100,"linkquality":176,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1/action', payload 'brightness_move_up'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"brightness_stop","battery":100,"linkquality":172,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1', payload '{"action":"","battery":100,"linkquality":172,"update":{"installed_version":"1.0.024","state":null},"update_available":null}'
info 2022-12-07 13:53:55MQTT publish: topic 'zigbee2mqtt/K001-IKEA-S1/action', payload 'brightness_stop'

Thats from m2q, Iam running HA in container. So I dont have the any other view of the states that I know off.

In HA, go to developer tools / states and filter to the entity sensor.k004_ikea_t1_action

Is there any way to get it to pause after it receives the command ?
Its flashing really fast.

action: 
battery: 100
linkquality: 168
update: 
installed_version: 1.0.024
state: null

update_available: null
icon: mdi:gesture-double-tap
friendly_name: K001-IKEA-S1 action

As you see, it does not report any state, which is weird. Whatever it is it should report a state. This may be the reason why it does not stop dimming.
You could go to the trace of this automation in order to check various information. Go to settings then automation filter with the name of the automation, select trace.

It flashes by really fast. But I managed to get a screenshoot from vlc with it.
But it seems as not every command are coming thru, or its going so fast that I cant detect it on the screen.

https://streamable.com/2tbko7

Here are a link to a few sec of screen recordings.

On the trace, its still running.

So its getting the command, really fast. But it dont want to read the stop command.
trace