Here is a good method for dimming lights in Deconz

I had this in my AppDaemon app in the past, I wrote if for someone else as I’m not using KNX.

I use a ConBee II for ZigBee and everything is instant, because the changes are pushed to HA instead of pulled fron the Hue Bridge.

Yes, I use a Swisscom TV box, but I didn’tbother to put it behind the USG router, I just left it in the same subnet as the swisscom router, It’s the only device not behind the USG.

@daniwebCH have a look here :wink:
KNX - relative dimming for lights

1 Like

Can you still cast to the swisscomTV from your phone?

I don’t know, never used this, when I cast something from my phone I cast it to my Kodi player, but tbh I never use this.

Is it also possible to use this setup with a Shelly 1L as a switch? This device doesn’t support hold and release. What I want to do is start the dimming after a long press and stop the dimming after long pressing again. It’s that possible?

UPDATE: I think I figured out how the automation works; single transition (transition time being in tenths of a second) and is “cancelled” by the release of the button. However I am still looking for a way to have a lower threshold. My guess would be something along the lines of a calculation which passes “the current brightness level minus the minimum threshold” as the bri_inc value in the “dim down” option. But my scripting skills are not good enough to get it right just yet. Can anyone help out? My dimmers also have a physical button for setting the minimum level, but preferably I would like it to be part of the automation to avoid being dependent on physical access to the device (which are typically in the wall/ceiling in my house).

UPDATE2: I figured out how to set the minimum level by using a template in the “dim down” option. Something along these lines:

bri_inc: >
  {{ 50 - state_attr('light.light_source', 'brightness') | int }}

where 50 is my minimum level.

Original comment
This is great! Thanks for sharing. I have it working nicely with an IKEA Tradfri on/off switch.

However, I do have one wish, which I don’t have enough experience with automations/scripting to accomplish: When dimming down the lights, I would like it not to completely turn off my light, but have a configurable lower boundary which the automation will not go below, even if I keep the button pressed.

I have tried playing with the bri_inc value in the “dim down” option, but cannot seem to get it right. I might also need a bit of clarification about how this actually works.

As I understand it, the “dim down” condition is only hit once (when I press the switch down and hold it). And as such, I assumed that would start a brightness decrease with value -254 (as per the OP) with a transition time of 50 (ms?). Since the dimming definitely happens a lot slower than 50ms, I assumed it works by initializing a dimming process which dims in steps of -254 every 50ms thus resulting in a (relatively) smooth dim down operation. However, when I inspect the state of the light, I can see that it has a brightness value of 254 when brightest, and 0 when dimmed all the way down (i.e. to “off”).

So I cannot really understand how the automation works. Can someone please explain to me how it works?

Regarding having a lower limit, I can add a condition to the “dim down” option to only execute if the current brightness level is above a specific value, however, this only prevents the “dim down” option from executing if the brightness is below the condition value when the button is pressed (i.e. nothing happens), but if the brightness is above the condition value, then it dims all the way down. So I would love some guidance on how to achieve a lower boundary on the “dim down” option.

As mentioned I am using the IKEA Tradfri on/off switch, and therefore long-pressing the switch only produces one event when long press is detected, and another event when the switch is released (as opposed to continuous events while keeping it pressed).

Sorry, I got another noob question.

I tried adding the option to change the hue to Kenneth’s yaml. However, I failed miserably.

Here is my addition:

      # Hue Increase
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.event == 5001 }}"
        sequence:
          - service: deconz.configure
            data:
              entity: light.badezimmer
              field: "/action"
              data: {"hue":10, "transitiontime":100}
      # Hue Decrease
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.event == 4001 }}"
        sequence:
          - service: deconz.configure
            data:
              entity: light.badezimmer
              field: "/action"
              data: {"hue":-10, "transitiontime":100}
      # Stop hue increase/decrease 
      - conditions:
          - condition: template
            value_template:  "{{ trigger.event.data.event in ( 4003, 5003 ) }}"
        sequence:
          - service: deconz.configure
            data:
              entity: light.badezimmer
              field: "/action"
              data: {"hue":0}

When I press the “>” button on the Tradfri remote, this will change the hue until it reaches red. From then on, nothing will change. The “<” button does not seem to have any effect at all.

Similar to the bri_inc example in the original post, I also tried switching “hue” for “hue_inc”, e.g. data: {"hue_inc":10, "transitiontime":100}, to no avail.

Help would be highly appreciated.

Hi, the approach of Kenneth works perfectly! Thank you for this.
I think we can make it even more efficient:
The long-press event (1001) is generating its event every second until the release of the button is happening (1003) (i’m using the internal wall module). This means that the trigger to dim up is also fired every second in Home Assistant. One time should be enough, until the release-event is happening.

Is it possible to add a condition that makes sure that the long-press event (1001) is ignored if another long-press event (1001) was already observered in the last second? This would make zigbee network signalling even more efficient.

Hi,

I’ve solved this with two input booleans. See below the implemented optimization.

alias: alias of the automation
description: ""
trigger:
  - device_id: 5421144978f28dd04b59bb87a23843ad
    domain: deconz
    platform: device
    type: remote_button_long_press
    subtype: button_2
    id: dimmer
  - device_id: 5421144978f28dd04b59bb87a23843ad
    domain: deconz
    platform: device
    type: remote_button_long_release
    subtype: button_2
    id: dimmer stop
  - device_id: 5421144978f28dd04b59bb87a23843ad
    domain: deconz
    platform: device
    type: remote_button_long_press
    subtype: button_1
    id: brighter
  - device_id: 5421144978f28dd04b59bb87a23843ad
    domain: deconz
    platform: device
    type: remote_button_long_release
    subtype: button_1
    id: brighter stop
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: dimmer
          - condition: state
            entity_id: input_boolean.living_room_dimstatus
            state: "off"
        sequence:
          - parallel:
              - service: deconz.configure
                data:
                  entity: light.living_room_deconz
                  field: /action
                  data:
                    bri: 0
                    transitiontime: 50
              - service: input_boolean.turn_on
                data: {}
                target:
                  entity_id: input_boolean.living_room_dimstatus
      - conditions:
          - condition: trigger
            id: dimmer stop
        sequence:
          - parallel:
              - service: deconz.configure
                data:
                  entity: light.living_room_deconz
                  field: /action
                  data:
                    bri_inc: 0
              - service: input_boolean.turn_off
                data: {}
                target:
                  entity_id: input_boolean.living_room_dimstatus
      - conditions:
          - condition: trigger
            id: brighter
          - condition: state
            entity_id: input_boolean.living_room_dimstatus
            state: "off"
        sequence:
          - parallel:
              - service: deconz.configure
                data:
                  entity: light.living_room_deconz
                  field: /action
                  data:
                    bri: 254
                    transitiontime: 50
              - service: input_boolean.turn_on
                data: {}
                target:
                  entity_id: input_boolean.living_room_dimstatus
      - conditions:
          - condition: trigger
            id: brighter stop
        sequence:
          - parallel:
              - service: deconz.configure
                data:
                  entity: light.living_room_deconz
                  field: /action
                  data:
                    bri_inc: 0
              - service: input_boolean.turn_off
                data: {}
                target:
                  entity_id: input_boolean.living_room_dimstatus
    default: []
mode: queued
max: 10