public enum AirQualityLevel

  1. Object
  2. Enum<AirQualityLevel>
  3. 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

UNKNOWNThe accessory has not measured yet, or could not.
GOODGood.
FAIRFair.
MODERATEModerate.
POORPoor.
VERY_POORVery poor.
EXTREMELY_POORExtremely 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

UNKNOWN
The accessory has not measured yet, or could not.

GOOD

GOOD
Good. HomeKit’s “excellent” also arrives here.

FAIR

FAIR
Fair. HomeKit’s “good” also arrives here.

MODERATE

MODERATE
Moderate. HomeKit’s “fair” arrives here.

POOR

POOR
Poor. HomeKit’s “inferior” arrives here.

VERY_POOR

VERY_POOR
Very poor. HomeKit’s “poor” arrives here.

EXTREMELY_POOR

EXTREMELY_POOR
Extremely poor. Matter and Google Home only – HomeKit’s scale stops one level short.

Method details

values

public static AirQualityLevel[] values()

valueOf

public static AirQualityLevel valueOf(String name)

of

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.

Parameters

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

Returns

the level, never null