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.