Enum HomeError
- All Implemented Interfaces:
Comparable<HomeError>
Typed failure reasons carried by HomeException. Ports map their platform
error codes onto these so cross-platform code can branch on a stable value
instead of parsing messages.
Crossing the boundary by name, not by ordinal
The native bridges send the Enum.name() of one of these, not its ordinal, and
forName(String) resolves it. Ordinals are a wire format that breaks
silently: a port built against a build where a constant was inserted in the
middle would map every error past the insertion point to the wrong one, and
a mis-mapped UNAUTHORIZED looks exactly like a mis-mapped TIMEOUT to
everyone downstream. Names cost a few bytes per failure -- and a failure is
not the hot path.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionNo accessory with the supplied id is in the graph.The accessory is in the graph but the platform could not talk to it -- unplugged, out of Thread range, or its bridge is offline.The user has not yet been asked.The platform refused because an operation of this kind is already in flight.Commissioning ran and did not add the accessory.This platform cannot commission at all -- watchOS, tvOS, macOS, or an Android device with no Play services.The ecosystem app a flow needs -- Apple Home, Google Home -- is not installed, so there was nothing to hand off to.A request was rejected before reaching the platform because it was malformed -- an empty write batch, a trait written with the wrongTraitValueKind, a negative timeout.A payload could not be decoded -- a malformed Matter setup payload, a platform value the port could not map onto aTraitValue.The app is missing build configuration the backend needs -- an entitlement, a project id, an OAuth client.The port, device or OS version has no smart-home support at all, or the requested capability is unavailable on this platform.A door lock rejected the supplied PIN.A door lock refused the operation because it requires a PIN and none was supplied.The platform's smart-home provider is not installed -- Google Play services on Android.The installed provider is too old.The platform rate-limited the request.The trait can be read but not written.Smart-home access is blocked by parental controls or device management.No signed-in account.The operation did not complete within its safety timeout.The accessory does not expose this trait, or the backend cannot express it.The operation was refused for lack of authorization.ATraitUnitwas supplied that measures a different dimension than the trait requires.Anything the port could not classify.The user dismissed a platform authorization, setup or commissioning flow.A write fell outside the range the accessory declares in itsTraitConstraint.The trait can be written but not read. -
Method Summary
Modifier and TypeMethodDescriptionstatic HomeErrorResolves a constant by name, total: an unrecognized ornullname answersUNKNOWNrather than throwing.static HomeErrorReturns the enum constant of this type with the specified name.static HomeError[]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
-
NOT_SUPPORTED
-
TRAIT_NOT_SUPPORTED
The accessory does not expose this trait, or the backend cannot express it. Distinct from
ACCESSORY_NOT_FOUND: the accessory is there and this particular capability is not.Some traits can never succeed on a given backend rather than merely being absent from one accessory --
Trait.OUTLET_IN_USEandTrait.TARGET_HUMIDITYhave no Matter equivalent at all. The javadoc on each such constant says so. -
ACCESSORY_NOT_FOUND
No accessory with the supplied id is in the graph. Usually means the snapshot the caller is holding is stale; callSmartHome.refresh()and wait for it before readingSmartHome.getStructures()again. -
ACCESSORY_UNREACHABLE
The accessory is in the graph but the platform could not talk to it -- unplugged, out of Thread range, or its bridge is offline. Retryable. -
UNAUTHORIZED
The operation was refused for lack of authorization. -
AUTHORIZATION_REQUIRED
The user has not yet been asked. Recoverable by callingSmartHome.requestAuthorization(). -
SIGN_IN_REQUIRED
No signed-in account. Google Home only: the Home APIs need an account and a per-structure grant before any accessory is visible. -
RESTRICTED
Smart-home access is blocked by parental controls or device management. Not recoverable from inside the app. -
USER_CANCELED
The user dismissed a platform authorization, setup or commissioning flow. -
INVALID_ARGUMENT
A request was rejected before reaching the platform because it was malformed -- an empty write batch, a trait written with the wrongTraitValueKind, a negative timeout. -
VALUE_OUT_OF_RANGE
A write fell outside the range the accessory declares in its
TraitConstraint.Deliberately an error rather than a clamp. An app that asked for 40 degrees and silently got 38 never learns it was wrong, and the bug surfaces as a user complaint about a thermostat rather than as a failure at the call site.
-
UNIT_MISMATCH
-
READ_ONLY_TRAIT
The trait can be read but not written. -
WRITE_ONLY_TRAIT
The trait can be written but not read. Rare; some Matter attributes are write-only commands in disguise. -
PIN_REQUIRED
A door lock refused the operation because it requires a PIN and none was supplied. Set one with
TraitWrite.setAuthorizationData(java.lang.String).Matter locks with
RequirePINforRemoteOperationset behave this way. HomeKit never takes a PIN. -
PIN_REJECTED
A door lock rejected the supplied PIN. -
PROVIDER_UNAVAILABLE
The platform's smart-home provider is not installed -- Google Play services on Android. Recoverable viaSmartHome.openProviderSetup(). -
PROVIDER_UPDATE_REQUIRED
The installed provider is too old. Also recoverable viaSmartHome.openProviderSetup(). -
NOT_CONFIGURED
The app is missing build configuration the backend needs -- an entitlement, a project id, an OAuth client. Always accompanied byHomeConfigurationExceptionand by text fromSmartHome.getConfigurationProblems()naming what is missing. -
COMMISSIONING_FAILED
Commissioning ran and did not add the accessory. The message carries the platform's own text. -
COMMISSIONING_UNAVAILABLE
This platform cannot commission at all -- watchOS, tvOS, macOS, or an Android device with no Play services. -
ECOSYSTEM_APP_MISSING
The ecosystem app a flow needs -- Apple Home, Google Home -- is not installed, so there was nothing to hand off to. -
RATE_LIMITED
The platform rate-limited the request. -
BUSY
The platform refused because an operation of this kind is already in flight. Retryable once it settles. -
TIMEOUT
The operation did not complete within its safety timeout. -
INVALID_DATA
A payload could not be decoded -- a malformed Matter setup payload, a platform value the port could not map onto aTraitValue. Never surfaces as an unchecked exception from a parser. -
UNKNOWN
Anything the port could not classify. The message carries the platform's own text.
-
-
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
-
forName
Resolves a constant by name, total: an unrecognized or
nullname answersUNKNOWNrather than throwing.This exists so the boundary cannot throw.
Enum.valueOfraisesIllegalArgumentExceptionon an unknown name, and the one place this is called is while decoding a failure that has already happened -- so the throw would replace a real error the caller could act on with an unrelated one they cannot. A port from a newer build naming an error this one does not have degrades toUNKNOWNwith the platform text intact.Parameters
name: theEnum.name()of a constant, ornull
Returns
the matching constant, or
UNKNOWN
-