Skip to content
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

[homekit] OH3 homekit Colortemperature and hue issues #9799

Closed
pug304 opened this issue Jan 12, 2021 · 20 comments · Fixed by #11717
Closed

[homekit] OH3 homekit Colortemperature and hue issues #9799

pug304 opened this issue Jan 12, 2021 · 20 comments · Fixed by #11717
Assignees
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@pug304
Copy link

pug304 commented Jan 12, 2021

on a oh3.1 snapshot Build #2135 i've installed two lamps: xiaomi mi desk lamp 1s and one Philips Hue. Both of them are able to adjust colortemperature and brightness, the hue is able to change color/hue additional. Both lamps are working well via OH Pages (switch on/brightness,/temperature/hue).

When integrating in Homekit all is working fine with setting metadata to tags lighting, lighting.OnState and lighting.brightness. Once you add tags lighting.colortemperature or lighting.hue, checking status in Homekit status of icons hang at refresh (Aktualisieren on german), if you press buttons of the items Homekit app close immediate. Restart of homekit app will close the app immediate again. Remove the mentioned tags everything works like before.

Addons are standard (Xiaomi mi and Hue) coming with OH3. Things/Items/Model are defined via UI.

log with log:set TRACE io.github.hapjava/log:tail io.github.hapjava gives tons of log info, it seems communication is working. I've snip the log and have save it into a local file. If it ie helpful i will share.

Not an important bug due to Homekit is more or less a toy ;)

edit: metatag coltemp didn't work before with other snapshot versions. i didn't take care about this, with the second lamp and the same issue occured i think it is reasonable now to have a look at it

@yfre
Copy link
Contributor

yfre commented Jan 12, 2021

@pug304 can you share the configuration of the metadata (how it looks like when you add tags) ? logs could be also interesting.

2 things i could think of:

  • home app does not like when values are not set / null. so, make sure you items have a state
  • according to specification you cannot add Color Temperature and hue at the same time
    --- apple spec ---
    9.21 Color Temperature
    This characteristic describes color temperature which is represented in reciprocal megaKelvin (MK-1) or mirek scale.
    (M = 1,000,000 / K where M is the desired mirek value and K is temperature in Kelvin)
    If this characteristic is included in the ”8.23 Light Bulb” (page 147), ”9.44 Hue” (page 179) and ”9.82 Saturation”
    (page 197) must not be included as optional characteristics in ”8.23 Light Bulb” (page 147). This characteristic must not be used for lamps which support color.
    "

@pug304
Copy link
Author

pug304 commented Jan 12, 2021

@yfre

for the parent item:
value: Lighting
config: {}

for switch:
value: Lighting.OnState
config: {}

for brightness:
value: Lighting.Brightness
config: {}

for Coltemp:
value: Lighting.ColorTemperature
config: {}

for hue:
value: Lighting.Hue
config: {}

as you see, everything are standard settings.

another test: setting coltemp to a value bigger then 0 the app won't close, but the icon status changes to no response. Indeed another behavior. I'm ware value=0 isn't NUL ;)

rollback to remove coltemp: with having brightness at 0 absolute no issue

test with hue: Homekit app stalls immediate

Both tests have set the metadata not at same time

@cweitkamp cweitkamp transferred this issue from openhab/openhab-core Jan 12, 2021
@yfre
Copy link
Contributor

yfre commented Jan 20, 2021

@pug304
Copy link
Author

pug304 commented Jan 21, 2021

probably related https://community.openhab.org/t/homekit-color-temperature-with-hue-bulbs/105658/11?u=yfre

yes Eugen, thats absulte the same issue! Looking forward to your investigation!

@yfre yfre self-assigned this Jan 22, 2021
@yfre yfre added the bug An unexpected problem or unintended behavior of an add-on label Jan 22, 2021
@yfre yfre changed the title OH3 homekit Colortemperature and hue issues [homekit] OH3 homekit Colortemperature and hue issues Jan 22, 2021
@yfre
Copy link
Contributor

yfre commented Jan 24, 2021

@pug304
issue identified (https://community.openhab.org/t/homekit-color-temperature-with-hue-bulbs/105658/16?u=yfre), fix for underlaying library is submitted, but it will take some time until new version of that lib gets released and we can switch to it in openHAB.

@pug304
Copy link
Author

pug304 commented Jan 25, 2021

@pug304
issue identified (https://community.openhab.org/t/homekit-color-temperature-with-hue-bulbs/105658/16?u=yfre), fix for underlaying library is submitted, but it will take some time until new version of that lib gets released and we can switch to it in openHAB.

sounds good!

@StephanPirnbaum
Copy link

As I can see, the fix has been merged and a new release has been published. Is there already a plan to integrate the new library in the next release?

@Sirmike2
Copy link

Sirmike2 commented Dec 3, 2021

The issue still exists. I have tested with the snapshot 3.2.0 S2604 after change to official Java HAP lib release.
Also it is strange, if I create a point that is named Colortemp and I add the Metadata for HomeKit (light.colortemperature) this point will show the correct number for the HomeKit setting, but if make the same Point with a different name it will not work and I get also the not responding.

@yfre
Copy link
Contributor

yfre commented Dec 3, 2021

Also it is strange, if I create a point that is named Colortemp and I add the Metadata for HomeKit (light.colortemperature) this point will show the correct number for the HomeKit setting, but if make the same Point with a different name it will not work and I get also the not responding.

this is strange. there is not link whatsoever to the name of the item in the code. can you try 2-3 different names, ideally totally new and never used before?

and do understand correctly, that for Colortemp is works as expected and you see it in home app?

@Sirmike2
Copy link

Sirmike2 commented Dec 3, 2021

I have tried a lot of names, always the same. Only the name Colortemp is working. This Point is not linked to some channel. It was only for me to check what values I will get from HomeKit app and this works with the name Colortemp. I can select the colortemperature in the App and the Point shows the values (72 - 400).

@yfre
Copy link
Contributor

yfre commented Dec 3, 2021

can you share screenshots of now working point? i will try to reproduce on my side

@Sirmike2
Copy link

Sirmike2 commented Dec 3, 2021

Two screenshots one with one named Testpoint and one with Colortemp.
Testpoint
Colortemp

@Sirmike2
Copy link

Sirmike2 commented Dec 3, 2021

Some more:
On the Colortemp picture was also Metadata colortemp set but it is not on the picture! So you have to set it, but not both at the same time I think you know this ;-)
Testpoint_2
Colortemp_2

If you need more, thats no problem !

@yfre
Copy link
Contributor

yfre commented Dec 3, 2021

very helpful, we are getting closer. but i have 2 more requests:

  • can you try to put a value to Testpoint before you add homekit. so, that instead of "NULL" you have a number there
  • can you show me the the complete group "TestlampWSIKEAofSweden"

@Sirmike2
Copy link

Sirmike2 commented Dec 3, 2021

I did it and it will be now also ok for Testpoint. So if in some Point for colortemperature is NULL than it will break.
TestlampeWS
But if I link this to the deCONZ/HUE channel for Colortemperture it will not work. This is probably because it needs kelvin and not mired. So I have to look for a script or rule that convert it.

@Sirmike2
Copy link

Sirmike2 commented Dec 5, 2021

Thanks for help last time. It will work now with script to change from mired to kelvin. I have one more question. I have seen, that in ColorTemperatureCharacteristic.java the defaults for colortemp range are 50 and 400. Is it possible to change this values because I have red something at AccessoryWithColorTemperature.java. I have always worked with Homebridge and FHEM. There is the possibility to change with the mapping the Values, that HomeKit App shows only this values with the cycle. The most Lamps have Colortemp from lets say ~2000 to ~7000 K or ~500 to ~140.

@yfre
Copy link
Contributor

yfre commented Dec 5, 2021

@Sirmike2 right, the configuration option of min/max value was missing. just added it and committed the change. i also will set the value to minValue is openHAB item is NULL. should reduce issues with new items with no value at the beginning.
please test and let me know whether this ticket can be closed

@hpop
Copy link

hpop commented Jan 3, 2022

It will work now with script to change from mired to kelvin.
@Sirmike2 Did you find a solution to convert the values? I was looking into it and didn't find a solution.

@iodb
Copy link

iodb commented Jan 4, 2022

@Sirmike2 Can you please share your solution / script?
I've been looking for a way for my Philips Hue Ambiance bulbs color temperature to be settable via the OpenHAB Homekit integration.

@Sirmike2
Copy link

Sirmike2 commented Jan 4, 2022

In principial I created a second point for my lamp, for example lamp_colortemp_homekit. My first point name is lamp_colortemp. This one is linked to the colortemp channel of the real lamp. So what I did, was only a rule, if I change my colortemp at lamp_colortemp (Kelvin) it will convert to lamp_colortemp_homekit (Mired). 1 Kelvin = 1000000 / Mired
For example :
val kelvin = (1000000 / mired_homekit).intValue
And of course, if homekit changes my point lamp_colortemp_homekit, it will convert my first point lamp_colortemp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants