I have a LZW31-SN Dimmer - Red Series (Gen 2) switch. It is controlling 2 smart lights. I am looking to improve the dimming experience with this switch. Right now I can dim with scenes. That’s easy enough. What I would like to do now is to dim the smart lights by holding the button down then stop dimming after the button is released. Maybe with some kind of loop? I don’t know, I have been banging my head against a wall trying to figure out the code to do it. I am hoping someone here can point me in the right direction. Thanks in advance!
Are they zwave smart lights? If so, you can set up association groups 3 and 4 for a much better dimming experience
Unfortunately, they are not zwave. They are Philips Hue.
What I do is set up an automation:
IF
Level changes at dimmer
THEN
Dim lights to same level.
Works great!
Caviat: It does NOT dim them during the dim cycle. In order to do that you would have to get the hue dim rate to match the switch dim rate, start with the “held” scene and stop with the “released” scene.
Kreene1987. Thanks. Any chance you could supply an automations.yaml example for this? I understand what you are saying I am just having a hard time applying it.
You could do something like this:
alias: Office Brightness
description: Set brightness on Smart bulbs when Switch is updated
trigger:
- platform: state
entity_id: light.office_light
condition: []
action:
- service: light.turn_on
target:
entity_id:
- light.office_rgb1
- light.office_rgb2
data:
brightness: >-
{% if state_attr('light.office_light', 'brightness')
%}{{state_attr('light.office_light', 'brightness') }}{% else %}0{% endif
%}
mode: single
alias: LZW31-SN Dimmer Match
description: ''
mode: single
trigger:
- platform: numeric_state
entity_id: light.living_room_hallway_dimmer_current_value
attribute: brightness
action:
- service: light.turn_on
target:
entity_id: light.downstairs_hallway_lights
data:
brightness: >-
{% if state_attr('light.living_room_hallway_dimmer_current_value', 'brightness')
%}{{state_attr('light.living_room_hallway_dimmer_current_value', 'brightness') }}{% else %}0{% endif
%}
Trigger on numeric state of the brightness attribute of the dimmer entity changing, then match the lights to that same level.
Lol beat me to it but we came up with the same thing lol.
I believe the numeric_state
platform requires you to specify a threshold to trigger off of (either an above
or below
value). If that is the case, it might be better to just trigger using the state
platform.
Would state trigger though if it remains on? I’m thinking dimming and raising brightness wouldn’t trigger a state change so the automation wouldn’t fire.
Above 0 and below 101 lol?
Yep, state will still trigger even though it is still on.
Fires when the state of any of given entities changes. If only
entity_id
is given, the trigger will fire for all state changes, even if only state attributes change. (source)
Awesome, had no idea. Today I learned…
Based on that yes I would trigger on state
.
That did the trick! Thank you so much @kreene1987 & @jtronicus. Your help was greatly appreciated. Here was the solution!
alias: Mirror3
description: ''
trigger:
- platform: state
entity_id: light.node_7
condition: []
action:
- service: light.turn_on
target:
entity_id:
- light.living_room_sconce_1
- light.living_room_sconce_2
data:
brightness: >-
{% if state_attr('light.node_7', 'brightness')
%}{{state_attr('light.node_7', 'brightness') }}{% else %}0{% endif
%}
mode: single
@mit3gt check this out: Yet another dimmer/scene switch blueprint - Blueprints Exchange - Home Assistant Community
My switch is in Smart Bulb mode, controlling a Home Assistant light group (not a zigbee light group) of 4x Osram/Sylvania Lightify BR30’s that are controlled locally from Home Assistant to the Osram / Sylvania Lightify hub.
This is what my automation looks like, utilizing the above blueprint:
alias: TEST-03_Z-WaveJS dimmer switch
description: ''
use_blueprint:
path: moshess/zwavejs-dimmer-switch.yaml
input:
zwavejs_device_id: f21267e7e3b0c823109d935ce513a1f9
key_up:
- service: light.turn_on
target:
entity_id: light.office_lights
data:
transition: 1
key_down:
- service: light.turn_off
data:
transition: 1
target:
entity_id: light.office_lights
key_up_held:
- service: light.turn_on
target:
entity_id: light.office_lights
data:
brightness_step_pct: 2
is_loop_for_key_up_held: true
key_down_held:
- service: light.turn_on
target:
entity_id: light.office_lights
data:
brightness_step_pct: -2
is_loop_for_key_down_held: true
Works surprisingly well. If I turn them off, single click to turn back on resumes last brightness. The blueprint is very flexible and allows you to do similar things for scene (?) multi-taps. I’ll likely try adding lighting colors to that.
But doesn’t disabling the local relay also disable the ability to set a brightness level at the switch?
The latest beta firmware addresses that. With the beta firmware, you would leave the relay enables and turn on smart bulb mode. Smart bulb mode forces the load to always output 100% regardless of the brightness (it basically simulates a dimmer but always outputs 100%).
Yeah. With the latest beta firmware these switches are nearly perfect for use with smart lights. With that said, @jtronicus I am in the google home ecosystem. Whenever I dim my smart bulbs using the google home interface the led level does not reflect the latest dim state. To remedy this I took your original solution and kind of reversed it so the switch would update on a smart light action. Works pretty well with a slight delay. I am mostly happy with it. Seems to go haywire every now and then for reasons I can’t explain. Maybe someone can share a better approach to this? I am not using groups or light groups. Maybe I should? Here is my current config for keeping the switch led in sync on a google home trigger:
alias: Living Room Sync Notification with smart light 1
description: ''
trigger:
- platform: state
entity_id: light.living_room_sconce_smart_light
condition: []
action:
- service: light.turn_on
target:
entity_id: light.inovelli_switch
data:
brightness: '{% if state_attr(''light.living_room_sconce_smart_light'', ''brightness'') %}{{state_attr(''light.living_room_sconce_smart_light'',
''brightness'') }}{% else %}0{%
endif %}'
mode: single
Ahh, sweet! I’ll need to upgrade! Thanks!
you might be able to do something like this:
alias: Office Brightness
description: Set brightness on Smart bulbs when Switch is updated
trigger:
- platform: state
entity_id: light.office_light,light.office_rgb1,light.office_rgb2
condition: []
action:
- service: light.turn_on
target:
entity_id:
- light.office_rgb1
- light.office_rgb2
- light.office_light
data:
brightness: >-
{% if trigger.to_state.attributes.brightness is defined %}
{{trigger.to_state.attributes.brightness }}{% else %}0{% endif %}
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 250
mode: single
I havent done a lot of testing with it, but whenever any of 3 devices (2 smart bulbs and 1 dimmer switch) is updated, it will update all 3 devices to the same brightness. A 250ms delay is added at the end to help prevent the automation from firing multiple times. It seems to work so far.