-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow LIFX bulbs to fade color even when off #46596
Conversation
LIFX bulbs have the capability to fade their color attributes even while the bulb is off. When the bulb is later turned on, the fade will continue as if the bulb was on all along. It would be nice to have this ability in home assistant automations. I'm not sure if the way I've done it is best. You could pull the `if hsbk` section out of the two branches of the conditional since it's the same in both now. I didn't know if the ordering of the commands mattered, though.
if hsbk: | ||
await self.set_color(ack, hsbk, kwargs) | ||
await self.set_color(ack, hsbk, kwargs, duration=fade) | ||
if power_on: | ||
await self.set_power(ack, True, duration=fade) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if power_on
is True
? It is supposed to fade from black to the new color but I guess with this change it will start from whatever the color was before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amelchio I just tested it, and the bulb can fade color while it is fading power, and that is what happens.
We could switch it to check for hsbk and power_on
and then use the old behavior then. That seems reasonable.
Alternatively, a user could emulate the old behavior by first changing the color without transition and then turning on the bulb with transition.
I think either way is fine.
@amelchio I pushed a version that sets the color immediately when also fading the light on. I think that's the most intuitive behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good 😃. Thanks!
Proposed change
LIFX bulbs have the capability to fade their color attributes even while the bulb is off. When the bulb is later turned on, the fade will continue as if the bulb was on all along. It would be nice to have this ability in home assistant automations.
Type of change
Additional information
I'm not sure if the way I've done it is best. You could pull the
if hsbk
section out of the two branches of the conditional since it's the same in both now. I didn't know if the ordering of the commands mattered, though.Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: