Hue Dimmer automations are slow and miss repeated button presses

Background

I live in a studio apartment, and I want to keep the brightness of all of my light groups (kitchen, living room, bedroom) the same. I therefore store the brightness state in a single variable, input_number.master_brightness, and propagate changes in this variable to the brightness state of all lights that are on. (I also have each light fetch the master_brightness state when it turns on. That automation is working as expected.)

The two automations at issue:

- id: '3'
  alias: Send Master Brightness to Lights
  initial_state: true
  trigger:
  - platform: state
    entity_id: input_number.master_brightness
  action:
  - service: light.turn_on
    data_template:
      entity_id: >
        {%- for light in states.light -%} 
        {%- if not light.entity_id =="light.home" and not light.entity_id =="light.living_space" -%} 
        {%- if light.state == "on" -%} 
        {%- if not loop.first %},{%- endif %} 
        {{ light.entity_id }}
        {%- endif -%} {%- endif -%} {%- endfor -%}
      brightness_pct: '{{ states.input_number.master_brightness.state|int }}'

- id: '5'
  alias: Dimmer Switch Brightness Up
  description: ''
  trigger:
  - device_id: 51b4c8c8104141449a7e9f27bdfe0c70
    domain: hue
    platform: device
    subtype: dim_up
    type: remote_button_short_release
  condition: []
  action:
  - data: {}
    entity_id: input_number.master_brightness
    service: input_number.increment

(I also have an automation similar to Dimmer Switch Brightness Up that decreases the brightness.)

Problem

The problem is that when I press the dimmer switch, it takes several seconds for master_brightness to increment, and another second for this to propagate to the lights. Taken alone, this delay would be bad but not intolerable. But for the ~5 seconds during which this script is running, additional switch presses do nothing. So if, for instance, I am at 40% brightness and want 100% brightness, I can’t just click the switch three times and wait for the automation to finish executing. I have to click, wait five seconds, click again, wait five seconds, and click again.

I’ve Tried

I have tried setting the brightness of lights directly by moving the light.turn_on code into the Dimmer automation. It did not meaningfully improve the latency and did not improve the input issue at all.

Other Details

In case it matters, I am using Hue switches and Hue lights. I’m on Home Assistant 4.09, running on a Raspberry Pi 4 64-bit.

Would you be willing to use Node-red?

I have a similar automation where I use a hue dimmer for various controls ( about 15 actions on the controller) I don’t mind sharing it with you.
I don’t experience any unintended delay with it

The Hue integration is local polling and polls the bridge every 5 seconds. Because of this, home assistant won’t know about dimmer switch button press events and motion sensor events for up to 5 seconds after they actually happen. There is a custom component that allows you to change the polling interval, but I can’t seem to find it at the moment unfortunately

I would. Does that somehow bypass the polling limitation @Tediore mentioned?

I, (un)fortunately, use a Zigbee stick (Gocontrol Zigbee/Zwave usb stick) with my Zigbee things (Hue Dimmer included). So I cannot attest for that latency, I had understood that it was caused by the automation, not the hue bridge.

It would not unfortunately. The latency comes from the integration’s polling interval.

1 Like

Thanks for the help, folks. I would really prefer to manage all aspects of my home automation, including dimmer switches, through HA, but I’ve decided I don’t really need to at the moment. I will just use HA, and specifically Circadian Lighting, to control color temperature and will handle brightness and on/off mostly through Hue.

have a look at eventsensor https://github.com/azogue/eventsensor which was created for this, and an added CC for upping the polling frequency (at your own risk): Fasthue

3 Likes

Fasthue! Thank you, I couldn’t find that custom component for my life for some reason

I’m giving the Zigbee solution some thought. Why (un)fortunately?

Because I cannot help you with your problem as I do not use the same component to control the dimmer.

Do you mind sharing your Node Red please?

I’d be happy to!

But be aware that it is a big one. Due to the per room detection and multi-press function on the dimmer.
( up to 5 presses per button and conditional actions depending on entity states, for a total of
30 different actions on the dimmer )

Feel free to ask me any questions regarding the flow!

Ps: Here is a screenshot before you commit to it haha: https://i.imgur.com/kuqWr8q.png

Thank you so much!

Hi @Maxi1134, what an incredible complicated (looking) piece of art! That workflow… How do you even construct something like this and debug it in case it’s not behaving as expected? Kudos!

You do it section by section! And with lots of debug nodes to debug haha