I have two GE Z-Wave Plus dimmers in the kitchen that when both are on I’d like for them to be in sync for brightness levels. I actually have that working. The gotcha comes when I attempt to turn one of them off. If I tap the dimmer it starts to dim a bit and then appears to jump back up to the level of the other device. When I look into the database at the historical values detected I can see that the dimmers are now at a imperceptibly lower brightness value. For example, if they’re both on brightness 64, tap one dimmer, I’ll see that they are both now on brightness 60.
I suspect what’s happening is that I’ll have one start to turn off it starts dimming slowly, which then updates HASS with a lower value, who then sets opposite dimmer to that new new value, which then updates HASS with the lower value, and then bounces the new value back to the original dimmer.
To walk you through the code here, you’ll see that I’m passing the values through as sensors. This is a workaround as I want any change to the state to make the automation update. numeric_state only works as you pass a threshold whereas if you bundle the brightness attribute’s value in a sensor as a state, you can then then trigger off of any kind of state change. The rest is pretty straightforward.
At some point I tried an outlier filter, but that just put out a really low value and dropped the opposite dimmer to below the threshold of “on” for the LEDs in the can lights.
- platform: template
sensors:
stove_dimmer_brightness:
value_template: '{{ states.light.stove_dimmer_level.attributes.brightness | int | default(0) }}'
entity_id: light.stove_dimmer_level
- platform: template
sensors:
butlers_pantry_brightness:
value_template: '{{ states.light.level_2.attributes.brightness | int | default(0) }}'
entity_id: light.level_2
- alias: Kitchen Can Brightness Sync A
trigger:
platform: state
entity_id: sensor.stove_dimmer_brightness
condition:
condition: and
conditions:
- condition: state
entity_id: light.stove_dimmer_level
state: 'on'
- condition: state
entity_id: light.level_2
state: 'on'
action:
service: light.turn_on
entity_id: light.level_2
data_template:
brightness: '{{ states.sensor.stove_dimmer_brightness.state | int }}'
- alias: Kitchen Can Brightness Sync B
trigger:
platform: state
entity_id: sensor.butlers_pantry_brightness
condition:
condition: and
conditions:
- condition: state
entity_id: light.stove_dimmer_level
state: 'on'
- condition: state
entity_id: light.level_2
state: 'on'
action:
service: light.turn_on
entity_id: light.stove_dimmer_level
data_template:
brightness: '{{ states.sensor.butlers_pantry_brightness.state | int }}'