Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mqtt light brightness slider (#17075)
* Enable brightness slider for RGB If we are using RGB with no brightness topic, the brighness slider should still be visible, as we can scale the RGB amount to give us the brightness. * Output RGB scaled by brightness If we are outputting to an RGB device, but do not have a dedicated brightness topic set, when the brightness slider is changed, we should output the current colour's HS, with the V coming from the brightness slider. * Brightness from RGB when we're not using a brightness topic When we aren't using a brightness topic, set the brightness slider based on the received value from an RGB -> HSV conversion. * Test for new brightness state scaled by RGB This adds a test to make sure the brightness stored in the state is being computed correctly from the RGB value when a dedicated brightness topic is not set. * Changes from review Fixes formatting of supported features flags, and checks HS colour hasn't been set when operating in RGB-only mode * Set optimistic brightness correctly in rgb mode When we're using rgb mode to set the brightness, we want to set optimistic brightness if: we are running in optimistic mode OR the brightness state topic isn't set and we have a brightness command topic OR the rgb state topic isn't set and we don't have a brightness command topic * Add test for turn_on in RGB brightness mode
- Loading branch information
Showing
2 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters