Question about OH3, Homekit, and a Temp Sensor

Good afternoon.

Running OH3 (under OpenHabian), and after having some issues migrating from 2.x to 3.x, I’m just now starting to dig into the new structure for HomeKit metadata associations.

Back on OH2, it was done with Tags, and sadly, with the upgrade to 3, that didn’t convert/carryover to Homekit in OH3, which wiped out all the HomeKit items, needing them to be manually re-added.

Once the metadata is added, they do populate again in HomeKit, but in the default room, so they still have to be manually moved and all automation/scene rules completely rebuilt.

In doing so, I discovered an oddity. We had a pool temp sensor (in OH2, the tag used was “CurrentTemperature”). In OH3, I’ve added the HomeKit metadata of “TemperatureSensor.CurrentTemperature”, as that seems the most logical match to the original.

Indeed, it now appears, but in OH2, this appeared as Fahrenheit. Now, in OH3, it’s showing as Celsius. On OH’s web portal the pool temp sensor shows 92 (as Fahrenheit is coming from the Omni alarm panel, which is the temp source), but in HomeKit, it’s showing 38 degrees. Still trying to understand the “config” options for a given HomeKit metadata item. Is there something I can add to the “code” section of that metadata that would make it force Fahrenheit? The system-wide option of UseFahrenheit is active but hasn’t seemed to have any affect on this figure.


What type of Item have you linked this to? OH3 bindings make more extensive use of Quantity types, where the user gets to choose display units etc. The source units don’t matter much.

Have you tried to set the „Use Fahrenheit Temperature“ to active in the HomeKit integration settings?

This is the OmniLink Binding (HAI/Leviton Omni automation panel). v3.1.0
I’ve noticed the list of HomeKit options are far superior to the older OH2 options. I was pleased to see some actual security components - I might actually be able to do something with a virtual keypad for setting the alarm, so that’s exciting. :slight_smile:

In terms of OH Item, it’s the original one that was built (from the upgrade) - that didn’t change, but it’s showing as:
Name: omnilink_temp_sensor_3adef24e_31_temperature
Label: Pool Water Temperature
Type: Number
Category: Temperature
Semantic Class: None

I did change it to a type of: Number:Temperature, which just changed the display in OH to now add “F” at the end, but no change in HomeKit.

If you’re talking about the Global Homekit Option - yes, that’s already active. I even turned it off (save) then back on (save again), since that setting was actually part OH2 config that carried over.

You may then change your Item state presentation options to get display in °C with auto conversion.

No, this way is internal to openHAB. As said, for this purpose it doesn’t matter what Homekit supplies, we can convert within OH.

You may wish to set the Homekit end as advised by @dirkdirk

The preferred display for us is F, and OH’s web portal is showing F, but ever since OH3, what HomeKit is receiving is now Celsius. The global option in HomeKit is set to display as F, so I’m not sure what you mean…

Okeydoke, what is your Number:Temperature Item state getting set to? Consult your events.log so that you are not looking at a possibly converted display.

I have the same problem with HomeKit showing 38 degrees for temperature sensors. In my case, the sensors are reporting the correct temp in OpenHAB, and the temps are all different. What they have in common is they all have a decimal point in the value. It appears HomeKit doesn’t like the format and reports it as 38 degrees no matter what the value. Does anyone know if there’s a fix for this?

Apple has defined default max and min values for temperature. if the value is above or below min/max it gets replaced by min/max. the default max value is 38 degree celsius.

usually it gets more tricky with Fahrenheit as numbers are higher there. if you use Fahrenheit please make sure you have set Fahrenheit in unit in homekit binding settings.

you can also overwrite the default the min/max values via minValue/maxValue at openHAB item.

Number 	thermostat_current_temp {homekit = "CurrentTemperature" [minValue=5, maxValue=100]}

Thanks for the reply. I realized the resolution was not the problem. The sensor without a decimal point was only 29 degrees F. The others were over 38 degrees, so you are correct.

I already have Fahrenheit set in the HomeKit settings, so I tried adding the minValue/maxValue to the metadata. I’m using the GUI, so I added it to the Metadata:stateDescription. The code is as follows:

value: " "
min: “0”
max: “100”

Unfortunately this didn’t fix the problem. It’s still showing 38 degrees. Any idea what I’m doing wrong?

Is there an option or config item to remove the decimal place? Maybe HomeKit is expecting whole numbers not fractions (decimals)…

I will say, this was a difference in OH2.5, which displayed the temps properly in HomeKit…

Kristian Guntzelman

you need to add minValue and maxValue to homekit metadata.
if you use OH 3.2 then main ui has already input fields for min/max value so that you dont need to touch textual configuration.
here are the screenshots from my setup

just check the specification and implementation - fractions / decimals are fine. according to spec temperature can be float, i.e. with decimal, and the implementation also support it.
also works correctly for me

That was the problem, thanks! I should have noticed these settings in the HomeKit metadata. Just curious why the defaults are in Celsius? I understand the HomeKit protocol uses Celcius, however shouldn’t they be Fahrenheit values when “Use Fahrenheit Temperature” is selected? That would really simplify it for the user.

With regard to thermostats, I was able to get the correct temps by setting the min/max values for Thermostat.CurrentTemperature and Thermostat.TargetTemperature. However I can’t get the modes to work. I have a Leviton OmniPro and RC2000 thermostat (via OmniLink binding), so I added numbers (0,1,2,3) to the global HomeKit Heating/Cooling mappings. However this didn’t work. Any suggestions?

Also, this thermostat supports humidity, but there’s no support for thermostat humidity in HomeKit. So I decided to make it a separate humidity sensor. I tried adding HumiditySensor.RelativeHumidity to the thermostat humidity item in the thermostat equipment group, but it did not work. I had to create another item outside the group for it to work. Does this sound correct?

Where are you looking? openHAB chooses default temperature units for display based on the local that you told it.

I needed to add min and max values for the HomeKit temperature items. (As I noted, my sensors were limited to 38 degrees max.) This doesn’t seem like it should be necessary if I already set the HomeKit global setting to Fahrenheit. OpenHAB should know this and adjust accordingly without the need to do anything else. That said, what’s the purpose of these limits anyway?

More details here: (Homekit temperature sensor won't go below 10°C - #16 by dirkdirk)

do you know which version of openHAB you have? actually the issue with default min/max not being converted to Fahrenheit was fixed recently and should work with OH3.2
if not, i would need to check it again.

Apple has defined max/min values for all characteristic and not only temperature. sometimes it helps to do proper visualisation in home app, e.g. gauge, sometimes it has no benefit.

regarding humidity at thermostats: this will be supported in the next release. currently you need to create humidity sensor outside of the thermostat group

regarding the modes:

  • settings should apply without restart, but just to be on safe side, please restart openhab
  • check in main UI which value the item for mode gets. is it 0,1,2,3? What home apps shows? if you change the mode in home app, what happens to value at openhab item?

I just installed it last week. It shows “3.2.0 Release Build” in the UI.

Good news about support for humidity. Thanks!

Regarding the thermostat modes, the current and target items are both numbers. They show the following in the UI:

Target Mode (0, 1) : Off, Heat
Current Mode (0, 1) : Idle, Heating
Note that I only have heat. (No AC)

  • After restart, the UI shows the correct status from the OmniPro (i.e. “Heat”). HomeKit shows the mode as “OFF”.
  • If I manually change the mode in HomeKit to anything other than “OFF” and then change the mode in the UI to anything (incl. “Off”), HomeKit will change it to “OFF”. Closing the Home app and reopening it also changes it back to “OFF”.
  • Changing the mode in HomeKit does not change the mode in openHAB.
  • Changing the mode in HomeKit to “HEAT” will show the setpoint temp. Changing the temp will change the set point in openHAB.

I hope this helps.

I think the mapping is not working as it should. Can you make a screenshot of your mapping settings in UI?