Homekit temperature sensor won't go below 10°C

i gave this a try, but it did not seemed to work. temperature still shows as 10degrees. let’s just wait for the spring :slight_smile:

After you changed the min max values try to delete and add the item again to HomeKit. Then Homekit will check the new values.

i put the min and max in all my temperature sensors (tried different value, like -20 to 60, or 0 to 100 for different sensors). i deleted the bridge in the Home application on my phone, and added it again. event restarted openhab.
temperatures as still locked in the range 10 to 38 degrees.

This is really strange. Adding the min value (for me -30) changed the behavior of HomeKit and I am able to see temperatures with negative values.

this is indeed strange. are you sure you have not added “minValue” as metadata in homekit namespace?

this is my state description for the item:

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

and temperature are still clipped in the range 10 - 38.

i tried to add meta data min/max_value in homekit namespace. but then i get:
2020-12-30 21:10:27.303 [WARN ] [istics.impl.base.FloatCharacteristic] - Detected value out of range 50.1. Returning max value instead. Characteristic io.github.hapjava.characteristics.impl.thermostat.CurrentTemperatureCharacteristic@73c16
(i did not get this message until i set the homekit meta data min/max_value)

given the range i gave is 0 to 100… i tried to give 1000 as max. same result. that is odd.

also, the type of meta data i used is not thermostat, but rather TemperatureSensor.CurrentTemperature.

can you try to add this metadata

value: " "
config:
    minValue: 0

i.e. start with minValue only

1 Like

i have this now:

value: TemperatureSensor.CurrentTemperature
config:
minValue: 0

edit: okay, that seems to work! Thanks! But then the next problem is that the upper limit, for the sensors i use for my heater etc, are limited to 38 degrees.

edit2: adding in homekit meta data, minValue or maxValue in the config, worked also for fixing temperatures above 38!

2 Likes

I can confirm that temperatures below 0°C are working now with openHAB3.
e.g.:

Group gNetatmo_Outdoor "Balkon Temperatur" { homekit="TemperatureSensor" }
Number Netatmo_Outdoor_Temperature "Balkon Temperatur" <temperature> (gNetatmo_Outdoor) { homekit="TemperatureSensor.CurrentTemperature" [minValue=-20, maxValue=60], channel = "netatmo:NAModule1:home:outside:Temperature" }

After removing/ adding these two items a test temperature of -10°C was shown in the Home app.

3 Likes

I too was having a similar issue with my temperature not displaying correctly. In my case my thermostat (Nest) is set to read in Fahrenheit as well as Openhab’s default temperature, and I changed the settings in Home App to Fahrenheit as well. but I just couldn’t get the temperature to display correctly.

I Tried using the “Use Fahrenheit Temperature” Option inside the homekit add-on settings, only seem to make things worse (Number more incorrect). As well as it seems when Saving the settings for the homekit add-on the homekit.config file sometimes loses some of the saved settings. In my case I would typically lose the user or mac address or everything from the .config file forcing me to remove the bridge from homekit and start over reading openhab3 as a bridge and setting up each device (I have over 50 so its a pain). So for the moment it appears I will avoid using the save feature inside homekit add-on’s settings, and instead start manually editing the homekit.config (found on my system (macOS) in $OPENHAB_USERDATA/config/org/openhab/).

It appears that homekit requires the number to be sent in Celsius and supposedly the binding is to convert Fahrenheit to Celsius automaticly but somewhere in the middle it appears it fails to compute properly. (Best Guess) Seems to me like the temperature in F first being tested to make sure its within the bounds of reasonable temperature range but that range is being provided by HomeKit not OpenHab thus we are being given a range of for Celsius temperatures (something like minValue=10 maxValue=28 not 100% what exactly that is by default), when that is done it is found to be out of bounds and clipped down or up depending on offense. Then the binding converts the number to Celsius (Which is now the wrong temperature) and sends that to Homekit as the Celsius temperature of the thermostat. Which in my case Homekit then reconverts it back to Fahrenheit and is still the wrong value obviously.

I was able to work around this by doing the following:

  1. I created additional items for each temperature value I am sending to HomeKit (set_point, current_temperature etc.).

  2. Install the Javascript Transformation Add-on (if not already done)

  3. Create a javascript file containing JavaScript code to convert from F to C. create a new file in the $OPENHAB_CONF/transform/ directory such as convertToC.js

  4. Inside the file convertToC.js

  (function(i) {
    var array = i.split(" ");
    return(((parseFloat(array[0])-32)*(5/9)).toFixed(1));
  })(input)
  1. I linked those items to the channels for my things that are displayed in Fahrenheit (I now have 2 links per channel because I still want to use the Fahrenheit Values since everything else is in Fahrenheit and used in other rules etc. This item is only used to facilitate the temperature state to HomeKit).

  2. Finally I added the proper HomeKit Metadata to each of the new items.

Note This is correctly working with the “Use Fahrenheit Temperature” Option inside the homekit add-on settings = false.

And now it appears most of not all of the functions for thermostats in HomeKit are working with my Nest Thermostat that is connected via the HomeKit Binding for Openhab3. I can now use Siri to control my Nests, and receive and display the correct temperature values from other temperature sensors as well.

thank you Mike. good investigation.
it is correct, homekit protocol expects C as value for transmission from openhab to home app. Home app would convert than to Fahrenheit based in ios settings to display it.

so, it is 2 conversions: Nest (F) → Homekit protocol (C) → home app display (F).

“Use Fahrenheit Temperature” tells openhab binding to convert whatever numbers it gets from F to C before sending to home app. for the conversion we use standard java temperature conversion function.

binding also checks whether the temperature is in the min-max range, that can be provided as parameter in metadata, e.g.

Number thermostat_target_temp "Thermostat Target Temp[%.1f C]" (gThermostat) {homekit="Thermostat.TargetTemperature" [minValue=0, maxValue=150]}

but it looks like it is not working as expected.

with you conversion, do you see now the temperature in home/homekit app in Fahrenheit or C?

All my temperatures within the Home App are displayed in Fahrenheit and are correct. when I compare them to the Nest iOS App itself. Even changing states, set points, even the heat/cool mode all seem to update as expect and show the proper values displayed in F. As a note I did not need to use the minValue, maxValue config options to make this work. I did try that before going this route but the values being displayed on the HomeKit App where way off, like 167 F when it should have been 65 etc… Only way it seemed to work is if I manually converted it C then used it with “Use Fahrenheit Temperature” option disabled.

Note I did also need to go into the config for the temperature items within HomeKit App (Long Press on the Item) and tell it to use Fahrenheit, as well as having the System->General->Language & Region->Temperature Unit Setting set to Fahrenheit on my iOS Devices.

thank you. that helps to understand and troubleshoot the issue.

it looks like, homekit binding assumed, that Nest provides the temperature in C so that no conversion needed and it has sent 65 as C via homekit. home app has converted 65 C to F, which would be around 150F. so, pretty close to 167 F you have mentioned.

means, “Use Fahrenheit Temperature” was not working / was ignored.
i will take another look on homekit binding logic for this.

Glad this information is useful. I sure do love the HomeKit Add-on and value the functionality it provides. Its up there with the Z-wave Binding (so like top 2 most useful bindings to me) for utility. I feel like the add-on is pretty good, and there are only a few issues (Bugs) that i’ve run into this being probably the largest i’ve ran into. Also check into that issue when I save the Config file it loses my binding information

So i guess now that I have the thermostats working, now maybe let me see if I can get my camera’s (Not HomeKit Certified) integrated in to HomeKit, maybe then be able to use some of HomeKits Image Processing/Facial Recognition/Deep Learning/Neural Engine type of stuff. Would be awesome if I can get OpenHab3 to announce over speakers/toasted to TV screens etc the name of a person that has been found in my photos library even before they get to the door… Drool!

I was thinking a bit more on this topic and it is possible my issue with “Use Fahrenheit Temperature” setting not working may also be a result of the other issue I found where saving the config file loses data. It is possible (I have not spent the time to check) that when I turned on the “Use Fahrenheit Temperature” setting and saved the file (This was before I discovered the losing data problem) that the loss of data when saving included the “Use Fahrenheit Temperature” field, resulting in the feature not really being enabled and actually working as expected. So if you’re having a hard drive duplicating the temperature conversion issues I was having that might explain it.