Enum FanMode
- All Implemented Interfaces:
Comparable<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 Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic FanModeof(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, answersOFF.static FanModeReturns the enum constant of this type with the specified name.static FanMode[]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
-
Enum Constant Details
-
OFF
Not running. -
LOW
Low speed. Never read back on HomeKit; see the class note. -
MEDIUM
Medium speed. Never read back on HomeKit; see the class note. -
HIGH
High speed. Never read back on HomeKit; see the class note. -
ON
Running at whatever speedTrait.FAN_SPEEDsays. -
AUTO
The fan is choosing its own speed. -
SMART
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
of
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
value: a value read fromTrait.FAN_MODE, ornull
Returns
the mode, never
null
-