Checking value of Thermostat.TargetTemperature against min/max seems erratic

Hi all,
I am currently updating my setup to use item metadata instead of labels for the Homekit integration.
At one point, I see some behaviour which seems erratic to me.

I have set up a Thermostat accessory (group + all the individual characteristics), which works as it should.
I have set minimumTemperature and maximumTemperature in the homekit.cfg:

org.openhab.homekit:minimumTemperature=0
org.openhab.homekit:maximumTemperature=30

I also see these being set to 0 respectively 30 when going through PaperUI / Homekit Integration / Configure / Expert mode.

For testing purposes, I have bound a Number item with no channel behind it to one Thermostat.TargetTemperature.

When I change the value of that item, no matter to how low or high I set it, I never get a message in the log, that the value may be above or below the defined min/max.

But: when I restart the homekit bundle (through OH console) or if OH restarts, I get errors, depending on what the value was set to, prior to the restart. I get an error “over max”, when the item is set to >38.0:

2020-05-20 10:32:25.488 [WARN ] [istics.impl.base.FloatCharacteristic] - Detected value out of range 38.1. Returning max value instead. Characteristic io.github.hapjava.characteristics.impl.thermostat.TargetTemperatureCharacteristic@4350a17a

I get an error “below min”, when the item is set to <10.0:

2020-05-20 10:35:22.947 [WARN ] [istics.impl.base.FloatCharacteristic] - Detected value out of range 9.9. Returning min value instead. Characteristic io.github.hapjava.characteristics.impl.thermostat.TargetTemperatureCharacteristic@15c85b6e

When I crank up the maximumTermperature in PaperUI, this has no effect on the max-bound that is checked - it’s still 38.

Two questions:

  1. is this the expected behaviour, that min/max bounds are checked when Homekit starts (reloads), but not when the item to which the value is bound changes?
  2. how come, that in my setup min/max which are used for checking seem to be 10/38, instead of the configured 0/30?

it is limitation of the HomeKit protocol.

Home app asks for min/max values at very beginning, when device get added to home app. after that only the values are communicated but not the max/min.
There is no way to inform home app about min/max changes other than removing and adding the device again.

Therefore the newer version of HomeKit addon does not support min/max anymore. It may get re-introduce in the future version, especially if apple add better support for it or there is strong demand for it.

There are default min/max values defined by apples, which are 10 and 38 C. These values get checked.

1 Like

@bastian there is PR to add support for min/max temperature at item level. i.e. you can define different min/max for different items.

as mentioned before, home app requests this information only with the first requests when it loads the accessory configuration from homekit binding. means, if you want to change the min/max values later, you need to remove item and add it back again with new values or rename it.

2 Likes

Thank you for this addition. I am using the item-level config params for 10 sensors.
In my case i use some sensors from solar water heater (upper limit 180°C).
And some other heating related sensors. Higher then 38 and lower then 10 is defenitly needed in my scenario.