Here is a good method for dimming lights in Deconz

@KennethLavrsen thanks for sharing! What is the reason you create a group in Deconz instead of a light group in HA?

You’re using the same event (1002) for both ‘Turn On Bedroom from dimmer normal’ and ‘Turn On Bedroom from dimmer bright’, is that correct ?

The reason for using a Deconz group is that the deconz.configure service only works on either deconz lights or deconz groups.

1 Like

No it is not correct. I made a mistake which I later had to correct. The dimmer bright event code should be 1001 and not 1002. I will correct my posting

Looks good!

I didn’t have the patience to figure this out when I set up our dimmer this spring so I just used the Deconz/Phoscon GUI. Might give this a try though. Thanks for sharing!

I created an AppDaemon app that uses the Philips Hue Dimmer switch and applies this method for smooth dimming of the lights. It also adds the possibility to turn on/off other devices or make a service call when a button is pressed. In case someone is interested:

3 Likes

I´ve an Ikea Dimmer Switch Type E1743. On/Off works fine after I followed this tutorial. But how to dimm with this one? I already figured out the events for dimming an stop signals but cant get it to work.

What are you missing, it’s all right there. Can you show your current code please?

My code is the same as in the example. I get it yesterday also working with the 5 Button remote. Only the Dimmer Switch does not work at dimming.
I guess he needs a little adjustment.

switch_work_light_decrease_brightness.yaml

---
# Reduces the brightness of the worktop lighting.
# Devices:
#   Type: "Ikea Tradfri"
#     - Dimmer Switch
#     - Transformer

alias: worklight_dimmer_lights_decrease_brightness
initial_state: "on"
trigger:
  platform: event
  event_type: deconz_event
  event_data:
    id: ku_switch_worklight
    event: 2001
action:
  - service: deconz.configure
    data:
      entity: group.ku_group_work_light
      field: "/state"
      data: { "bri_inc": -254, "transitiontime": 50 }

switch_work_light_increase_brightness.yaml

---
# Increases the brightness of the worktop lighting.
# Devices:
#   Type: "Ikea Tradfri"
#     - Dimmer Switch
#     - Transformer

alias: worklight_dimmer_lights_crease_brightness
initial_state: "on"
trigger:
  platform: event
  event_type: deconz_event
  event_data:
    id: ku_switch_worklight
    event: 1001
action:
  - service: deconz.configure
    data:
      entity: group.ku_group_work_light
      field: "/state"
      data: { "bri_inc": 254, "transitiontime": 50 }

switch_work_light_off.yaml

---
# Switches the worktop lighting off.
# Devices:
#   Type: "Ikea Tradfri"
#     - Dimmer Switch
#     - Transformer

alias: worklight_dimmer_lights_off
initial_state: "on"
trigger:
  platform: event
  event_type: deconz_event
  event_data:
    id: ku_switch_worklight
    event: 2002
action:
  - service: light.turn_off
    data:
      entity_id: group.ku_group_work_light

switch_work_light_on.yaml

---
# Switches on the worktop lighting.
# Devices:
#   Type: "Ikea Tradfri"
#     - Dimmer Switch
#     - Transformer

alias: worklight_dimmer_lights_on
initial_state: "on"
trigger:
  platform: event
  event_type: deconz_event
  event_data:
    id: ku_switch_worklight
    event: 1002
action:
  - service: light.turn_on
    data:
      entity_id: group.ku_group_work_light
      brightness_pct: 100

switch_work_light_stop_brightness.yaml

---
# Stops the dimming of the worktop lighting.
# Devices:
#   Type: "Ikea Tradfri"
#     - Dimmer Switch
#     - Transformer

alias: worklight_dimmer_lights_stop_brightness
initial_state: "on"
trigger:
  - platform: event
    event_type: deconz_event
    event_data:
      id: ku_switch_worklight
      event: 1003
  - platform: event
    event_type: deconz_event
    event_data:
      id: ku_switch_worklight
      event: 2003
action:
  - service: deconz.configure
    data:
      entity: group.ku_group_work_light
      field: "/state"
      data: { "bri_inc": 0 }

edit: I also tried "field: “/state” and "field: “/action”

The deconz.configure service works only with deconz lights or deconz light groups, it does not work with groups created in home assistant.
Also note “field” must be “/action” if it is a light group and “/state” if it is a single bulb.

If you did not already create groups in phoscon, do this and then use these groups instead of “group.ku_group_work_light”. Groups created in phoscon exposed to home assistant will start with “light.” and the attribute “is_deconz_group” is true.

1 Like

Thank you. Now it works!

Is there any way to do this with regular Home Assistant switch?

I have a Deconz switch but a EspHome light.

No. This works only with deconz lights as the service is only available for deconz. Check out this app from @xaviml, it should cover your needs.

Thank you so much @KennethLavrsen! This is great. Saved me a lot of time.

Do someone knows how to translate all these code in Node Red (if possible) ?

I use deconz and i didn’t even bother with all the automations. I just use the Phoscon app to allocate dimmers to the light groups and do it that way.
If you are using Deconz you might and just want to dim hue globes that is easier.
Obviously if you want your hue dimmer to control non-zigbee lights, then the automations are needed.

I made an update of my original post above showing how to do the same function using the new HA version 0.113 automation features. Now you can do is all with one automation which makes it simpler to overview and maintain.

Since I posted my original post I have put all HA config on github. You can find more examples there using the dimming method with deconz

4 Likes

I was given this little simplification which I added to my original post

The stop condition can be

      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.event in ( 2003, 3003 ) }}"

A little more simple.

Thanks for sharing @KennethLavrsen , that’s really cool and just want I needed! Reduced 5 individual scripts down to one and I had got stuck on the stop dimming bit! Thanks again…

I’ve changed this to “… not in ( 2001, 3001 )…” this seems a bit more reliable. Some times I had that the automation kept dimming even after i stopped turning.