Tradfri v5 - unique_id's and color_temp support on rgb bulbs#13439
Tradfri v5 - unique_id's and color_temp support on rgb bulbs#13439NovapaX wants to merge 35 commits intohome-assistant:devfrom
Conversation
|
Closing this until #11187 is merged. Will rebase and reopen a PR then. |
There was a problem hiding this comment.
Use the device info serial instead of crafting your own: https://github.com/ggravlingen/pytradfri/blob/master/pytradfri/device.py#L111
There was a problem hiding this comment.
Of course I would’ve used that if it actually returned anything other than a blank string.
There was a problem hiding this comment.
Yes. You’d say. Bit it looks like the gateway doesn’t return it, so it’s not a bug in pytradri.
I’ll do some packet sniffing to make sure.
There was a problem hiding this comment.
IIRC the raw data contains a blank string.
There was a problem hiding this comment.
Wasn’t there someone in the community who had contact with a tradfri dev at IKEA?
Maybe we can ask if they can modify the gateway firmware to include it in thier response, and if so at what timeframe.
Else this current unique-is is the best we can get I guess.
There was a problem hiding this comment.
They don't seem to be very receptive to queries as it's not a public API. So we either forego unique I'd until IKEA provide a better solution, or we use this.
There was a problem hiding this comment.
I'm fine with the current implementation. Or do we know if Tradfri is reusing IDs if we unpair/pair a bulb?
There was a problem hiding this comment.
Sorry, just saw the other comments. Disregard
|
Ok. Then I think we should use this. As the benefit of using unique-id and thus being able to use the entity registry is quite large for users. |
|
I’ll do some tests to see under what conditions a bulb will end up with a new id. So we’ll have that clear and can put a note in the docs. |
|
In the following cases a bulb will not get a new id:
In the following cases a bulb will get a new id:
Note: In almost a year of use I have had no reason yet to reset the gateway to factory defaults as it's a pretty stable product. |
|
I like the idea of using the pairing timestamp, that should never become a duplicate |
|
It appears that was a wrong guess and we can't use that. |
16355da to
7e1ec30
Compare
Cannot set_color_temp on color bulb, needs conversion from mired to hsb
7e1ec30 to
c5748dc
Compare
|
Ok, something is getting mixed up here. I am very sorry! |
This PR depends on #11187 getting merged first. (it's currently based on that branch.) Once that is merged I'll change the target-branch to dev.
Description:
unique_ids for lights and light groups:
These are based on the gateway_id and the group/light id. The group/light id's can change when users re-pair their devices, or when users reset their gateway to factory defaults.
This is the best we can currently get on this platform.
Unfortunately tradfri doesn't expose the serial numbers on their API (while they do for thier Homekit integration)
setting color temperature on a color/rgb bulb:
Unfortunately the CWS (color white spectrum) bulbs don't react to setting their color_temperature value. So we need to convert the color_temperature to hs(b) and set that with set_hsb.
This solves a feature regression compared to the previous platform/library version.
Checklist:
tox. *Your PR cannot be merged unless tests pass