Light service transition stop command

Hi
I’ve managed to get the same dimming fonction for the Ikea On/Off switch in ZHA (hold to dim up/down, release to stop)
I’ve added dim_release(s) in the zha_quirks file

I call a light.turn_on {brightness:255,transition:5} on button up hold
and to stop the light transition(on button release) I must call zha cluster command:
zha.issue_zigbee_cluster_command {
endpoint_id: 1,
ieee: 14:b4:57:ff:fe:7e:1b:e1,
cluster_id: 8,
cluster_type: in,
command: 3,
command_type: server
}

Could this function(cluster command stop) be integrated in the service light? like light.stop_transition or light.turn_on {transition:0}.

Thanks for your help!
Newby enthusiastic HA user.

Hello, I have just switched from deconz, where they had a nice feature setup to do exactly what you are trying to do with ZHA.
I have however just switched to use ZHA, since they support devices like locks and such, where DeConz does not support this.
So I am in the process of rewriting all my automations to do the same, but for ZHA. I can’t however find a solution to get this to work.
When I call the service I get an error message saying that it failed to send command.

How do I know what endpoint, cluster_id, cluster_type, command and command_type to use?

Ok, I got it working. But this is definitely not an optimal way of doing it. Since the HA does’nt know you stopped it, when clicking on turn on button again, it will set it to full brightness.

This is exactly what I needed for my Hue lightbulb, so I’ll put more details if someone is looking for this later.

We need to send two commands to do smooth dimming: one to tell the bulb to start dimming (on button start long press), and one to stop dimming (on button stop long press, when we reach the desired brightness). It’s different to sending commands in a loop with small steps until we reach the desired brightness. It’s a device-specific behaviour, so ymmv, but that’s how smooth dimming Hue lightbulbs at least are implemented.

The turn_on command (on start long press) tells the bulb to start increasing the brightness to 255 (100%) at a speed that means that it will reach that brightness within 5s.
The zha.issue_zigbee_cluster_command (on release long press) tells the bulb to stop dimming at whichever level it is when it receives the command.

The request is about getting the stop dimming command to be similar in shape to the turn_on.

In any case, to get the values you need:

  • ieee can be found in the Device Info part of the lightbulb device page.

  • endpoint_id and cluster_id will be the values for the LevelControl cluster in the list of clusters you can see in the Manage Clusters window (look in the 3 dot menu in the Device Info properties). I believe cluster_id will always be 8, and endpoint_id will be the same for all lightbulbs on a single network.

  • cluster_type is always in

  • command is always 3

  • command_type is always server

Thanks for posting this approach. I was starting the transition using the light.turn_on service, but this appears to assume the light entity reaches the target brightness at the end of the configured transition time even if the transition is stopped. Starting the transition using a zigbee cluster command avoids this problem, and also results in the reported entity brightness being updated periodically during the transition.

Example using zha_toolkit to issue the cluster command.

Start brightness transition (e.g. on dim down held, dimming down to 2 over 30x0.1 seconds):

service: zha_toolkit.zcl_cmd
data:
  ieee: light.hall_front_light
  endpoint: 11
  cluster: 8
  cmd: 0
  args:
    - 2
    - 30

Stop brightness transition (e.g. on hold release):

service: zha_toolkit.zcl_cmd
data:
  ieee: light.hall_front_light
  endpoint: 11
  cluster: 8
  cmd: 3