# Enum AlarmState

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

All Implemented Interfaces:
  `Comparable<AlarmState>`

public enum AlarmState extends Enum<AlarmState>

The state of a life-safety alarm, for `Trait.SMOKE_DETECTED` and `Trait.CO_DETECTED`. Read-only.

##### Read the caveat before you build on this

This API is not a fire-alarm system and must not be the only thing standing between a user and a fire. Notifications here arrive only while the app is running -- see `TraitSubscription.isPushDelivery()` -- and a sleeping phone is told nothing. Treat these values as information, never as a warning channel.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `CRITICAL`
  Detected at or above the alarm threshold.
  `NORMAL`
  Nothing detected.
  `UNKNOWN`
  The accessory could not say.
  `WARNING`
  Detected below the alarm threshold.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static AlarmState`
  `of(TraitValue value)`
  Reads an alarm state out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers `UNKNOWN`.
  `static AlarmState`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static AlarmState[]`
  `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

  - ### NORMAL

    public static final AlarmState NORMAL
    Nothing detected.

  - ### WARNING

    public static final AlarmState WARNING

    Detected below the alarm threshold.

    HomeKit never produces this: its smoke and carbon-monoxide characteristics are two-state, so anything it detects arrives as `CRITICAL`.

  - ### CRITICAL

    public static final AlarmState CRITICAL
    Detected at or above the alarm threshold.

  - ### UNKNOWN

    public static final AlarmState UNKNOWN
    The accessory could not say.

- ## Method Details

  - ### values

    public static AlarmState[] 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 AlarmState 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 AlarmState of(TraitValue value)

    Reads an alarm state 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.SMOKE_DETECTED` or `Trait.CO_DETECTED`, or `null`

    ###### Returns

    the state, never `null`