Hi, I want to turn on my dimmer with a button click. On and of works by using:
Button 1: - light.turn_off: dimmer
Button 2: - light.turn_on: dimmer
But now when I have my dimmer set a 4-8% and turning it off it will not start a few hours later.
I have now:
Button 2:
- light.turn_on:
id: dimmer
brightness: 10%
This always starts the dimmer correctly (never lower than 10%).
But then obviously It always starts a 10%.
I would want to start at the last know brightness unless it was lower than 10% (if lower than 10% then start at 10…). Like the turn_on and off did…
Could use some help in thinking this out the right way.
I think it’s dimmer’s fault. Many dimmers can go as low as 4% or even lower, but only from higher value, while they won’t start until you reach 10% or so when going from 0% - triac inside just can’t start to conduct at such low values. Same effect was back then when i used button-designed wall dimmers: i’ve always had to turn a bit higher for light to start and then revert to lower value.
Only solution in this case is to start dimmer higher and then immediately go lower, say one “if” sentence:
Here’s what I came up with to implement the bump start for brightness less than 10%
#when light is turned on and brightness less than 10%
#bump brightness to 10% and then back to current
on_turn_on:
then:
- lambda: |-
float b = id(dimmer).remote_values.get_brightness();
if (b < 0.10) {
id(dimmer).remote_values.set_brightness(0.10);
id(dimmer).remote_values.set_brightness(b);
}
This should execute only when the light is turned from off to on. If the brightness was less than 10%, set the brightness to 10% and then back to original value. The remote_values.get_brightness() and remote_values.set_brightness() aren’t documented functions. I tested on a monochromatic light and the logic worked and brightness was updated. Might need to add a delay to give the 10% brightness time to propagate to the light.