Package apple.homekit

Class HMHome

  • All Implemented Interfaces:
    NSObject

    public class HMHome
    extends NSObject
    Represents a home. This class represents a home and is the entry point to communicate and configure different accessories in the home. This is also used to manage all the rooms, zones, service groups, users, triggers, and action sets in the home. API-Since: 8.0
    • Constructor Detail

      • HMHome

        protected HMHome​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • alloc

        public static HMHome alloc()
      • allocWithZone

        public static HMHome allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • new_objc

        public static HMHome new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • accessories

        @NotNull
        public @NotNull NSArray<? extends HMAccessory> accessories()
        Array of HMAccessory objects that represents all accessories added to the home.
      • actionSets

        @NotNull
        public @NotNull NSArray<? extends HMActionSet> actionSets()
        Array of HMActionSet objects that represents all the action sets in the home.
      • addAccessoryCompletionHandler

        public void addAccessoryCompletionHandler​(@NotNull
                                                  @NotNull HMAccessory accessory,
                                                  @NotNull
                                                  @NotNull HMHome.Block_addAccessoryCompletionHandler completion)
        Adds a new accessory to the home.
        Parameters:
        accessory - Accessory to add to the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • addActionSetWithNameCompletionHandler

        public void addActionSetWithNameCompletionHandler​(@NotNull
                                                          @NotNull java.lang.String actionSetName,
                                                          @NotNull
                                                          @NotNull HMHome.Block_addActionSetWithNameCompletionHandler completion)
        Adds a new action set to the home.
        Parameters:
        actionSetName - Name of the action set to add to the home.
        completion - Block that is invoked once the request is processed. The HMActionSet parameter is the new action set added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addAndSetupAccessoriesWithCompletionHandler

        @Deprecated
        public void addAndSetupAccessoriesWithCompletionHandler​(@NotNull
                                                                @NotNull HMHome.Block_addAndSetupAccessoriesWithCompletionHandler completion)
        Deprecated.
        Find nearby accessories and add them to the home. During this process, each of the accessories added to the home is assigned to a room and its services are configured.
        Parameters:
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success. API-Since: 10.0 Deprecated-Since: 15.4 Deprecated-Message: Use -[HMAccessorySetupManager performAccessorySetupUsingRequest:completionHandler:] instead
      • addRoomWithNameCompletionHandler

        public void addRoomWithNameCompletionHandler​(@NotNull
                                                     @NotNull java.lang.String roomName,
                                                     @NotNull
                                                     @NotNull HMHome.Block_addRoomWithNameCompletionHandler completion)
        Adds a room to the home.
        Parameters:
        roomName - Name of the room to add to the home.
        completion - Block that is invoked once the request is processed. The HMRoom is the new room added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addServiceGroupWithNameCompletionHandler

        public void addServiceGroupWithNameCompletionHandler​(@NotNull
                                                             @NotNull java.lang.String serviceGroupName,
                                                             @NotNull
                                                             @NotNull HMHome.Block_addServiceGroupWithNameCompletionHandler completion)
        Adds a service group to the home.
        Parameters:
        serviceGroupName - Name of the service group to add to the home.
        completion - Block that is invoked once the request is processed. The HMServiceGroup is the new service group added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addTriggerCompletionHandler

        public void addTriggerCompletionHandler​(@NotNull
                                                @NotNull HMTrigger trigger,
                                                @NotNull
                                                @NotNull HMHome.Block_addTriggerCompletionHandler completion)
        Adds a trigger to the home. Unless the trigger object is added to the home, it cannot be activated. Throws error and will not be added to home if there is no Home Hub associated with the home Triggers are specific to an iOS device and are not synced across multiple devices to ensure that the action sets are executed only once.
        Parameters:
        trigger - Trigger to add to the home.
        completion - Block that is invoked once the request is processed. The HMTrigger parameter is the new trigger added to the home. The NSError provides more information on the status of the request, error will be nil on success. Errors when no Home Hub is associated with the home
      • addUserWithCompletionHandler

        @Deprecated
        public void addUserWithCompletionHandler​(@NotNull
                                                 @NotNull HMHome.Block_addUserWithCompletionHandler completion)
        Deprecated.
        Adds a user to the home.
        Parameters:
        completion - Block that is invoked once the request is processed. The HMUser object provides a reference to the user that was added to the home. The NSError provides more information on the status of the request, error will be nil on success. The userInfo dictionary will contain the HMUserFailedAccessoriesKey which provides more details on the accessories that failed to add the user. API-Since: 8.0 Deprecated-Since: 9.0
      • addZoneWithNameCompletionHandler

        public void addZoneWithNameCompletionHandler​(@NotNull
                                                     @NotNull java.lang.String zoneName,
                                                     @NotNull
                                                     @NotNull HMHome.Block_addZoneWithNameCompletionHandler completion)
        Adds a zone to the home.
        Parameters:
        zoneName - Name of the zone to add to the home.
        completion - Block that is invoked once the request is processed. The HMZone is the new zone added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • assignAccessoryToRoomCompletionHandler

        public void assignAccessoryToRoomCompletionHandler​(@NotNull
                                                           @NotNull HMAccessory accessory,
                                                           @NotNull
                                                           @NotNull HMRoom room,
                                                           @NotNull
                                                           @NotNull HMHome.Block_assignAccessoryToRoomCompletionHandler completion)
        Assigns a new room for the accessory. When an accessory is added to a home, it is automatically assigned the room corresponding to + [HMHome roomForEntireHome]. This method is used to change the room assigned to an accessory.
        Parameters:
        accessory - Accessory whose rooms needs to modified
        room - New room for the accessory.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • builtinActionSetOfType

        @Nullable
        public @Nullable HMActionSet builtinActionSetOfType​(@NotNull
                                                            @NotNull java.lang.String actionSetType)
        Retrieve a built-in action set for the home.
        Parameters:
        actionSetType - Type of the builtin action set. Supported action set types are HMActionSetTypeWakeUp, HMActionSetTypeSleep, HMActionSetTypeHomeDeparture and HMActionSetTypeHomeArrival.
        Returns:
        Reference to the built-in action set corresponding to type argument, nil if no matching action set is found. API-Since: 9.0
      • currentUser

        @NotNull
        public @NotNull HMUser currentUser()
        HMUser object representing the current user of the home. API-Since: 9.0
      • delegate

        @Nullable
        public @Nullable HMHomeDelegate delegate()
        Delegate that receives updates on the state of the home.
      • executeActionSetCompletionHandler

        public void executeActionSetCompletionHandler​(@NotNull
                                                      @NotNull HMActionSet actionSet,
                                                      @NotNull
                                                      @NotNull HMHome.Block_executeActionSetCompletionHandler completion)
        Executes all the actions within an action set.
        Parameters:
        actionSet - Action set to execute.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • homeAccessControlForUser

        @NotNull
        public @NotNull HMHomeAccessControl homeAccessControlForUser​(@NotNull
                                                                     @NotNull HMUser user)
        Retrieve the access level of the user associated with the home. API-Since: 9.0
      • isPrimary

        public boolean isPrimary()
        Specifies whether this home is the primary home.
      • manageUsersWithCompletionHandler

        public void manageUsersWithCompletionHandler​(@NotNull
                                                     @NotNull HMHome.Block_manageUsersWithCompletionHandler completion)
        Presents a view controller to manage users of the home. This API is available only for users that have administrator access to the home.
        Parameters:
        completion - Block that is invoked once user management is completed. The completion block is fired to allow clients to know when the user has dismissed the view. The NSError provides more information on the status of the request, error will be nil on success. If the user does not have administrator privileges the error code will be set to HMErrorCodeInsufficientPrivileges. API-Since: 9.0
      • name

        @NotNull
        public @NotNull java.lang.String name()
        The name of the home.
      • removeAccessoryCompletionHandler

        public void removeAccessoryCompletionHandler​(@NotNull
                                                     @NotNull HMAccessory accessory,
                                                     @NotNull
                                                     @NotNull HMHome.Block_removeAccessoryCompletionHandler completion)
        Removes an accessory from the home.
        Parameters:
        accessory - Accessory to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeActionSetCompletionHandler

        public void removeActionSetCompletionHandler​(@NotNull
                                                     @NotNull HMActionSet actionSet,
                                                     @NotNull
                                                     @NotNull HMHome.Block_removeActionSetCompletionHandler completion)
        Removes an existing action set from the home.
        Parameters:
        actionSet - Action set to remove from the home. A builtin action set cannot be removed.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeRoomCompletionHandler

        public void removeRoomCompletionHandler​(@NotNull
                                                @NotNull HMRoom room,
                                                @NotNull
                                                @NotNull HMHome.Block_removeRoomCompletionHandler completion)
        Removes a room from the home. Any references to this room will be removed from all properties of the home. For example, the room will be removed from the zone. Any accessories associated contained by this room will be moved to the room provided by - [HMHome roomForEntireHome].
        Parameters:
        room - Room to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeServiceGroupCompletionHandler

        public void removeServiceGroupCompletionHandler​(@NotNull
                                                        @NotNull HMServiceGroup group,
                                                        @NotNull
                                                        @NotNull HMHome.Block_removeServiceGroupCompletionHandler completion)
        Removes a service group from the home.
        Parameters:
        group - Service group to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeTriggerCompletionHandler

        public void removeTriggerCompletionHandler​(@NotNull
                                                   @NotNull HMTrigger trigger,
                                                   @NotNull
                                                   @NotNull HMHome.Block_removeTriggerCompletionHandler completion)
        Removes a trigger from the home. If the trigger is active, they are automatically deactivated.
        Parameters:
        trigger - Trigger to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeUserCompletionHandler

        @Deprecated
        public void removeUserCompletionHandler​(@NotNull
                                                @NotNull HMUser user,
                                                @NotNull
                                                @NotNull HMHome.Block_removeUserCompletionHandler completion)
        Deprecated.
        Removes a user from the home.
        Parameters:
        user - HMUser whose access is being revoked.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success. The userInfo dictionary will contain the HMUserFailedAccessoriesKey which provides more details on the accessories that failed to remove the user. API-Since: 8.0 Deprecated-Since: 9.0
      • removeZoneCompletionHandler

        public void removeZoneCompletionHandler​(@NotNull
                                                @NotNull HMZone zone,
                                                @NotNull
                                                @NotNull HMHome.Block_removeZoneCompletionHandler completion)
        Removes a zone from the home.
        Parameters:
        zone - Zone to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • roomForEntireHome

        @NotNull
        public @NotNull HMRoom roomForEntireHome()
        This method returns a room that represents the entire home. This can be used to assign a room to a service that is not necessarily located in one particular room.
        Returns:
        HMRoom that represents the home.
      • rooms

        @NotNull
        public @NotNull NSArray<? extends HMRoom> rooms()
        Array of HMRoom objects that represents all rooms in the home.
      • serviceGroups

        @NotNull
        public @NotNull NSArray<? extends HMServiceGroup> serviceGroups()
        Array of HMServiceGroup objects that represents all service groups in the home.
      • servicesWithTypes

        @Nullable
        public @Nullable NSArray<? extends HMService> servicesWithTypes​(@NotNull
                                                                        @NotNull NSArray<java.lang.String> serviceTypes)
        Queries all services that match the specified types.
        Parameters:
        serviceTypes - Array of NSString objects that specifies the service types to match.
        Returns:
        Array of HMService objects that match the specified service types, nil if no matching services were found.
      • setDelegate_unsafe

        public void setDelegate_unsafe​(@Nullable
                                       @Nullable HMHomeDelegate value)
        Delegate that receives updates on the state of the home.
      • setDelegate

        public void setDelegate​(@Nullable
                                @Nullable HMHomeDelegate value)
        Delegate that receives updates on the state of the home.
      • triggers

        @NotNull
        public @NotNull NSArray<? extends HMTrigger> triggers()
        Array of HMTrigger objects that represents all the triggers in the home.
      • unblockAccessoryCompletionHandler

        public void unblockAccessoryCompletionHandler​(@NotNull
                                                      @NotNull HMAccessory accessory,
                                                      @NotNull
                                                      @NotNull HMHome.Block_unblockAccessoryCompletionHandler completion)
        unblock a blocked accessory. A misbehaving accessory will automatically be blocked. After that all requests to the accessory will fail. This API must be used to explicitly unblock the accessory
        Parameters:
        accessory - accessory to be unblocked
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • uniqueIdentifier

        @NotNull
        public @NotNull NSUUID uniqueIdentifier()
        A unique identifier for the home. API-Since: 9.0
      • updateNameCompletionHandler

        public void updateNameCompletionHandler​(@NotNull
                                                @NotNull java.lang.String name,
                                                @NotNull
                                                @NotNull HMHome.Block_updateNameCompletionHandler completion)
        This method is used to change the name of the home.
        Parameters:
        name - New name for the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • users

        @NotNull
        @Deprecated
        public @NotNull NSArray<? extends HMUser> users()
        Deprecated.
        Array of HMUser objects that represent all users associated with the home. API-Since: 8.0 Deprecated-Since: 9.0 Deprecated-Message: No longer supported.
      • zones

        @NotNull
        public @NotNull NSArray<? extends HMZone> zones()
        Array of HMZone objects that represents all the zones in the home.
      • homeHubState

        public long homeHubState()
        Specifies the state of the home hub. API-Since: 11.0
      • addAndSetupAccessoriesWithPayloadCompletionHandler

        @Deprecated
        public void addAndSetupAccessoriesWithPayloadCompletionHandler​(@NotNull
                                                                       @NotNull HMAccessorySetupPayload payload,
                                                                       @NotNull
                                                                       @NotNull HMHome.Block_addAndSetupAccessoriesWithPayloadCompletionHandler completion)
        Deprecated.
        Add accessory with the given setup payload to the home. [@note] This SPI requires entitlement: com.apple.developer.homekit.allow-setup-payload
        Parameters:
        completion - Block that is invoked once the request is processed. Accessories provides the list of added accessories. The NSError provides more information on the status of the request, error will be nil on success. API-Since: 11.3 Deprecated-Since: 15.0 Deprecated-Message: Use -[HMAccessorySetupManager performAccessorySetupUsingRequest:completionHandler:] instead
      • supportsAddingNetworkRouter

        public boolean supportsAddingNetworkRouter()
        True if this home supports all of the requirements for adding a network router. API-Since: 13.2
      • matterControllerID

        @NotNull
        public @NotNull java.lang.String matterControllerID()
        Identifier of the Matter controller associated with this home. This property can be passed as the first argument to +[MTRDeviceController sharedControllerWithId:xpcConnectBlock:] method to get a MTRDeviceController object. API-Since: 16.1
      • matterControllerXPCConnectBlock

        @NotNull
        public @NotNull HMHome.Block_matterControllerXPCConnectBlock_ret matterControllerXPCConnectBlock()
        Block generating XPC connection on demand through which to access the Matter controller associated with this home. This property can be passed as the second argument to +[MTRDeviceController sharedControllerWithId:xpcConnectBlock:] method to get a MTRDeviceController object. API-Since: 16.1
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.