I am using a bunch of GE Z-Wave Plus dimmers like I have seen so many others use on here but I am having a problem configuring the UI properly for some reason. Right now I have a switch in the UI to turn the light on or off. I also have an input_number that I can use to set the brightness of the light and that runs on a scale of 0-100% instead of the normal 0-255. This all works great but if you physically use the dimmer, the input_number in the UI isn’t updated. I created an automation to do this but later realized that if you just click the dimmer to turn it off, it dims instead of just going out. This causes my input number to update -10% from what it was, then the input number change updates the state of the light and stops it from turning off. You have to click down on the switch until brightness=0% then it shuts off, or click and hold so it dims off. How has everyone handled updating the slider state with their dimmers?
My code:
input_number.yaml
main_light_slider:
min: 0
max:100
step: 5
sensors.yaml
- platform: template
sensors:
main_light_level:
value_template: '{{ states.light.main_lights_17.attributes.brightness | int / 2.55 }}'
unit_of_measurement: '%'
fr_automations.yaml
- alias: 'Adjust lights on input'
hide_entity: True
trigger:
- platform: state
entity_id: input_number.main_light_slider
action:
- service: light.turn_on
data_template:
entity_id: light.main_lights_17
brightness_pct: '{{ trigger.to_state.state }}'
- alias: 'Update light slider status'
trigger:
- platform: state
entity_id: light.main_lights_17
action:
- service: input_number.set_value
data_template:
entity_id: input_number.main_light_slider
value: '{{ states.sensor.main_light_level.state }}'
I know exactly why manually clicking the switch isn’t working, I am just not able to wrap my head around how to make this work when the switch dims as it turns off. Basically when you turn it on it just resumes the previous brightness, thats great. If I turn it off it dims to off instead of turning off. This causes it to report continually changing brightness numbers until the lights are actually off which triggers my update automation, which then triggers my “input_number has changed vale, let the light know!” automation which halts the dim to off process. Thanks!