Controlling brightness increase increments

Hi, I have migrated from a Hue bridge to ZHA, through Conbee II.
Everything is set up, and working.

I have configured all my remotes with the lights, through automations, which I reckon is the right way?

Turning on and off lights, with the 4 button, Hue remote is working beautifully. But changing the brightness, allthough it is working, I believe it is doing rather choppy adjustments of brightness, at around 10% per click. And even if I use the continuous press as a trigger, it is quite unsmooth, when adjusting brightness.

Is there a way to decrease the increments size? So light is changing at a smoother rate, which I am used to with native Hue integration?

This is an example of an automation, which works, but adjustments are too choppy:

- id: '1595055029421'
  alias: Dining Room Lights Dim Up - Cont
  description: ''
  trigger:
  - device_id: 54fc336deede4529bb6d82127c8f7739
    domain: zha
    platform: device
    subtype: dim_up
    type: remote_button_long_press
  - device_id: 9d87538209a94c788a5bd7d5b9e939f5
    domain: zha
    platform: device
    subtype: dim_up
    type: remote_button_long_press
  condition: []
  action:
  - device_id: e05fb872b84b4d13b436dfab6f2af53e
    domain: light
    entity_id: light.dining_room_pendel1_level_light_color_on_off
    type: brightness_increase
  - device_id: 40086904a2464b2d9a500266c57d5b4d
    domain: light
    entity_id: light.dining_room_pendel2_level_light_color_on_off
    type: brightness_increase

have you read this in the cook book

1 Like

Try the Controller X app, it provides smooth dimming, sound control and more for lots of ZigBee remote controls such as the Hue Dimmer switch.

3 Likes

This is fairly easy in node-red as well. It took me no more than a few minutes to get something set up that works amazingly well.

1 Like

Hi Andy, I have installed node-red now. Could you share an example of a working flow?

Sure thing! I’m a very recent node-RED convert, so i’m sure there’s a better way to do it, but here’s what i did with my ikea two button remotes:

[{"id":"2410b2f9.0edd2e","type":"server-events","z":"6c1fb8dc.4de6d8","name":"Listen to ZHA events","server":"cca54449.404888","event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":260,"y":1180,"wires":[["741c4704.b10518"]]},{"id":"577fbbca.f34554","type":"switch","z":"6c1fb8dc.4de6d8","name":"","property":"payload.event.command","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"move_with_on_off","vt":"str"},{"t":"eq","v":"move","vt":"str"},{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":710,"y":1060,"wires":[["c2c372ee.965ac"],["4df8908.7fad87"],["d75fe6d0.055878"],["e634914a.6e99f"],["e41a6083.ddf4c"]],"outputLabels":["","","Level Up","Level Down",""]},{"id":"741c4704.b10518","type":"switch","z":"6c1fb8dc.4de6d8","name":"Which remote?","property":"payload.event.device_ieee","propertyType":"msg","rules":[{"t":"eq","v":"14:b4:57:ff:fe:71:d9:a1","vt":"str"},{"t":"eq","v":"14:b4:57:ff:fe:70:ba:ac","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":1180,"wires":[["577fbbca.f34554"],["23f3eb22.ba51c4"]],"outputLabels":["Andy","Inga"]},{"id":"d75fe6d0.055878","type":"looptimer","z":"6c1fb8dc.4de6d8","duration":"0.25","units":"Second","maxloops":"20","maxtimeout":"10","maxtimeoutunits":"Second","name":"DIm up","x":940,"y":1080,"wires":[["da6f3d03.140d9"],[]]},{"id":"da6f3d03.140d9","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Increase the level","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bulb_lamp_andy_level","data":"{\"brightness_step_pct\":\"5\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":1080,"wires":[[]]},{"id":"e634914a.6e99f","type":"looptimer","z":"6c1fb8dc.4de6d8","duration":"0.25","units":"Second","maxloops":"20","maxtimeout":"10","maxtimeoutunits":"Second","name":"DIm down","x":950,"y":1140,"wires":[["554b36d7.cbe698"],[]]},{"id":"554b36d7.cbe698","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Decrease the level","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bulb_lamp_andy_level","data":"{\"brightness_step_pct\":\"-5\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":1140,"wires":[[]]},{"id":"c2c372ee.965ac","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Turn on the light","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bulb_lamp_andy_level","data":"{\"brightness_pct\":\"40\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":960,"wires":[[]]},{"id":"4df8908.7fad87","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Turn off the light","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.bulb_lamp_andy_level","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":1020,"wires":[[]]},{"id":"e41a6083.ddf4c","type":"change","z":"6c1fb8dc.4de6d8","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":1140,"wires":[["d75fe6d0.055878","e634914a.6e99f"]]},{"id":"23f3eb22.ba51c4","type":"switch","z":"6c1fb8dc.4de6d8","name":"","property":"payload.event.command","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"move_with_on_off","vt":"str"},{"t":"eq","v":"move","vt":"str"},{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":710,"y":1320,"wires":[["4a6716a.b1f26e8"],["cd7a6c6e.7d4a6"],["71673640.5a2c78"],["4e84675f.140fc8"],["be61acef.bd48b"]],"outputLabels":["","","Level Up","Level Down",""]},{"id":"71673640.5a2c78","type":"looptimer","z":"6c1fb8dc.4de6d8","duration":"0.25","units":"Second","maxloops":"20","maxtimeout":"10","maxtimeoutunits":"Second","name":"DIm up","x":940,"y":1340,"wires":[["90d26b84.fc6d28"],[]]},{"id":"90d26b84.fc6d28","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Increase the level","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bulb_lamp_inga_level","data":"{\"brightness_step_pct\":\"5\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":1340,"wires":[[]]},{"id":"4e84675f.140fc8","type":"looptimer","z":"6c1fb8dc.4de6d8","duration":"0.25","units":"Second","maxloops":"20","maxtimeout":"10","maxtimeoutunits":"Second","name":"DIm down","x":950,"y":1400,"wires":[["fef90241.5fca4"],[]]},{"id":"fef90241.5fca4","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Decrease the level","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bulb_lamp_inga_level","data":"{\"brightness_step_pct\":\"-5\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":1400,"wires":[[]]},{"id":"4a6716a.b1f26e8","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Turn on the light","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bulb_lamp_inga_level","data":"{\"brightness_pct\":\"40\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":1220,"wires":[[]]},{"id":"cd7a6c6e.7d4a6","type":"api-call-service","z":"6c1fb8dc.4de6d8","name":"Turn off the light","server":"cca54449.404888","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.bulb_lamp_inga_level","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":1280,"wires":[[]]},{"id":"be61acef.bd48b","type":"change","z":"6c1fb8dc.4de6d8","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":1400,"wires":[["71673640.5a2c78","4e84675f.140fc8"]]},{"id":"cca54449.404888","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Basically, I use an event node to listen to all ZHA events. I then use a switch to identify the remote that sent the command (here, both my wife and i have ikea remotes). I used the event viewer in home assistant to find the remote ID and switch off of that.

From there, i use a switch node to identify the button press. Again, using the event viewer in home assistant allowed me to identify the unique event identifier associated with each press (in this case, stored in the msg.payload.event.command field).

For the ikea remote, i have an on and off event that i then mapped to an on and off service call. The fun part comes in when the buttons are held. When the hold up or hold down events come through, i trigger a loop timer node to repeatedly call the dim up or dim down service. In this case, i have configured the node to call the service four times a second, each time dimming the light by 5%.

When the button is released, a stop event is registered and a change node sends a stop command to the loop timer node, telling it to stop calling the dim service. To keep it all from running away in the event the stop command is missed, the loop timer node has a time out built in. I have it set to time out after 10 seconds, or 20 loops.

If you are new to node-RED, everything i just said will sound crazy. Give it a few weeks and it will make much more sense.

2 Likes

Hi Burningstone, I might have to make a separate topic on this, but I went ahead with this solution and this is how far I got:

  1. Installed AppDaemon 4 through Supervisor
  2. Installed HACS in the custom_components folder
  3. Installed Controller X through HACS
  4. Added the following code to /config/appdaemon/apps/apps.yaml
hall_controller:
  module: controllerx
  class: HueDimmerController
  controller: sensor.hall_switch_power
  integration: zha
  light: light.hall_pendel

AppDaemon registers the app, as seen here:

2020-07-20 21:46:18.296280 INFO AppDaemon: Initializing app hall_controller using class HueDimmerController from module controllerx
2020-07-20 21:46:18.313856 INFO hall_controller: :video_game: ControllerX v3.3.0

But when I press the above hue dimmer, the light doesn’t change.
Is there a configuration step that I have missed?
From what I can understand, nothing needs to be added to configuration.yaml, right?

Edit: Got it solved, used the wrong id, when I should have been using device_ieee