adaptive-lighting icon indicating copy to clipboard operation
adaptive-lighting copied to clipboard

Add an option to update hue scenes based on a keywork

Open BenoitAnastay opened this issue 1 year ago • 5 comments

This PR will let you set a keyword to search in your scenes list and update the set brightness and colortemp without changing power state.

It is usefull when you use Hue Bridge and you set your buttons to a scene. It is not working with multiple bridge instance, it will only update the first bridge, this behaviour is easy to fix but I don't have a second bridge make tests

Usage exemple:

  1. Create scenes with names like AL_living room celling light, AL_living room table top light, AL_living room all lights with the lights you want to be turned on.
  2. Add AL_living room as keyword and all living room scenes will be update

Solves #271

BenoitAnastay avatar Jul 01 '24 19:07 BenoitAnastay

@th3w1zard1 Hi, please have a look to this PR, you were interested into this implementation

BenoitAnastay avatar Jul 01 '24 20:07 BenoitAnastay

Well that was quite a rabbit hole of information I had forgotten about.

I am not familiar with the async code you're using. Usually we use hassio's api as migrating to other async implementations have caused bugs in the past. I know next to nothing about that.

other than that your implementation looks good. You are creating yet another attr, ensuring existing functionality will persist, showing a clear understanding of our process.

th3w1zard1 avatar Jul 01 '24 20:07 th3w1zard1

@th3w1zard1 Thanks for the feedback, I'll now try to cleanup my PR, making tests pass.

I don't know how I can properly document this functionality to make it clear for everyone. I might also replace the keyword by a droplist of scenes light for lights entities, the configuration might take longer but it will help casual user to avoid error such as two overlaping keyword

For the main logic I know its robust, I use it since 2022 with another custom_integration (https://github.com/claytonjn/hass-circadian_lighting/pull/195)

BenoitAnastay avatar Jul 01 '24 20:07 BenoitAnastay

Hum there is a bug values aren't updated with daylight, it's probably out of range values of hue bridge, I'll check that

BenoitAnastay avatar Jul 02 '24 14:07 BenoitAnastay

I've added a delays of 5 minutes between same keyword update to avoid overloading the bridge. Maybe i'll need to add a delay between each API call as well

BenoitAnastay avatar Sep 22 '24 22:09 BenoitAnastay