WhyTH is there not an options for smoothly dimming/brighten light and stopping the dimming/brighten effect?

I managed to dimm hue lights from a zwave Fibaro switch. But basically it can be any switch which fires event on short/long presses and releases of the buttons.

It starts dimming by setting the brightness to 255 with a transition time of 5 seconds. It stops the transition with a zigbee group command or cluster command, depending if you want to dimm a group of lights or a single bulb.

It dimms up or down depending on a boolean which is toggled on/off every long press of the button.

ZHA group brightness transition stop command:


      - service: zha.issue_zigbee_group_command
            data:
              group: 2
              command: 3
              cluster_id: 8
              args: []

Single bulb brightness transition stop command:


          - service: zha.issue_zigbee_cluster_command
            data:
              ieee: '00:17:88:01:08:87:36:29'
              cluster_id: 8
              endpoint_id: 11
              command: 3
              command_type: server
              args: []

At the group command it’s important to fill in your zha group ID. When u want to dimm a single bulb it’s important to fill in the ieee address of the bulb. Also check the endpoint ID, beacause some vendors use ID 1 but hue for example uses endpoint ID 11.

Full script:


alias: Dimmer Woonkamer 1
description: ''
trigger:
  - platform: device
    device_id: 2db81c88352e90e038c5f627155120ff
    domain: zwave_js
    type: event.value_notification.scene_activation
    property: sceneId
    property_key: null
    endpoint: 0
    command_class: 43
    subtype: Endpoint 0
    id: key1-hold
    value: 12
  - platform: device
    device_id: 2db81c88352e90e038c5f627155120ff
    domain: zwave_js
    type: event.value_notification.scene_activation
    property: sceneId
    property_key: null
    endpoint: 0
    command_class: 43
    subtype: Endpoint 0
    id: key1-released
    value: 13
  - platform: device
    device_id: 2db81c88352e90e038c5f627155120ff
    domain: zwave_js
    type: event.value_notification.scene_activation
    property: sceneId
    property_key: null
    endpoint: 0
    command_class: 43
    subtype: Endpoint 0
    id: key1-short
    value: 16
  - platform: device
    device_id: 2db81c88352e90e038c5f627155120ff
    domain: zwave_js
    type: event.value_notification.scene_activation
    property: sceneId
    property_key: null
    endpoint: 0
    command_class: 43
    subtype: Endpoint 0
    id: key2-hold
    value: 22
  - platform: device
    device_id: 2db81c88352e90e038c5f627155120ff
    domain: zwave_js
    type: event.value_notification.scene_activation
    property: sceneId
    property_key: null
    endpoint: 0
    command_class: 43
    subtype: Endpoint 0
    id: key2-released
    value: 23
  - platform: device
    device_id: 2db81c88352e90e038c5f627155120ff
    domain: zwave_js
    type: event.value_notification.scene_activation
    property: sceneId
    property_key: null
    endpoint: 0
    command_class: 43
    subtype: Endpoint 0
    id: key2-short
    value: 26
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: key1-hold
              - condition: state
                entity_id: input_boolean.dimmer_woonkamer_1_key_1_state
                state: 'on'
        sequence:
          - service: light.turn_on
            data:
              transition: 5
              brightness: 255
            target:
              device_id: bdbbaacb21ae1fded75dc65227947ead
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.dimmer_woonkamer_1_key_1_state
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: key1-hold
              - condition: state
                entity_id: input_boolean.dimmer_woonkamer_1_key_1_state
                state: 'off'
        sequence:
          - service: light.turn_on
            data:
              transition: 5
              brightness: 1
            target:
              device_id: bdbbaacb21ae1fded75dc65227947ead
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.dimmer_woonkamer_1_key_1_state
      - conditions:
          - condition: trigger
            id: key1-short
        sequence:
          - service: light.toggle
            data: {}
            target:
              device_id: bdbbaacb21ae1fded75dc65227947ead
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.dimmer_woonkamer_1_key_1_state
      - conditions:
          - condition: trigger
            id: key1-released
        sequence:
          - service: zha.issue_zigbee_cluster_command
            data:
              ieee: 00:17:88:01:06:2f:46:0f
              cluster_id: 8
              endpoint_id: 11
              command: 3
              command_type: server
              args: []
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: key2-hold
              - condition: state
                entity_id: input_boolean.dimmer_woonkamer_1_key_2_state
                state: 'on'
        sequence:
          - service: light.turn_on
            data:
              transition: 5
              brightness: 255
            target:
              device_id: 14ccc0c07847e17ea4c0cd712928d8b5
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.dimmer_woonkamer_1_key_2_state
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: key2-hold
              - condition: state
                entity_id: input_boolean.dimmer_woonkamer_1_key_2_state
                state: 'off'
        sequence:
          - service: light.turn_on
            data:
              transition: 5
              brightness: 1
            target:
              device_id: 14ccc0c07847e17ea4c0cd712928d8b5
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.dimmer_woonkamer_1_key_2_state
      - conditions:
          - condition: trigger
            id: key2-short
        sequence:
          - service: light.toggle
            data:
              transition: 1
            target:
              device_id: 14ccc0c07847e17ea4c0cd712928d8b5
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.dimmer_woonkamer_1_key_2_state
      - conditions:
          - condition: trigger
            id: key2-released
        sequence:
          - service: zha.issue_zigbee_cluster_command
            data:
              ieee: '00:17:88:01:08:87:36:29'
              cluster_id: 8
              endpoint_id: 11
              command: 3
              command_type: server
              args: []
    default: []
mode: single

The result is smooth dimming without the need of external implementations. It works with home assistant and zha and it doesn’t congest the zigbee network with brightness up/down commands every x milliseconds like some scripts do.

3 Likes