I have flashed a Tuya LED light bulb with ESPHome. Using original Tuya FW I can dim down to 1% without any problem but with ESPHome and the light/output/sm2135 components I can only dim to 20% until it turns of.
With gamma_correct at 1 it works like the original FW but 2.8 is default so I guess there’s a good reason for that
Any suggestions what I need to do to be able to dim the whole span from 0 to 1.
I have tried it but it doesn’t work as I expected (or more precise as I would like to work). If I set min_power to e.g. 0.2 it will never go beyond 20%, i.e. not even turn of.
Yes I can also add the zero_means_zero: true so that it will turn of when I decrease to 0%.
But having this configuration, dimming works as expected between 20 and 100% but between 1% and 20% the dimming effect will be stuck at it’s min value, i.e. a none linear behavior.
So what I’m looking for is a config that keeps the adjustment linear from the light component (0-100%) from the min level I define and the formula 0.2+x*0.8 will do that but I can’t see how I would be able to implement that
I think that I’m in a similar boat: LED strips, controlled via MOSFETs, that go completely dark at 5% or lower. Setting min_power to 0.05 got me… something much brighter than I wanted.
On a hunch, I divided min_power by 10. Hmm. Better, maybe, but still way too bright.
OK. Divide by 100? Bingo. Setting min_power to 0.0005 leads to a value of 1% in the UI producing an eminently reasonable minimum brightness. (100% still gets me maximum brightness. Yay!)
Searching the ESPHome source code on GitHub for min_power sheds, uh, some light on things. In particular, note how both max_power and min_power are multiplied by 100.0. The behavior looks to be deliberate, even though it’s not immediately obvious to me why the two extra orders of magnitude are used. But hey, I’m now getting the behavior I want, so I’m happy.
I’d be curious to know if this works for you, too.
Actually, on closer (read: slightly more awake) inspection, the code I pointed to seems to be specific to logging. In any case, expressing min_power as a percentage of a percentage solves, for me at least, the problem we were both having.
This way I get a linear adjustment the whole range as below with a minimum of 10%.
Yes… It’s the 1% value (not 0%) that shall match the min value of 10% since the dimmer only goes from 1% to 100%
But it would be better if the light component could have this built-in as I guess this is something that everyone would like to do.
And… The light component generates a none linear value so doing this with y=kx+m is probably not the best way but… I’t works quite good for now until some smart person implements min and max in the light component
Yes… Since some smart person have done the calibration between pwm value and lumens (or whatever), I could also see that 1% represents 0.0004 (0.04%), and 50% represents 0.14 (14%).
So it’s not as easy as checking at what value the led starts to light and then taking that value as the min value for the output component. Bin there, done that…