# Enum HeatingCoolingMode

java.lang.Object
java.lang.Enum<HeatingCoolingMode>
com.codename1.home.HeatingCoolingMode

All Implemented Interfaces:
  `Comparable<HeatingCoolingMode>`

public enum HeatingCoolingMode extends Enum<HeatingCoolingMode>
What a thermostat is doing, for `Trait.CURRENT_HEATING_COOLING`, or what it has been asked to do, for `Trait.TARGET_HEATING_COOLING`.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `AUTO`
  Maintaining a band between `Trait.TARGET_HEATING_TEMPERATURE` and `Trait.TARGET_COOLING_TEMPERATURE`, choosing for itself which to run.
  `COOL`
  Cooling.
  `HEAT`
  Heating.
  `OFF`
  Idle.
  `OTHER`
  A mode this API cannot name, carried so it is not misreported as something it is not.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isWritable()`
  Whether this mode may be written to `Trait.TARGET_HEATING_COOLING`.
  `static HeatingCoolingMode`
  `of(TraitValue value)`
  Reads a mode out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers `OFF`.
  `static HeatingCoolingMode`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static HeatingCoolingMode[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class Enum

  `clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### OFF

    public static final HeatingCoolingMode OFF
    Idle.

  - ### HEAT

    public static final HeatingCoolingMode HEAT
    Heating.

  - ### COOL

    public static final HeatingCoolingMode COOL
    Cooling.

  - ### AUTO

    public static final HeatingCoolingMode AUTO

    Maintaining a band between `Trait.TARGET_HEATING_TEMPERATURE` and `Trait.TARGET_COOLING_TEMPERATURE`, choosing for itself which to run.

    A target only. `Trait.CURRENT_HEATING_COOLING` never reports it, because at any given moment the thermostat is heating, cooling or idle -- "auto" describes the policy, not the state.

    While this is the target, `Trait.TARGET_TEMPERATURE` reports no value: there is no single setpoint to report, and answering with either threshold would silently be the wrong one half the time.

  - ### OTHER

    public static final HeatingCoolingMode OTHER

    A mode this API cannot name, carried so it is not misreported as something it is not.

    Matter's thermostat has `EmergencyHeat`, `Precooling`, `FanOnly`, `Dry` and `Sleep`, none of which HomeKit can express and none of which have a portable meaning. Folding them into `OFF` would tell an app a running dehumidifier is idle. Read `TraitValue.getRawPlatformValue()` for Matter's own ordinal when you need to know which.

    Writing this is rejected with `HomeError.INVALID_ARGUMENT` -- an API that cannot name a mode cannot ask for it either.

- ## Method Details

  - ### values

    public static HeatingCoolingMode[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static HeatingCoolingMode valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified name
      `NullPointerException` - if the argument is null

  - ### of

    public static HeatingCoolingMode of(TraitValue value)

    Reads a mode out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers `OFF`.

    `OFF` rather than `OTHER` as the fallback, deliberately: `OTHER` means "the accessory named a mode we cannot express", which is a claim about the accessory. A value this code could not read at all is not evidence of that.

    ###### Parameters

    - `value`: a value read from one of the heating-cooling traits, or `null`

    ###### Returns

    the mode, never `null`

  - ### isWritable

    public boolean isWritable()

    Whether this mode may be written to `Trait.TARGET_HEATING_COOLING`.

    ###### Returns

    `true` for everything except `OTHER`