Enum HomeAvailability
- All Implemented Interfaces:
Comparable<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 ConstantsEnum ConstantDescriptionFull support: the graph is readable, traits can be read and written, scenes can be run.Matter commissioning works and nothing else does. The graph is empty; no trait can be read or written.A local, app-private simulated home.Everything is authorized and there are no homes to show.Nothing has connected to the backend yet, so there is nothing to report.No smart-home support on this port, OS version or build.The user was asked and said no.Smart-home support exists and the user has not been asked yet.The platform provider app is missing -- Google Play services on Android.The platform provider is installed but too old.Access is blocked by parental controls or device management.The backend needs a signed-in account before anything is visible. -
Method Summary
Modifier and TypeMethodDescriptionstatic HomeAvailabilityReturns 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
-
Enum Constant Details
-
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.
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
AVAILABLEhere 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. SeeSmartHome.getConfigurationProblems()for what to enable. -
PERMISSION_REQUIRED
Smart-home support exists and the user has not been asked yet. CallSmartHome.requestAuthorization(). -
SIGN_IN_REQUIRED
The backend needs a signed-in account before anything is visible. Google Home only. -
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 toSmartHome.openEcosystemApp(). -
RESTRICTED
Access is blocked by parental controls or device management. Not recoverable from inside the app. -
PROVIDER_NOT_INSTALLED
The platform provider app is missing -- Google Play services on Android. Recoverable viaSmartHome.openProviderSetup(). -
PROVIDER_UPDATE_REQUIRED
The platform provider is installed but too old. Also recoverable viaSmartHome.openProviderSetup(). -
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
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
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 callingSmartHome.requestAuthorization()gets the same refusal back with no prompt shown and no way for the user to see what is being asked. Send them toSmartHome.openHomeSettings()instead.New constants go after this one: the ports carry these across as ordinals.
-
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
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
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 nameNullPointerException- if the argument is null
-