How to get smooth dimming/color when dimming lights with Z2MQTT/Bilresa Scrollwheel (or other buttons)

Hello!
So recently got the new Ikea Bilresa scrollwheel and experimentet with dimming lights, and figured out how to get smooth dimming working so I thought I should share it here.

First off, make a group of the lights you want to dim in Z2MQTT (or you could ofc dim a single light).
So the trick is make a automation that is triggered for example when a button is held down (or when Current switch position sensors are triggered if using Bilresa. These sensors have to be enabled).

Next step in the automation is to trigger a light or lightgroup with a long transition time, and set brightness_pct: 100, for example:

action: light.turn_on
metadata: {}
target:
  entity_id: light.your_light
data:
  transition: 5
  brightness_pct: 100

Then wait for a trigger, for example long release (long press end):

wait_for_trigger:
  - domain: mqtt
    device_id: you_device
    type: action
    subtype: 2_long_release
    trigger: device
continue_on_timeout: false
timeout:
  hours: 0
  minutes: 0
  seconds: 10
  milliseconds: 0

If you are using the Bilresa scroll wheel, wait for scrolling to stop:

wait_for_trigger:
  - trigger: numeric_state
    entity_id:
      - sensor.bilresa_scroll_wheel_current_switch_position_4_2
    for:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 400
    below: 1
timeout:
  hours: 0
  minutes: 0
  seconds: 1
  milliseconds: 0

and then you have to send a MQTT message to Z2MQTT that will tell the lights to stop the transition:

action: mqtt.publish
metadata: {}
data:
  evaluate_payload: false
  qos: 0
  retain: false
  topic: zigbee2mqtt/<Light friendly name>/set
  payload: |-
    {
      "brightness_move": 0
    }

If it does not stop the dimming, make sure that Z2MQTT base topic is zigbee2mqtt and that the lights friendly name is correct.

1 Like