# Enum HomeAvailability

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

All Implemented Interfaces:
  `Comparable<HomeAvailability>`

public enum HomeAvailability extends Enum<HomeAvailability>

Whether a home graph is usable right now, and when it is not, why.

Check this before anything else. Several of these states are recoverable by the user, and the recovery differs -- sending someone to Google Play for a provider update when what they actually need is to sign in helps nobody.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `AVAILABLE`
  Full support: the graph is readable, traits can be read and written, scenes can be run.
  `COMMISSIONING_ONLY`
  Matter commissioning works and nothing else does. The graph is empty; no trait can be read or written.
  `LOCAL_ONLY`
  A local, app-private simulated home.
  `NOT_CONFIGURED`
  Everything is authorized and there are no homes to show.
  `NOT_STARTED`
  Nothing has connected to the backend yet, so there is nothing to report.
  `NOT_SUPPORTED`
  No smart-home support on this port, OS version or build.
  `PERMISSION_DENIED`
  The user was asked and said no.
  `PERMISSION_REQUIRED`
  Smart-home support exists and the user has not been asked yet.
  `PROVIDER_NOT_INSTALLED`
  The platform provider app is missing -- Google Play services on Android.
  `PROVIDER_UPDATE_REQUIRED`
  The platform provider is installed but too old.
  `RESTRICTED`
  Access is blocked by parental controls or device management.
  `SIGN_IN_REQUIRED`
  The backend needs a signed-in account before anything is visible.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static HomeAvailability`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static HomeAvailability[]`
  `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

  - ### AVAILABLE

    public static final HomeAvailability AVAILABLE
    Full support: the graph is readable, traits can be read and written, scenes can be run.

  - ### COMMISSIONING_ONLY

    public static final HomeAvailability COMMISSIONING_ONLY

    Matter commissioning works and nothing else does. The graph is empty; no trait can be read or written.

    This is what Android reports by default, and it is the most important distinction in this enum. Google Play services can commission a Matter accessory into the user's Google Home with no setup at all, but reading or controlling that accessory afterwards needs the Google Home APIs, which need a Google Cloud project and a Home Developer Console registration that only the app's developer can create.

    Reporting `AVAILABLE` here would make the constant mean something entirely different on Android than on iOS, and an app written against the iOS meaning would show an empty home with no explanation. See `SmartHome.getConfigurationProblems()` for what to enable.

  - ### PERMISSION_REQUIRED

    public static final HomeAvailability PERMISSION_REQUIRED
    Smart-home support exists and the user has not been asked yet. Call `SmartHome.requestAuthorization()`.

  - ### SIGN_IN_REQUIRED

    public static final HomeAvailability SIGN_IN_REQUIRED
    The backend needs a signed-in account before anything is visible. Google Home only.

  - ### NOT_CONFIGURED

    public static final HomeAvailability NOT_CONFIGURED

    Everything is authorized and there are no homes to show.

    Its own state rather than an empty `AVAILABLE`, because it is both common and actionable: HomeKit exists on every iOS device, so "supported" is not a useful answer to a user who has never opened the Home app. Send them to `SmartHome.openEcosystemApp()`.

  - ### RESTRICTED

    public static final HomeAvailability RESTRICTED
    Access is blocked by parental controls or device management. Not recoverable from inside the app.

  - ### PROVIDER_NOT_INSTALLED

    public static final HomeAvailability PROVIDER_NOT_INSTALLED
    The platform provider app is missing -- Google Play services on Android. Recoverable via `SmartHome.openProviderSetup()`.

  - ### PROVIDER_UPDATE_REQUIRED

    public static final HomeAvailability PROVIDER_UPDATE_REQUIRED
    The platform provider is installed but too old. Also recoverable via `SmartHome.openProviderSetup()`.

  - ### LOCAL_ONLY

    public static final HomeAvailability LOCAL_ONLY

    A local, app-private simulated home. Reads and writes work and are durable, but nothing outside this app can see the accessories and no physical device is involved.

    Reported by the simulator, the desktop ports and the JavaScript port. The simulator can be scripted to report any other constant in this enum, so an app's recovery branches are reachable without a device.

  - ### NOT_SUPPORTED

    public static final HomeAvailability NOT_SUPPORTED
    No smart-home support on this port, OS version or build. Where the cause is a missing build hint or entitlement rather than the platform, `SmartHome.getConfigurationProblems()` says which.

  - ### PERMISSION_DENIED

    public static final HomeAvailability PERMISSION_DENIED

    The user was asked and said no.

    Its own state rather than `PERMISSION_REQUIRED`, because the recovery is different and the wrong one gets nowhere: iOS asks for HomeKit once and never again, so an app that answers a refusal by calling `SmartHome.requestAuthorization()` gets the same refusal back with no prompt shown and no way for the user to see what is being asked. Send them to `SmartHome.openHomeSettings()` instead.

    New constants go after this one: the ports carry these across as ordinals.

  - ### NOT_STARTED

    public static final HomeAvailability NOT_STARTED

    Nothing has connected to the backend yet, so there is nothing to report. Call `SmartHome.refresh()`, which connects.

    Its own state rather than `PERMISSION_REQUIRED`, which iOS reported on every cold launch: creating HomeKit's manager is what prompts, so until something does, this process cannot tell a user who has already authorized from one who has been asked and refused from one with no home set up. Answering "not asked" for all three sent an app that follows the documented branch into requestAuthorization() when the user had already answered, and iOS asks once -- so nothing appeared on screen and the app returned having done nothing.

    Last in this enum, and new constants go after it.

- ## Method Details

  - ### values

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