Skip to content

How to add Thermostat / HeaterCooler that just Heats? #108

Closed

Description

@christiantschoerner

The questions says it all. I have a fan that can just heat but not cool. Which Accessory should I use?

Activity

  1. ccutrer commented on Jun 23, 2020

    @ccutrer
    Member

    You would adjust the TargetHeaterCoolMode characteristic to have an allowed value of only Off and Heat; but that's not currently possible.

  2. jvaclavovic commented on Oct 24, 2020

    @jvaclavovic
    Contributor

    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?

    public EnumCharacteristic(
      ...
      protected CompletableFuture<JsonObjectBuilder> makeBuilder(int iid) {
        return super.makeBuilder(iid)
            .thenApply(
                builder -> {
                  return builder
                      // .add("minValue", 0)
                      // .add("maxValue", maxValue)
                      // .add("minStep", 1)
                      .add("valid-values", validValuesBuilder);
    
  3. yfre commented on Oct 27, 2020

    @yfre
    Contributor

    i would suggest to change

    • CurrentHeatingCoolingStateEnum (remove enums you dont need)
    • TargetHeatingCoolingStateEnum (remove enums you dont need)
    • CurrentHeatingCoolingStateCharacteristic (change the maxValue to value you need, e.g. 1)
    • TargetHeatingCoolingStateCharacteristic (change the maxValue to value you need, e.g. 1)
  4. ccutrer commented on Oct 27, 2020

    @ccutrer
    Member

    @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:

    • (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?

  5. yfre commented on Oct 27, 2020

    @yfre
    Contributor

    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."

  6. jvaclavovic commented on Oct 27, 2020

    @jvaclavovic
    Contributor

    @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 :/

  7. jvaclavovic commented on Oct 27, 2020

    @jvaclavovic
    Contributor

    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

  8. ccutrer commented on Dec 11, 2020

    @ccutrer
    Member

    a recent PR implemented proper enums, so you can now build a heating only accessory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions