HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
49 stars 9 forks source link

Feature request: separate backlight level setting for awake and idle #37

Closed nagyrobi closed 3 years ago

nagyrobi commented 3 years ago

Backlight level currently only has one slider, which acts on the awake level. A bit confusing though that the slider position goes down to the value of idle brightness, when the plate is idle - the slider is showing the actual brightness value, whilst it's setting the awake brightness level.

As we had earlier in the component config, we could offer a way to configure default levels:

To impose some practical constraints for accidental or unwanted settings (one may drag the slider to 0 and then misunderstand why the screen turned off completely; max limit would help the owner to save for long-term burn-in or power consumption).

This would require two separate sliders, either by implementing two virtual lights, or alternatively by re-using some other property of light component like white_value (maybe not a good idea as it may conflict with other stuff in HA).

nagyrobi commented 3 years ago

The min and the max levels could be simply set in brightness = ranged_value_to_percentage((0, 255), self._brightness) instead of 0 and 255.

Thus the slider would work only between min and max not 0 and 255.

fvanroie commented 3 years ago

I'm ok with changing the dim values from 0-100 to 0-255 too. This is more in line with other gpio led levels.

dgomes commented 3 years ago

the awake brightness was a concept from the initial version...

currently its a "previous brightness" meaning the value to which brightness will be restored when the plate awaken.

I don't think setting the awake brightness provides a good UX, depending on the time of the day I would like to have a different level...

dgomes commented 3 years ago

to avoid turning off (dim 0) I think I will limit the brightness to 1 (it is done in other light integrations)

fvanroie commented 3 years ago

Maybe the firmware needs to interpret dim=0 as light=off to avoid confusion? That way, dim can never go completely to 0.

nagyrobi commented 3 years ago

No I think we should leave firware handle 0 as zero, as most lamps do it like this.

dgomes commented 3 years ago

I'm confused... how do we proceed @fvanroie ?

fvanroie commented 3 years ago

Make the firmware 0-255 and limit CC to 1-255 dim level. I think that covers all possibilities.

dgomes commented 3 years ago

OK! When you push that change, please reference this issue, so I can implement the change :)

dgomes commented 3 years ago

I think we can close this now https://github.com/HASwitchPlate/openHASP-custom-component/commit/2d9fb24333f31b26946d0b4f55b6374763fcf76a