NiklasReiche / ad-spotify-mood-lights-sync

AppDaemon app that synchronizes rgb lights to the mood of the currently playing spotify song in Home Assistant.
MIT License
35 stars 5 forks source link

Adjust floor for saturation and brightness possible? #9

Closed rostar99 closed 7 months ago

rostar99 commented 1 year ago

I have several bulbs that vary in saturation and brightness when in color mode (values are too low). As a workaround, I have an automation that takes the hs_color that the app outputs and adds to these values, and turns on the light again with the new settings. Obviously, there is a noticeable transition to the final color. Could this be accomplished with color profiles by setting a minimum for saturation and brightness with the hue left as is? If not, could I set a floor for these values in the app itself (py code)?

NiklasReiche commented 1 year ago

No, something like this is currently not really possible. While you could change the color profile's sample points, I doubt you would reliably achieve the desired effect. The problem is that all interpolation calculations are done in RGB space, which doesn't translate well to the HSV parameters for the lights.

I'm not really satisfied with the current interpolation model myself and I think it would be a good idea to switch to an HSV space interpolation instead. Then the color profile would be defined by HSV sample points and there should be no unexpected variation in saturation and brightness for interpolated values. I'll look into implementing this HSV mode and compare the results (#10).

NiklasReiche commented 7 months ago

It's been a while but I've finally come around to finishing the interpolation issue. @rostar99, in case you're still using this app, you could try out the new saturated color profile, where the saturation is maximized. The default color profile also has more saturated colors overall, so maybe this is already enough for your usecase. As for the brightness, the RGB color components should now always be output with maximal apparent brightness. Since brightness is a separate attribute for light entities, the app does not touch it, so you can set the lights' brightness separately and individually.

While I haven't added an explicit adjustable floor for saturation, it wouldn't take much effort given the new changes. So if this feature is still relevant for you even with the new color profiles, feel free to say so.

rostar99 commented 6 months ago

NiklasReiche, I just noticed the change in the configuration file when I was reinstalling after appdaemon update changed the config folder. The new change works well enough to turn off the automation workaround I wrote last year. Thank you.