public enum FanMode

  1. Object
  2. Enum<FanMode>
  3. FanMode

ImplementsComparable<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 constants

OFFNot running.
LOWLow speed.
MEDIUMMedium speed.
HIGHHigh speed.
ONRunning at whatever speed Trait.FAN_SPEED says.
AUTOThe fan is choosing its own speed.
SMARTThe fan is choosing its own speed using its own sensors and schedule.

Methods

public static FanMode[] values()
public static FanMode valueOf(String name)
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.

Inherited methods

Enum constant details

OFF

OFF
Not running.

LOW

LOW
Low speed. Never read back on HomeKit; see the class note.

MEDIUM

MEDIUM
Medium speed. Never read back on HomeKit; see the class note.

HIGH

HIGH
High speed. Never read back on HomeKit; see the class note.

ON

ON
Running at whatever speed Trait.FAN_SPEED says.

AUTO

AUTO
The fan is choosing its own speed.

SMART

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()

valueOf

public static FanMode valueOf(String name)

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

value TraitValue
a value read from Trait.FAN_MODE, or null

Returns

the mode, never null