Repository navigation
Conversation
This type had some issues with real hardware (esp. Philips Hue devices.) The state machine was simplified and the `OverridableDevice` type added a setting "envelope" where we reassert the setting if polling shows a different value than the setting in the envelope time. Drivers that use `OverridableDevice` now take an optional envelope config parameter. Unit tests were added to further test that the new state machine works. This rewrite was done with AI assistance.
This simplifies the method signatures. However, we do lose the constraint that the returned `Future<>` needs to be `Send`. We'll see if this becomes an issue.
Not all manufacturers add an LED indicator to their products. For two of the drivers I wrote, I was stubbing out the indicator devices. Rather than force all drivers to have a possibly nonfunctional indicator device, we'll let the few drivers that do have it include it in their implementation.
Having the brightness and color be separate devices made it more
difficult to use the logic block because it required two expressions to
control a combined, desired result. The settings aren't atomic.
By rolling the brightness into the color, we have one device to provide
the same output as two. And the logic blocks can control both by using
`WITH_BRIGHTNESS()`:
```
WITH_BRIGHTNESS(color_expr, brightness_expr) -> {bulb}
```
- add `debug!` messages - remove optional envelope -- an overridable device always needs to verify the setting - remove test for empty envelope
The Hue driver mostly worked with the new `OverridableDevice` changes. However when trying to control color bulbs, it would send settings rapidly because they didn't compare.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OverridableDevicewas refactored. It now uses a simpler state machine and more unit tests were added to verify the behavior.Switchnow haserrorandstatedevicesDimmernow haserrorandbrightnessdevicesColorBulbnow haserrorandcolordevices (where thecolordevice can be RGBA or color temperature