# Enum AirQualityLevel

java.lang.Object
java.lang.Enum<AirQualityLevel>
com.codename1.home.AirQualityLevel

All Implemented Interfaces:
  `Comparable<AirQualityLevel>`

public enum AirQualityLevel extends Enum<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
  Enum Constant
  Description
  `EXTREMELY_POOR`
  Extremely poor.
  `FAIR`
  Fair.
  `GOOD`
  Good.
  `MODERATE`
  Moderate.
  `POOR`
  Poor.
  `UNKNOWN`
  The accessory has not measured yet, or could not.
  `VERY_POOR`
  Very poor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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`.
  `static AirQualityLevel`
  `valueOf(String name)`
  Returns 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`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### UNKNOWN

    public static final AirQualityLevel UNKNOWN
    The accessory has not measured yet, or could not.

  - ### GOOD

    public static final AirQualityLevel GOOD
    Good. HomeKit's "excellent" also arrives here.

  - ### FAIR

    public static final AirQualityLevel FAIR
    Fair. HomeKit's "good" also arrives here.

  - ### MODERATE

    public static final AirQualityLevel MODERATE
    Moderate. HomeKit's "fair" arrives here.

  - ### POOR

    public static final AirQualityLevel POOR
    Poor. HomeKit's "inferior" arrives here.

  - ### VERY_POOR

    public static final AirQualityLevel VERY_POOR
    Very poor. HomeKit's "poor" arrives here.

  - ### EXTREMELY_POOR

    public static final AirQualityLevel EXTREMELY_POOR
    Extremely poor. Matter and Google Home only -- HomeKit's scale stops one level short.

- ## Method Details

  - ### values

    public static AirQualityLevel[] 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

    public static AirQualityLevel valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null

  - ### 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`: a value read from `Trait.AIR_QUALITY`, or `null`

    ###### Returns

    the level, never `null`