Enum FanMode

java.lang.Object
java.lang.Enum<FanMode>
com.codename1.home.FanMode
All Implemented Interfaces:
Comparable<FanMode>

public enum FanMode extends Enum<FanMode>

How a fan is running, for Trait.FAN_MODE.

This one is heavily lossy on HomeKit

Matter's Fan Control cluster has a real mode attribute with seven values. HomeKit has no equivalent: its fan service carries a speed percentage and a two-state "manual or auto" characteristic, and off is expressed through the power characteristic rather than as a mode.

So on iOS: writing LOW, MEDIUM or HIGH is translated into a Trait.FAN_SPEED write of 33, 66 or 100 percent, and a read never returns them -- it answers OFF, AUTO or ON. If your UI needs to show the speed the user picked, read Trait.FAN_SPEED and render that; it works the same everywhere.

OFF is read from the power characteristic rather than from the mode, because that is where HomeKit keeps it -- a fan standing still still reports "manual" or "auto" as its mode. A subscription to Trait.FAN_MODE watches the power characteristic for the same reason, so switching the fan off is a mode change your listener hears.

  • Enum Constant Details

    • OFF

      public static final FanMode OFF
      Not running.
    • LOW

      public static final FanMode LOW
      Low speed. Never read back on HomeKit; see the class note.
    • MEDIUM

      public static final FanMode MEDIUM
      Medium speed. Never read back on HomeKit; see the class note.
    • HIGH

      public static final FanMode HIGH
      High speed. Never read back on HomeKit; see the class note.
    • ON

      public static final FanMode ON
      Running at whatever speed Trait.FAN_SPEED says.
    • AUTO

      public static final FanMode AUTO
      The fan is choosing its own speed.
    • SMART

      public static final FanMode SMART

      The fan is choosing its own speed using its own sensors and schedule.

      Matter and Google Home only. HomeKit reports AUTO instead.

  • Method Details

    • values

      public static FanMode[] 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 FanMode 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 FanMode of(TraitValue value)

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

      Parameters
      Returns

      the mode, never null