HomeKit 3.0 and Thermostats

I am struggling to use a Thermostat with the new native OH3 HomeKit integration. What I have done:

  • Created a group “gThermos”
  • Tried to assign it to all 4 required items (Current Temperatur, Target Temperature, Current Heating Cooling Mode, Target Heating Cooling Mode) directly in the item with the Metadata UI (great stuff btw).
  • Current Temp, Target Temperature is easy.
  • Current and Target Heating Cooling Modes are the challenge as my Eurotronic Z-Wave Thermostat just offers one Mode item.

With my previous homebridge I had two virtual items for current and target heating cooling (while just current was changed through a formula). Based on a formula and the dimmer state I could make the button active when the dimmer state was above 10% and deactivated when below.

Having this understanding in mind I tested any combination including my old homebridge setup, or assigning the one thermostat mode to both required HomeKit metadata states. Nothing worked. The thermostat shows up in my Home app, but doesn’t reflect the heating on / off indication of the button. And I receive lots of complaints in the log that the wrong string is used.

Has anybody already managed to have a working heating/off indication of the thermostat with OH3 HomeKit?

what kind of mapping are you using? homekit expects specific values for mode.

i have done it with virtual item and mapping rules like this

rule "Map AZ heating Mode for Homekit"
        Item workroom_value received update
     if (workroom_value.state > 0) {
        } else {

Thanks, that looks similar to my rule, I guess your

  • workCurrentThermostatMode is the “physical” mode item from the Thermostat while
  • workTargetThermostatMode is just a virtual string item

Is that correct? And can you confirm that we both mean OH3 and your rule activates and deactivates the button in OH3 depending on heating / off?

And what triggers your rule, what is workroom_value,?

both are virtual. i dont have modes at thermostat. workroom_value indicates whether heating valve is open or not, e.g. value = 60% -> heating valve is open to 60%. 0 means completely closed and heating is off
for sake of completeness, here is my items definition

Group gWorkThermostat "Workroom  Heating" {homekit="Thermostat"}
Number workThermostatCurrentTemp "Workroom Temperature [%.1f C]"           (gWorkThermostat) {homekit="Thermostat.CurrentTemperature", channel="knx:device:scn_ip:..."}
Number workThermostatTargetTemperature "Workroom Target Temperature [%.1f C]" (gWorkThermostat) {homekit="Thermostat.TargetTemperature", channel="knx:device:..."}
String workCurrentThermostatMode "Workroom Mode"            (gWorkThermostat) {homekit="Thermostat.CurrentHeatingCoolingMode"}
String workTargetThermostatMode "Workroom Target-Mode"        (gWorkThermostat) {homekit="Thermostat.TargetHeatingCoolingMode"}
1 Like

Works now, must have been another error in my settings. But this is what happens when I try to change the temperature with the iOS Home app:

==> /var/log/openhab/openhab.log <==

2020-11-23 22:51:26.541 [WARN ] [ristics.impl.base.BaseCharacteristic] - Error while setting JSON value
java.lang.ClassCastException: class org.openhab.core.library.items.NumberItem cannot be cast to class org.openhab.core.library.items.StringItem (org.openhab.core.library.items.NumberItem and org.openhab.core.library.items.StringItem are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @1415529)
	at org.openhab.io.homekit.internal.accessories.HomekitThermostatImpl.setTargetState(HomekitThermostatImpl.java:191) ~[bundleFile:?]
	at io.github.hapjava.characteristics.impl.thermostat.TargetHeatingCoolingStateCharacteristic.setValue(TargetHeatingCoolingStateCharacteristic.java:35) ~[bundleFile:?]
	at io.github.hapjava.characteristics.impl.thermostat.TargetHeatingCoolingStateCharacteristic.setValue(TargetHeatingCoolingStateCharacteristic.java:12) ~[bundleFile:?]
	at io.github.hapjava.characteristics.impl.base.BaseCharacteristic.setValue(BaseCharacteristic.java:127) [bundleFile:?]
	at io.github.hapjava.server.impl.json.CharacteristicsController.put(CharacteristicsController.java:83) [bundleFile:?]
	at io.github.hapjava.server.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:79) [bundleFile:?]
	at io.github.hapjava.server.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:55) [bundleFile:?]
	at io.github.hapjava.server.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:49) [bundleFile:?]
	at io.github.hapjava.server.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:52) [bundleFile:?]
	at io.github.hapjava.server.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:17) [bundleFile:?]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [bundleFile:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:56) [bundleFile:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.42.Final]
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [bundleFile:4.1.42.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [bundleFile:4.1.42.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.42.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.42.Final]
	at java.lang.Thread.run(Thread.java:834) [?:?]
==> /var/log/openhab/events.log <==
2020-11-23 22:51:26.571 [vent.ChannelTriggeredEvent] - logreader:reader:dc3aa754:newWarningEvent triggered 2020-11-23 22:51:26.541 [WARN ] [ristics.impl.base.BaseCharacteristic] - Error while setting JSON value
2020-11-23 22:51:26.715 [vent.ItemStateChangedEvent] - Item 'Pwr_HZ_Actual_Temp' changed from 44.1 to 44.0
2020-11-23 22:51:29.353 [WARN ] [ristics.impl.base.BaseCharacteristic] - Error while setting JSON value
2020-11-23 22:51:29.572 [WARN ] [ristics.impl.base.BaseCharacteristic] - Error while setting JSON value

it complains, that in you have “Number” instead of “String” for target mode.
please ensure that targetMode item has type string, e.g.

String workTargetThermostatMode

Damn, I had still old fragments included. Thanks.