Closed taby1 closed 2 years ago
I don’t understand the need for this PR. Homebridge Hue sets this.config.ct
based on the presence of state.ct
. If you delete and re-add the light in deCONZ to get the missing state.ct
, Homebridge Hue picks this up on the next restart. If state.ct
is missing, setting this.config.ct
will only cause errors.
Well I'm not really sure what to say; I tried removing and re-adding the bulbs in question in Deconz, with no success. Everything was up to date. This fix works, and causes the color temperature functionality of the bulb correctly.
Did you restart Homebridge without this “fix” after re-adding the light to deCONZ? Please attach the debug dump file and capture and attach a debug log file of Homebridge starting.
Yes I had. Here's those logs:
Here they are: homebridge.log.txt homebridge-hue.json.txt
deCONZ doesn't expose state.ct
, but reports colormode
as ct
?! There's definitely something fishy going on there. This a ZHA Color Dimmable Light; these usually have issues with colour temperature. deCONZ whitelists most of them, to expose them correctly.
"13": {
"etag": "656da2be2494dc800571beaaaba29c60",
"hascolor": true,
"lastannounced": null,
"lastseen": "2022-01-09T15:07Z",
"manufacturername": "sengled",
"modelid": "E12-N1E",
"name": "Color dimmable light 13",
"state": {
"alert": "none",
"bri": 74,
"colormode": "ct",
"effect": "none",
"hue": 0,
"on": false,
"reachable": true,
"sat": 0,
"xy": [
0.3227,
0.329
]
},
"swversion": "0x00000015",
"type": "Color dimmable light",
"uniqueid": "b0:ce:18:14:03:52:bb:5d-01"
},
Typically, the deCONZ API will return an error, when trying to set state.ct
on a light which doesn't expose that. What does the log show when you change the color temperature from HomeKit?
Sure, here's me playing around with it a bit. homebridge.log (2).txt
Yeah if they have to be whitelisted in Deconz that could be the issue; I don't think they explicitly support this model (though they do have official support for a couple of other devices from Sengled).
Indeed, deCONZ accepts the state change with ct
and even seems to send the corresponding command to the light, but it doesn’t report back the actual ct
value.
This definitely is a bug in deCONZ, albeit with a lucky effect. I even fixed that at some time, long ago, but the fix wasn’t accepted, exactly for cases where (at that time) other API clients were bluntly updating ct
without checking whether is was exposed.
Note the light does not update xy
when it changes colour temperature (except for Hue lights, hardly any light does), so Homebridge Hue has no clue what the actual colour temperature of the light is. In particular, when changing ct
through another app, the state won’t be reflected in HomeKit. This really needs to be fixed in deCONZ. Please open an issue there.
I’m happy this fix works for you, but sorry, I’m not accepting a PR with half a workaround for something that should be fixed in deCONZ.
Btw, I still don’t understand why it only works after removing and re-adding the light to deCONZ. Or did they change something in deCONZ for this light?
I suspect the reason I had to re-add the light in Deconz for the change to take effect is because that forcred the light to be re-added in homebridge, which is the only time (I understand) that the modified section of code runs
E12-N1E bulb by Sengled previously failed to enumerate color temperature attribute even though the bulb is ct capable. This fix allows the bulb's color temperature to be correctly controlled (although existing bulbs must be removed and re-added in Deconz).