You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to add Thermostat / HeaterCooler that just Heats? #108
Hello, I'm trying to modify library to support "heating-only" mode. I modified EnumCharacteristic, metod makeBuilder. I replaced minValue/maxValue by list of valid-values. Its works, I have device only with on/off switch without "auto-heat-cool-off" switch. But it works only few (~20) seconds after pairing. Then some update is started and all devices again have "auto-heat-cool-off" switch. Is there any other place in the code that needs to be modified?
I dunno, that seems like a pain to create specific enum/characteristic every time we need to restrict the possible values.
b) for targetheatingcoolingstate, there are multiple combinations that make sense:
(off, cool, heat, auto)
(off, cool)
(off, heat)
(heat) - I have multiple thermostat-like devices that cannot be turned off - hot tub heater, pool heater, heated tile floor
(cool, heat) - and thus it follows that this and the next combination could also exist in the real world
(cool, heat, auto)
c) there are other characteristics that need the same treatment. Off the top of my head, SecuritySystem target mode comes to mind (HomeKit allows off, stay, away, night; my security system does not have a "night" mode).
Seems like a better solution would be for enum-type characteristics, we add a way to define them with a list of valid values. then just keep re-using the existing Enum for them (you can only restrict, you can't add).
@jvaclavovic : maybe you need to also restrict the values for the CurrentHeatingCoolingState for HomeKit to accept it?
just checked in HAP specification, sub-set of defined enum values is supported by HAP
"2.3.3.1 Valid Characteristic Values
Accessory characteristics that support only a sub-set of the Apple-defined enum values can indicate the supported
values as part of the characteristicʼs metadata."
This is exactly what I'm doing: I have implemented valid-values for EnumCharacteristic, instead of minValue and maxValue, because I think that min,max do not make sense for enum values. I set only INACTIVE and HEATING for CurrentHeaterCoolerStateEnum and HEAT for TargetHeaterCoolerStateEnum and it works - but only for few seconds (~ 30 seconds).
After pairing I have Heating with on/off switch. But after few seconds the Heating switches to off/cool/heat/auto mode. It is some update from HomeKit, not from my side, because I have only implemented initial state and temperature, without any updates.
Oh, I was my stupid mistake... I use repeately JsonArrayBuilder for creating list of valid values, but method build() on this object after creating list removes all values... so this works only for the first time and after accessories update valid-values was sent empty...
So, valid-values on EnumCharacteristics works perfectly and I have "heats-only" HeaterCooler.
Thank you for your help and I apologize for the inconvenience
Activity
ccutrer commentedon Jun 23, 2020
You would adjust the TargetHeaterCoolMode characteristic to have an allowed value of only Off and Heat; but that's not currently possible.
jvaclavovic commentedon Oct 24, 2020
Hello, I'm trying to modify library to support "heating-only" mode. I modified EnumCharacteristic, metod makeBuilder. I replaced minValue/maxValue by list of valid-values. Its works, I have device only with on/off switch without "auto-heat-cool-off" switch. But it works only few (~20) seconds after pairing. Then some update is started and all devices again have "auto-heat-cool-off" switch. Is there any other place in the code that needs to be modified?
yfre commentedon Oct 27, 2020
i would suggest to change
ccutrer commentedon Oct 27, 2020
@yfre:
I dunno, that seems like a pain to create specific enum/characteristic every time we need to restrict the possible values.
b) for targetheatingcoolingstate, there are multiple combinations that make sense:
c) there are other characteristics that need the same treatment. Off the top of my head, SecuritySystem target mode comes to mind (HomeKit allows off, stay, away, night; my security system does not have a "night" mode).
Seems like a better solution would be for enum-type characteristics, we add a way to define them with a list of valid values. then just keep re-using the existing Enum for them (you can only restrict, you can't add).
@jvaclavovic : maybe you need to also restrict the values for the CurrentHeatingCoolingState for HomeKit to accept it?
yfre commentedon Oct 27, 2020
just checked in HAP specification, sub-set of defined enum values is supported by HAP
"2.3.3.1 Valid Characteristic Values
Accessory characteristics that support only a sub-set of the Apple-defined enum values can indicate the supported
values as part of the characteristicʼs metadata."
jvaclavovic commentedon Oct 27, 2020
@ccutrer
This is exactly what I'm doing: I have implemented valid-values for EnumCharacteristic, instead of minValue and maxValue, because I think that min,max do not make sense for enum values. I set only INACTIVE and HEATING for CurrentHeaterCoolerStateEnum and HEAT for TargetHeaterCoolerStateEnum and it works - but only for few seconds (~ 30 seconds).
After pairing I have Heating with on/off switch. But after few seconds the Heating switches to off/cool/heat/auto mode. It is some update from HomeKit, not from my side, because I have only implemented initial state and temperature, without any updates.
@yfre
I tried to remove unnecessary values from both enums, but it had no effect :/
jvaclavovic commentedon Oct 27, 2020
Oh, I was my stupid mistake... I use repeately JsonArrayBuilder for creating list of valid values, but method build() on this object after creating list removes all values... so this works only for the first time and after accessories update valid-values was sent empty...
So, valid-values on EnumCharacteristics works perfectly and I have "heats-only" HeaterCooler.
Thank you for your help and I apologize for the inconvenience
ccutrer commentedon Dec 11, 2020
a recent PR implemented proper enums, so you can now build a heating only accessory