justme-1968/homebridge-fhem

Max! Thermostats : Incorrect mode shown in home app

Closed this issue · 7 comments

Hey there,

I noticed a strange behavior for Max! Thermostats in home kit.

When I look at the readings in fhem all my thermostats are in mode "auto". But the home app always shows them as "off". When I change the mode in the home app, it shows the new mode until I kill and restart the app.

Is this behavior intended or is it a bug? Anyway it looks strange.

Versions:
homebridge: 0.4.6
homebridge-fhem: 0.2.47

Here's the jsonlist2 of one of my thermostats:

{ 
  "Arg":"MAX_0716a6", 
  "Results": [ 
  { 
    "Name":"MAX_0716a6", 
    "PossibleSets":"wakeUp factoryReset groupid associate:MAX_093d63,MAX_10d785,MAX_067ab2,MAX_035278,MAX_0746ff,MAX_071689,MAX_03975d deassociate:MAX_093d63,MAX_10d785,MAX_067ab2,MAX_035278,MAX_0746ff,MAX_071689,MAX_03975d desiredTemperature:eco,comfort,boost,auto,off,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,on ecoTemperature:off,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,on comfortTemperature:off,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,on measurementOffset:-3.5,-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5 maximumTemperature:off,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,on minimumTemperature:off,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,on windowOpenTemperature:off,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,on windowOpenDuration boostDuration:20,10,30,60,5,0,15,25 boostValveposition decalcification maxValveSetting valveOffset weekProfile", 
    "PossibleAttrs":"alias comment:textField-long eventMap group room suppressReading userReadings:textField-long verbose:0,1,2,3,4,5 IODev do_not_notify:1,0 ignore:0,1 dummy:0,1 showtime:1,0 keepAuto:0,1 scanTemp:0,1 event-on-change-reading event-on-update-reading event-aggregator event-min-interval stateFormat:textField-long timestamp-on-change-reading alarmDevice:Actor,Sensor alarmSettings cmdIcon devStateIcon devStateStyle genericDeviceType:ignore,switch,outlet,light,blind,thermometer,thermostat,garage,window,lock homebridgeMapping:textField-long icon sortby webCmd widgetOverride userattr", 
    "Internals": { 
      "DEF": "HeatingThermostat 0716a6", 
      "LASTInputDev": "ml", 
      "MSGCNT": "735", 
      "NAME": "MAX_0716a6", 
      "NR": "33", 
      "STATE": "18.0 °C", 
      "TYPE": "MAX", 
      "addr": "0716a6", 
      "backend": "ml", 
      "dstsetting": "1", 
      "ml_MSGCNT": "735", 
      "ml_TIME": "2016-10-03 01:02:22", 
      "mode": "0", 
      "rferror": "0", 
      "serial": "KHA0003204", 
      "type": "HeatingThermostat" 
    }, 
    "Readings": { 
      "MAXLAN_error": { "Value":"0", "Time":"2016-10-03 01:02:22" }, 
      "MAXLAN_errorInCommand": { "Value":"", "Time":"2016-10-03 01:02:22" }, 
      "MAXLAN_initialized": { "Value":"1", "Time":"2016-10-03 01:02:22" }, 
      "MAXLAN_isAnswer": { "Value":"0", "Time":"2016-10-03 01:02:22" }, 
      "MAXLAN_valid": { "Value":"1", "Time":"2016-10-03 01:02:22" }, 
      "battery": { "Value":"ok", "Time":"2016-10-03 01:02:22" }, 
      "boostDuration": { "Value":"5", "Time":"2016-10-02 12:47:35" }, 
      "boostValveposition": { "Value":"80", "Time":"2016-10-02 12:47:35" }, 
      "comfortTemperature": { "Value":"21.5", "Time":"2016-10-02 12:47:35" }, 
      "decalcification": { "Value":"Sat 12:00", "Time":"2016-10-02 12:47:35" }, 
      "desiredTemperature": { "Value":"18.0", "Time":"2016-10-03 01:02:22" }, 
      "ecoTemperature": { "Value":"16.5", "Time":"2016-10-02 12:47:35" }, 
      "firmware": { "Value":"1.8", "Time":"2016-10-02 12:47:35" }, 
      "groupid": { "Value":"6", "Time":"2016-10-02 12:47:35" }, 
      "maxValveSetting": { "Value":"100", "Time":"2016-10-02 12:47:35" }, 
      "maximumTemperature": { "Value":"on", "Time":"2016-10-02 12:47:35" }, 
      "measurementOffset": { "Value":"0.0", "Time":"2016-10-02 12:47:35" }, 
      "minimumTemperature": { "Value":"off", "Time":"2016-10-02 12:47:35" }, 
      "mode": { "Value":"auto", "Time":"2016-10-03 01:02:22" }, 
      "state": { "Value":"18.0 °C", "Time":"2016-10-03 01:02:22" }, 
      "temperature": { "Value":"19.9", "Time":"2016-10-03 00:30:12" }, 
      "testresult": { "Value":"255", "Time":"2016-10-02 12:47:35" }, 
      "valveOffset": { "Value":"0", "Time":"2016-10-02 12:47:35" }, 
      "valveposition": { "Value":"13", "Time":"2016-10-03 01:02:22" }, 
      "weekprofile-0-Sat-temp": { "Value":"17.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-0-Sat-time": { "Value":"00:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-1-Sun-temp": { "Value":"17.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-1-Sun-time": { "Value":"00:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-2-Mon-temp": { "Value":"18.0 °C  /  21.0 °C  /  18.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-2-Mon-time": { "Value":"00:00-06:05  /  06:05-09:00  /  09:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-3-Tue-temp": { "Value":"18.0 °C  /  21.0 °C  /  18.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-3-Tue-time": { "Value":"00:00-06:05  /  06:05-09:00  /  09:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-4-Wed-temp": { "Value":"18.0 °C  /  21.0 °C  /  18.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-4-Wed-time": { "Value":"00:00-06:05  /  06:05-09:00  /  09:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-5-Thu-temp": { "Value":"18.0 °C  /  21.0 °C  /  18.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-5-Thu-time": { "Value":"00:00-06:05  /  06:05-09:00  /  09:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-6-Fri-temp": { "Value":"18.0 °C  /  21.0 °C  /  18.0 °C", "Time":"2016-10-02 12:47:35" }, 
      "weekprofile-6-Fri-time": { "Value":"00:00-06:05  /  06:05-09:00  /  09:00-00:00", "Time":"2016-10-02 12:47:35" }, 
      "windowOpenDuration": { "Value":"15", "Time":"2016-10-02 12:47:35" }, 
      "windowOpenTemperature": { "Value":"12.0", "Time":"2016-10-02 12:47:35" } 
    }, 
    "Attributes": { 
      "IODev": "ml", 
      "alias": "Heizung im Schlafzimmer", 
      "room": "Schlafzimmer,MAX" 
    } 
  }  ], 
  "totalResultsReturned":1 
} 

there is no default mapping for CurrentHeatingCoolingState and TargetHeatingCoolingState as the homekit values do not match the MAX modes exactly.

if you want to use this characteristic just provide a homebridgeMapping yourself. without this mapping the characteristics have no connection to the fhem device and just display a default value.

Thank you 👍

I'm afraid, I have to reopen this issue.

I'm still struggling with the homebridgeMapping. I wanted to do things step by step, so I only defined the CurrentHeatingCoolingState. As far as I understand, I will see the correct mode (at least as defined by the mapping) but I will not be able to change the mode until I define TargetHeatingCoolingState.

I defined the homebridgeMapping like this:

CurrentHeatingCoolingState=mode,values=manual:OFF;boost:HEAT;auto:AUTO

I don't know why but, homebridge returns on the console the following contradictory lines (the second one is marked red):

[2016-10-05 17:41:39] [FHEM] MAX_0716a6-mode values: value auto mapped to AUTO
[2016-10-05 17:41:39] [FHEM] MAX_0716a6-mode not a number: auto

This is what else is on the console:

[2016-10-05 17:41:39] [FHEM] value2homekit: { manual: 0, boost: 1, auto: 'AUTO' }
[2016-10-05 17:41:39] [FHEM] homekit2name: { '0': 'OFF', '1': 'HEAT' }

Did I do something wrong?

for the CurrentHeatingCoolingState there is no AUTO defined. only OFF, HEAT and COOL. see HomeKitTypes.js.

for TargetHeatingCoolingState there ist OFF, HEAT, COOL and AUTO.

the idea is that the current state will display the real current operating mode. and only the target mode will show if the current mode was manualy switched to the current value or automatically switched.

Okay. That's really confusing.
So does this mean HomeKit assumes that the mode of thermostats can only be changed through HomeKit?

I don't get the whole point in having an auto mode then...

Doesn't this imply that the system then can have two states at the same time? For example the target decides it's to hot in the room, so it switches automatically to cooling. The state would then be cool AND auto.

no...

the idea is that CurrentHeatingCoolingState will display the real current mode. i.e. the result of auto.

TargetHeatingCoolingState can display auto.

so with the target you can set the system to off, heat, cold or auto and current will show the mode that is active off, heat or cold.

the real problem is that this does not map to the way the european heatings systems work that are used with the hm and max thermostats. they do not have a cooling mode.

so CurrentHeatingCoolingState will be off or heat.

Okay. Thank you very much for the clarification. Now I get the problem. Maybe Apple will fix this in future versions...

To me it was confusing to see my thermostats in the "off" mode in the home app.
Now I've configured the mapping to always show the HEAT state.

homebridgeMapping:
CurrentHeatingCoolingState=mode,values=manual:HEAT;boost:HEAT;auto:HEAT