ebaauw / homebridge-deconz

Homebridge plugin for deCONZ
Apache License 2.0
135 stars 6 forks source link

IKEA Lights with Adaptive Light acts weird #171

Closed naditz99 closed 9 months ago

naditz99 commented 10 months ago

Today I updated my Raspberry and also switched from Homebridge Hue to Homebridge deConz but the IKEA Lights are acting weird and random by changing the brightness. The Philipps Bloom seems to work fine. I also tried the ph probe since it says "warning: using default xy gamut" but it did not complete the probe for the IKEA lights, it just stops at one color during the "ph probe process", but I don't know if that's even the problem. I think the problem occurs with adaptive light, however I also had the problem with a fixed color set. I am using the conbee 2.

I made a video that shows the changes of the lights without me doing anything. https://streamable.com/bc2h9m

ebaauw commented 10 months ago

Sounds like the IKEA lights come with the firmware bug, but deCONZ doesn’t expose capabilities/transition_block for these. I think deCONZ still exposes these by legacy code, rather than by a proper DDF. That would also explain the colour gamut warning.

ph probe takes like two minutes per colour before it times out; use ph timeout -v to see progress.

Unlike Homebridge Hue, which whitelists lights for workarounds for the firmware bug, Homebridge deCONZ relies on deCONZ properly exposing the light capabilities. You need a DDF in deCONZ to expose these lights properly. Not sure what model lights these are. I have an older IKEA colour light with the firmware bug, but that doesn’t support colour temperature, and a newer IKEA extended colour light that does expose colour temperature, and actually reports it’s gamut, but doesn’t contain the firmware bug. So neither seems to match.

jan666 commented 10 months ago

I noticed weird behavior of my Ikea FLOALT panels with adaptive light turned on. When I change the brightness via Home app it just changes back to the old value. Adjusting brightness via switch works and the brigness is updated correctly in die Home app.

 $ deconz probe -v /lights/2
deconz probe: /lights/2: cool ... done
deconz probe: /lights/2: warm ... done
{
  "manufacturername": "IKEA of Sweden",
  "modelid": "FLOALT panel WS 60x60",
  "type": "Color temperature light",
  "bri": true,
  "ct": {
    "min": 343,
    "max": 317
  }
}
ebaauw commented 10 months ago

Adaptive Lightning adjusts a light’s colour temperature based on the current position of the sun (the amount of daylight) and the brightness. HomeKit (more precise: the Home hub provides a daily table how the amount of daylight changes over time. The accessory (i.c. Homebridge deCONZ) needs to compute and set the colour temperature, based on this table, the time of day, and the current brightness.

So there are three scenarios where colour temperature is updated by Adaptive Lighting:

Most IKEA lights have a firmware bug, that it silently ignores a next command, while the transition of the previous command is still in progress. This means that for those lights, in the third scenario above, either the Move to Level or Move to Color Temperature is ignored. HomeKit and the deCONZ API share a design flaw, that they don’t distinguish between target vs current brightness, hence state/bri and Brightness initially reflect the target brightness, but revert to the current (“previous”) brightness when the light is next polled or next reports its brightness.

The workaround for the firmware bug is simple enough: add "transition_time": 0 when setting state/bri and state/ct. However, as this results in ugly updates of the light state, this must be done only on lights with the firmware bug. Unlike Homebridge Hue, Homebridge deCONZ no longer whitelists lights, and instead relies on deCONZ to report whether the light has the firmware bug. This is done through capabilities/transition_block, which should be defined in the DDF for the light. I’ve done so for the IKEA lights I own, but I only own four models.

jan666 commented 10 months ago

So I guess the FLOALTs have this firmware bug(?). It looks like there is no DDF for FLOALT (there is nothing in the deCONZ repo). Should I open an issue on the dECONZ side to add one?

naditz99 commented 10 months ago

Alright, first of all thanks for your detailed answer.

I have the following Ikea lights: 3x tradfri bulb e14 cws 470lm 1x tradfri bulb e27 ws globe opal 1055lm

I am not familiar with the DDF, do you know a documentation, that could help me? Also does it mean, that my Ikea light can only be used with transition time 0 now, because with home bridge hue it worked totally fine.

I also saw, that it is possible to update the lights OTA, could that help with the firmware bug?

ebaauw commented 10 months ago

See the deCONZ Wiki, in particular the DDF cheat sheet. If you have some technical background, DDFs aren't too complex, once you get the hang of it. Best use one that I made for the IKEA lights I own as starting point:

If this is too complex for you, please open a device request, providing the info from the template, in particular the requested screenshots of node the deCONZ GUI, and the attributes of the Basic, On/Off, Level Control, and Color Control clusters, making sure the attributes have been read. Also, please check whether the light:

And please check the Image Type in the OTAU panel.

naditz99 commented 10 months ago

Perfect, thank you very much for your help. The IKEA lights seem to work fine now, but I still (or now) have a problem with the philipps bloom. Most probably that problem was there before, but I didnt saw it yet. I have a scene with some colorful light. The setting of the scene works but, as i got from the hombridge status page, after a few seconds the saturation of the philipps bloom is set from 100% to 85% and 337° to 344° without me doing anything (which then also "deactivates" the scene in my iphone).

Once again thank you for your support. I can put this problem in a new issue, if you like.

ebaauw commented 10 months ago

Yes, please open a separate issue for those, attaching a debug log file from starting Homebridge, recalling the scene, and the spontaneous changes. Make sure to set logLevel for the Bloom to 2 and run Homebridge in DEBUG mode.

naditz99 commented 10 months ago

Alright, I will, thank you. Also after some testing in addition to two of the color lights from Ikea are simply not changing from adaptive white to color anymore. In the log, it says warning: adaptive lighting: cannot compute Color Temperature , maybe they are stuck in adapting. Do you also want me to make a new issue for this or could this be related to the firmware bug as well?

Once again thank you for your support. I could also change back to homebridge hue. Everything worked fine there, but I think you are trying to move people to hue2 and deconz right? I am learning a lot while troubleshooting, but I also don't want to overextend your patience with me :)

ebaauw commented 10 months ago

Are these Color Light bulbs, or Extended Color Light bulbs? Afaik, the older Color Light bulbs don't support colour temperature, but they hacked something in deCONZ' C++ code to expose state/ct anyways, and translate it to xy values under the hood. I've never been a fan of that, and I'm not sure that behaviour can be replicated using DDFs.

Otherwise: does the problem persist when you turn off adaptive lighting and turn it on again? And after restarting Homebridge.

naditz99 commented 10 months ago

I am not quite shure where to check that, but everything I can find says color and white temperature. I bought them all together and one of the is working fine. It is also not always possible to reproduce the behavior. The only time it happens is when i go from all white adaptive to the relax scene which sets them to 3 individual colors (purple blue and violett). When I try to reactivate the scene, it does nothing. When I set all 3 lights to one color (not adaptive) and after that back to my scene, it works. Still, I don't think it's an apple home kit related problem because of the warning in the log of exactly these two lights.

ebaauw commented 10 months ago

Are these the IKEA TRAFDRI bulb E14 CWS 470lm from #172? They do support colour temperature alright, but deCONZ doesn't expose the gamut.

By the looks of it, they might be very similar to the TRADFRI bulb E27 CWS 806lm from tradfri_bulb_e27_cws_opal_806lm.json, except that the E27 bulb doesn't have the firmware bug. Both report the same firmware version, 1.0.021. Does the E14 also use Image Version 0x2802? Did you actually test for the firmware bug (by sending a Move to Level with a long Transition Time (e.g. 3000 for 5 minutes) and then sending a Move to Color Temperature or the other round)? Did you buy them separately, or were they bundled with the Remote Control N2 (like the E27 was)?

It is also not always possible to reproduce the behavior.

That smells like interference issues. Did you check the deCONZ log for Zigbee errors?

the warning in the log of exactly these two lights

The warning: adaptive lighting: cannot compute Color Temperature? Please disable and re-enable adaptive lighting. If that doesn't solve it, please restart Homebridge deCONZ. If that still doesn't solve it, un-expose and re-expose a light and re-enable adaptive lighting. If you still get the warning, please capture a debug log file, from startup to enabling adaptive lighting to turning the light on and changing the brightness (which should trigger the warning).

naditz99 commented 10 months ago

Ok I think I found out something interesting. So I have a few scenes where I turn off some of the lights. But by turning the light off with a scene, I also have to select a color (as part of the setting of the light in the scene, although it's basically "turn off"). So now what's seems to happen is, when I turn on my color scene (e.g. after a fresh restart), it works fine. Then I select a scene which turns off some or all of the lights, it changes to adaptive white and off at the same time. You can actually see the lights turning to white in the moment they turn off. Now when I try to select my color scene again, it sometimes just turns on the light without sending the new color, so they stay white. I don't know why it only happens sometimes, but it can happen with all three lights (not just the two) because I could randomly reproduce it with the third light as well. I added a log where exactly this happens. It changes the color for the bloom, but not for the other 3 lamps. My feeling is, that is has to do with some kind of timing and the lights didn't get the color setting command for some reason but apple/homebridge/whatever thinks it has sent it and therefore does not send it again. When the lights are "stuck" in white I can still select just a random color and after that the scene works again, because in this case it definitely sends the now new color. I will try to modify the scene to turn the lights off and select a normal color, not adaptive.

Anyway, when setting the scene, regardless wether it works, it says "failed" after setting the scene in the home app. Something I also had with homebridge-hue, but I didn't care, because ist always worked. Maybe that is also interesting for troubleshooting now.

Are these the IKEA TRAFDRI bulb E14 CWS 470lm from https://github.com/ebaauw/homebridge-deconz/issues/172? They do support colour temperature alright, but deCONZ doesn't expose the gamut.

Yes the are the lights from #172

Did you actually test for the firmware bug

I didn’t try that. Do I have to manually try that via the console or in the phoscon gui? I bought them without any other accessories but I bought all three at the same time from the same shelf, so I guess if one has a bug most probably all of them have the bug.

restart Homebridge deCONZ

Restart seemed to solve it. I didn't get the warning again.

homebridge.log.txt