Enum AirQualityLevel
- All Implemented Interfaces:
Comparable<AirQualityLevel>
A summarized air-quality rating, for Trait.AIR_QUALITY. Read-only.
The two backends do not agree on how many levels there are
HomeKit has six -- unknown, excellent, good, fair, inferior, poor -- and Matter's Air Quality cluster has seven: unknown, good, fair, moderate, poor, very poor, extremely poor. There is no mapping between them that loses nothing.
This enum follows Matter, because collapsing seven levels into six discards
a distinction the accessory made, while spreading six across seven only
leaves a gap. So HomeKit's excellent becomes GOOD, good becomes FAIR,
fair becomes MODERATE, inferior becomes POOR, poor becomes
VERY_POOR, and HomeKit never produces EXTREMELY_POOR.
That is a judgment call and it is visible as one: read
TraitValue.getRawPlatformValue() for the platform's own ordinal if your
app needs to apply its own scale. Do not hard-code thresholds against these
constants and expect them to mean the same air on both platforms.
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic AirQualityLevelof(TraitValue value) Reads an air-quality level out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answersUNKNOWN.static AirQualityLevelReturns the enum constant of this type with the specified name.static AirQualityLevel[]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
-
UNKNOWN
The accessory has not measured yet, or could not. -
GOOD
Good. HomeKit's "excellent" also arrives here. -
FAIR
Fair. HomeKit's "good" also arrives here. -
MODERATE
Moderate. HomeKit's "fair" arrives here. -
POOR
Poor. HomeKit's "inferior" arrives here. -
VERY_POOR
Very poor. HomeKit's "poor" arrives here. -
EXTREMELY_POOR
Extremely poor. Matter and Google Home only -- HomeKit's scale stops one level short.
-
-
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 an air-quality level out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers
UNKNOWN.Parameters
value: a value read fromTrait.AIR_QUALITY, ornull
Returns
the level, never
null
-