#How to use brightness_move_up in Z2M to increase brightness from holding a button?

1 messages · Page 1 of 1 (latest)

patent jetty
#

I've enabled simulated brightness for my device in Z2M and try to trigger on brightness_move_up. I can see that holding the button generates several MQTT events but this trigger is only triggered once it seems: domain: mqtt device_id: 55asfkjahsfsakjfhkjha type: action subtype: brightness_move_up trigger: device id: Dimme opp

#

Is this the way? trigger: mqtt topic: zigbee2mqtt/Reading lamp switch id: MQTT
And

target:
  entity_id: light.bedroom_reading_lamp
data:
  brightness: "{{ trigger.payload_json.brightness }}"```
patent jetty
#

It's at least not ideal. When I restarted z2m addon it changed the lights.

patent jetty
#

Some ChatGPT-harassment got me this: action: light.turn_on target: entity_id: light.soverom_1_taklampe data: brightness: > {% set current_brightness = state_attr('light.soverom_1_taklampe', 'brightness') %} {% set delta = trigger.payload_json.action_brightness_delta | default(0) %} {% set new_brightness = ((current_brightness if current_brightness is not none else 0) | int) + delta %} {{ [0, [new_brightness, 255] | min] | max }} Is there a simpler way?

#

Oh, I also had to do condition: template value_template: "{{ trigger.payload_json.action_brightness_delta is not none }}"To make sure it skipped the payload that is sent when HA addon is restarted.

patent jetty
#

Bump

patent jetty
#

Hello, hello?

warm mason
#

You set the automation mode to restart and start an infinite loop of making the lamp brighter.
On brightness_stop you do "stop" which cancels the previous infinite loop.

patent jetty
#

Is that by using the simulated brightness as instructed in z2m docs? ```simulated_brightness:
delta: 20 # delta per interval, default = 20
interval: 200 # interval in milliseconds, default = 200

warm mason
#
      - condition: trigger
        id:
          - brightness_up
    sequence:
      - repeat:
          sequence:
            - metadata: {}
              data:
                brightness: >-
                  {{
                  state_attr(states('input_select.testdropdown'),'brightness')
                  +5 }}
              target:
                entity_id: "{{ states('input_select.testdropdown') }}"
              action: light.turn_on
            - delay:
                hours: 0
                minutes: 0
                seconds: 0
                milliseconds: 100
          while: []
#

That's for brightness up

#
      - condition: trigger
        id:
          - brightness_stop
    sequence:
      - stop: ""
#

That's for stopping to make it brighter

#

The brightness_stop event triggers on releasing the button

patent jetty
#

Should it also work for a rotary button like E1744?

warm mason
#

Yes it should according to the documentation