Homekit temperature sensor won't go below 10°C

Tags: #<Tag:0x00007efecdd3d088> #<Tag:0x00007efecdd3ced0>

Hi all,

I have a weaterstation in my garden, which is connected to openhab and show in homekit with the homekit plugin, which is all working nice. But now the temperatures are dropping, I can see that the homekit temperature won’t drop below 10 degrees.

In OpenHAB itself, the temperatures are shown correct, like 8.3 degrees for example, but in the mean time it is shown as 10 degrees in homekit.

What I’ve done until now:

  • Reworked the homekit item from Tag to metadata
  • In Configuration -> Services-> IO -> Homekit Configuration -> Configure -> Expert Mode, I’ve added the minimumTemperature and maximumTemperature values (minimum first set to 5, now to -100, maximum set to 100)
  • Restarted openhab

All this doesn’t seem to change it’s behaviour.
I’m running on OpenHAB 2.5.4-1

Hopefully someone can help with this issue

Hi Roel,

please try to add “minValue” as part of meta data directly at sensor, e.g

Number temp_sensor "Temperature Sensor [%.1f C]" {homekit="TemperatureSensor" [minValue=1, maxValue=27] }
1 Like

I’ve tried to add the data, have to do it throuh the karaf console, because the items are created through the GUI interface.

openhab> smarthome:metadata add WeerstationTuinTemperature homekit TemperatureSensor ["minValue=1,maxValue=200"]
Updated: Metadata [key=homekit:WeerstationTuinTemperature, value=TemperatureSensor, configuration=[maxValue=200], [minValue=1]]

Hopefully it works, otherwise I can try a few other variations quotes to try to add them, but for now I have to wait for the temperature to drop below 10 degrees. I will let you know if this worked :slight_smile:

Hmm, tried both this and the following command:

openhab> smarthome:metadata add WeerstationTuinTemperature homekit TemperatureSensor ["{minValue=1,maxValue=200}"]
Added: Metadata [key=homekit:WeerstationTuinTemperature, value=TemperatureSensor, configuration=[[minValue=1 maxValue=200]]]

But the minimum termperature stays 10.0 degrees celsius…

this is how my item (configured via .items) looks like in karaf (looks slightly different to yours)

openhab> metadata list temp_sensor                                                                                                                 
Metadata [key=homekit:temp_sensor, value=TemperatureSensor, configuration=[minValue=1, maxValue=27]]

maybe try it without maxValue. min and max are both optional, if not provided the default values defined by apple are used

1 Like

Tried a few more things, unfortunality they all didn’t work. I’ve now created an items file for this single item, but it indeed fixes the problem when I add your line of code. Value’s below 0 don’t seem to work as I get an error on the minus sign:

2020-10-15 07:58:53.045 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'weerstation.items' has errors, therefore ignoring it: [1,89]: no viable alternative at input '-'

But at least it’s better then the 10 degrees that where shown before.

First I thought that when creating an .items file, I had to move everything to that items file as the graphical side wouldn’t work anymore, but luckally that isn’t true, so creating the items file is a bit of a bummer, but not a disaster :slight_smile:

1 Like

interesting. you got very closed to the configuration via karaf already.

regarding values <0. it is a bug in the parsing of items configuration. it does not support “-”. it is fixed with OH3.
as it is a parsing issue, if you find the way to set it via karaf you should be able to set <0


Yeah indeed, I’m not really sure why it didn’t work through the karaf console, but for now I’ll keep it like this. Maybe later when I have new motivation to fix it the correct way I’ll give it a new try. (That will probably be when the temperatures go below 0 degrees and my readings won’t be correct again :stuck_out_tongue: )

Even though I have the working sensor in the items file, I still had to give is a try over the karaf:

openhab> smarthome:metadata add WeerstationTuinTemperature homekit TemperatureSensor [minValue="1" maxValue="100"]
Added: Metadata [key=homekit:WeerstationTuinTemperature, value=TemperatureSensor, configuration=[minValue=1, maxValue=100]]

If you ask me the syntax is now exactly the same, but unfortunately it still keeps the minimum of 10 degrees celsius

probably homekit binding does not get a trigger that items was changed. i see the same with text configuration - if i only change the meta data then homekit does not get information about this change. is there way to do some change with karaf, e.g. rename an item or maybe activate / deactivate it

Found that out earlier on when adding other items to homekit with the metadata tags. Until now I solved that by restarting the openhab service, when restarting the items then get added to homekit. Unfortunately this didn’t work for this.

I got the exact same issue. Temp stays at 10°C with logged error „ Detected value out of range“.
So the only solution to show negative temperatures in HomeKit is to update to OH3?

yes, OH2 does not support negative values in items xml.
other tried to set negative values from karaf or via REST API without success.

Ok… then I will wait a few more weeks or months and update to OH3.
So when the next winter will come I am prepared to show negative values :slight_smile:

Edit: Maybe you can help how I can decrease the min Temp to 0°C via Rest api? This is better than 10°C.

Is this correct?
Metadata [key=homekit:Wetterdaten_temp, value=TemperatureSensor, configuration=[minValue=0.0, maxValue=100.0]]

i don’t use REST API so cannot help here. i use only the items text file configuration.
but your metadata looks correct.
you would need to reload the home app the get new value sync with home app

Reload the home app like a refresh/reopen or like a uninstall and reinstall on phone?
Or a complete new pairing?

Thank you!

Just close the home app, wait a little and open again

Also adding, removing or renaming of HomeKit items in openhab will force home app to reload all accessories

A change of metadata alone does not trigger the accessories reload . So, it must be item name change or complete removal/add of items.

Home app always reload all accessories, it is enough to change one item to reload all.

Ok… removed an another item and added it again.
Everything got a refresh. But the 10°C is still there :frowning:
Also the log in OH still warns me:“ [WARN ] [istics.impl.base.FloatCharacteristic] - Detected value out of range 2.8. Returning min value instead. Characteristic io.github.hapjava.characteristics.impl.thermostat.CurrentTemperatureCharacteristic@935de3“

Looks like I have to add this item via file and not via paperUi. (Never done this before, everything else is working fine with gui created items)

It is also strange that the item get removed from HomeKit when I remove the HomeKit Tag. With only the Metadata for HomeKit the item will not be visible in HomeKit. When I add the tag it is visible in HomeKit again.
So maybe there is also a problem with my Metadata for HomeKit.


i just stumbled on the same problem, but i did not find a way to paste the config in OH3. when inputting and saving, when i come back, the config is gone. what is the format to use for OH3 “code” view ?

Just add the min and max value at the items state description via meta data and it should work fine.