-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite the level_onoff_brightness converter
Hopefully the comments should make the reasoning behind the code clearer. This commit fixes two issues: 1. `toggle` without transition after `off` with transition sets brightness to 1; 2. `OnLevel` attribute is not respected by `on` with transition (which instead always restores the light to the previous level). It also adds a new feature: publishing `{"brightness": ..., "state": null}` allows setting brightness without affecting state. * If the light is on and new brightness is 0, it will stay on, but switch to minimum brightness. * If the light is off and new brightness is not 0, the light might ignore the command or remember the brightness for the next time it is turned on. Known remaining issues: * Sending "state": "on"/"off" with brightness or transition to a group may or may not affect the state of devices that don't support brightness. * `OnLevel` is still ignored if the entity is a group.
- Loading branch information
Showing
1 changed file
with
82 additions
and
72 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