public enum AirQualityLevel
- Object
- Enum<AirQualityLevel>
- AirQualityLevel
ImplementsComparable<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 constants
UNKNOWN | The accessory has not measured yet, or could not. |
GOOD | Good. |
FAIR | Fair. |
MODERATE | Moderate. |
POOR | Poor. |
VERY_POOR | Very poor. |
EXTREMELY_POOR | Extremely poor. |
Methods
public static AirQualityLevel[] values() | |
public static AirQualityLevel valueOf(String name) | |
public static AirQualityLevel of(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, answers UNKNOWN. |
Inherited methods
Enum constant details
UNKNOWN
UNKNOWNGOOD
GOODFAIR
FAIRMODERATE
MODERATEPOOR
POORVERY_POOR
VERY_POOREXTREMELY_POOR
EXTREMELY_POORMethod details
values
public static AirQualityLevel[] values()valueOf
public static AirQualityLevel valueOf(String name)of
public static AirQualityLevel of(TraitValue value)UNKNOWN.Parameters
valueTraitValue- a value read from
Trait.AIR_QUALITY, ornull
Returns
null