Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.homekit.HomeKit Class Reference

Public Member Functions

None __init__ (self, HomeAssistant hass, str name, int port, str|None ip_address, EntityFilter entity_filter, bool exclude_accessory_mode, dict[str, Any] entity_config, str homekit_mode, list[str] advertise_ips, str entry_id, str entry_title, list[str]|None devices=None)
 
HomeAccessory|None add_bridge_accessory (self, State state)
 
None add_bridge_triggers_accessory (self, dr.DeviceEntry device, list[dict[str, Any]] device_triggers)
 
list[Stateasync_configure_accessories (self)
 
None async_reload_accessories (self, Iterable[str] entity_ids)
 
HomeAccessory|None async_remove_bridge_accessory (self, int aid)
 
None async_reset_accessories (self, Iterable[str] entity_ids)
 
None async_start (self, *Any args)
 
None async_stop (self, *Any args)
 
None async_unpair (self)
 
bool setup (self, AsyncZeroconf async_zeroconf_instance, str uuid)
 

Public Attributes

 aid_storage
 
 bridge
 
 driver
 
 hass
 
 iid_storage
 
 status
 

Private Member Functions

None _async_add_trigger_accessories (self)
 
None _async_configure_linked_sensors (self, er.RegistryEntry ent_reg_ent, dict[tuple[str, str|None], str] lookup, State state)
 
bool _async_create_accessories (self)
 
HomeAccessory _async_create_bridge_accessory (self, Iterable[State] entity_states)
 
HomeAccessory|None _async_create_single_accessory (self, list[State] entity_states)
 
None _async_purge_old_bridges (self, dr.DeviceRegistry dev_reg, tuple[str, str, str] identifier, tuple[str, str] connection)
 
None _async_recreate_removed_accessories_in_bridge_mode (self, list[str] removed)
 
None _async_register_bridge (self)
 
None _async_reload_accessories_in_accessory_mode (self, Iterable[str] entity_ids)
 
None _async_reload_accessories_in_bridge_mode (self, Iterable[str] entity_ids)
 
list[str] _async_remove_accessories_by_entity_id (self, Iterable[str] entity_ids)
 
None _async_reset_accessories_in_bridge_mode (self, Iterable[str] entity_ids)
 
None _async_set_device_info_attributes (self, er.RegistryEntry ent_reg_ent, dr.DeviceRegistry dev_reg, str entity_id)
 
None _async_show_setup_message (self)
 
None _async_shutdown_accessory (self, HomeAccessory accessory)
 
bool _async_update_accessories_hash (self)
 
None _fill_config_from_device_registry_entry (self, dr.DeviceEntry device_entry, dict[str, Any] config)
 
bool _would_exceed_max_devices (self, str|None name)
 

Private Attributes

 _advertise_ips
 
 _cancel_reload_dispatcher
 
 _devices
 
 _entry_id
 
 _entry_title
 
 _exclude_accessory_mode
 
 _filter
 
 _homekit_mode
 
 _ip_address
 
 _name
 
 _port
 
 _reset_lock
 

Detailed Description

Class to handle all actions between HomeKit and Home Assistant.

Definition at line 531 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.homekit.HomeKit.__init__ (   self,
HomeAssistant  hass,
str  name,
int  port,
str | None  ip_address,
EntityFilter  entity_filter,
bool  exclude_accessory_mode,
dict[str, Any]  entity_config,
str  homekit_mode,
list[str]  advertise_ips,
str  entry_id,
str  entry_title,
list[str] | None   devices = None 
)
Initialize a HomeKit object.

Definition at line 534 of file __init__.py.

Member Function Documentation

◆ _async_add_trigger_accessories()

None homeassistant.components.homekit.HomeKit._async_add_trigger_accessories (   self)
private
Add devices with triggers to the bridge.

Definition at line 1021 of file __init__.py.

◆ _async_configure_linked_sensors()

None homeassistant.components.homekit.HomeKit._async_configure_linked_sensors (   self,
er.RegistryEntry  ent_reg_ent,
dict[tuple[str, str | None], str]  lookup,
State  state 
)
private

Definition at line 1093 of file __init__.py.

◆ _async_create_accessories()

bool homeassistant.components.homekit.HomeKit._async_create_accessories (   self)
private
Create the accessories.

Definition at line 1064 of file __init__.py.

◆ _async_create_bridge_accessory()

HomeAccessory homeassistant.components.homekit.HomeKit._async_create_bridge_accessory (   self,
Iterable[State]   entity_states 
)
private
Create a HomeKit bridge with accessories. (bridge mode).

Definition at line 1008 of file __init__.py.

◆ _async_create_single_accessory()

HomeAccessory | None homeassistant.components.homekit.HomeKit._async_create_single_accessory (   self,
list[State]   entity_states 
)
private
Create a single HomeKit accessory (accessory mode).

Definition at line 984 of file __init__.py.

◆ _async_purge_old_bridges()

None homeassistant.components.homekit.HomeKit._async_purge_old_bridges (   self,
dr.DeviceRegistry  dev_reg,
tuple[str, str, str]  identifier,
tuple[str, str]  connection 
)
private
Purge bridges that exist from failed pairing or manual resets.

Definition at line 964 of file __init__.py.

◆ _async_recreate_removed_accessories_in_bridge_mode()

None homeassistant.components.homekit.HomeKit._async_recreate_removed_accessories_in_bridge_mode (   self,
list[str]   removed 
)
private
Recreate removed accessories in bridge mode.

Definition at line 698 of file __init__.py.

◆ _async_register_bridge()

None homeassistant.components.homekit.HomeKit._async_register_bridge (   self)
private
Register the bridge as a device so homekit_controller and exclude it from discovery.

Definition at line 930 of file __init__.py.

◆ _async_reload_accessories_in_accessory_mode()

None homeassistant.components.homekit.HomeKit._async_reload_accessories_in_accessory_mode (   self,
Iterable[str]   entity_ids 
)
private
Reset accessories in accessory mode.

Definition at line 639 of file __init__.py.

◆ _async_reload_accessories_in_bridge_mode()

None homeassistant.components.homekit.HomeKit._async_reload_accessories_in_bridge_mode (   self,
Iterable[str]   entity_ids 
)
private
Reload accessories in bridge mode.

Definition at line 691 of file __init__.py.

◆ _async_remove_accessories_by_entity_id()

list[str] homeassistant.components.homekit.HomeKit._async_remove_accessories_by_entity_id (   self,
Iterable[str]   entity_ids 
)
private
Remove accessories by entity id.

Definition at line 659 of file __init__.py.

◆ _async_reset_accessories_in_bridge_mode()

None homeassistant.components.homekit.HomeKit._async_reset_accessories_in_bridge_mode (   self,
Iterable[str]   entity_ids 
)
private
Reset accessories in bridge mode.

Definition at line 676 of file __init__.py.

◆ _async_set_device_info_attributes()

None homeassistant.components.homekit.HomeKit._async_set_device_info_attributes (   self,
er.RegistryEntry  ent_reg_ent,
dr.DeviceRegistry  dev_reg,
str  entity_id 
)
private
Set attributes that will be used for homekit device info.

Definition at line 1148 of file __init__.py.

◆ _async_show_setup_message()

None homeassistant.components.homekit.HomeKit._async_show_setup_message (   self)
private
Show the pairing setup message.

Definition at line 900 of file __init__.py.

◆ _async_shutdown_accessory()

None homeassistant.components.homekit.HomeKit._async_shutdown_accessory (   self,
HomeAccessory  accessory 
)
private
Shutdown an accessory.

Definition at line 626 of file __init__.py.

◆ _async_update_accessories_hash()

bool homeassistant.components.homekit.HomeKit._async_update_accessories_hash (   self)
private
Update the accessories hash.

Definition at line 713 of file __init__.py.

◆ _fill_config_from_device_registry_entry()

None homeassistant.components.homekit.HomeKit._fill_config_from_device_registry_entry (   self,
dr.DeviceEntry  device_entry,
dict[str, Any]   config 
)
private
Populate a config dict from the registry.

Definition at line 1168 of file __init__.py.

◆ _would_exceed_max_devices()

bool homeassistant.components.homekit.HomeKit._would_exceed_max_devices (   self,
str | None  name 
)
private
Check if adding another devices would reach the limit and log.

Definition at line 768 of file __init__.py.

◆ add_bridge_accessory()

HomeAccessory | None homeassistant.components.homekit.HomeKit.add_bridge_accessory (   self,
State  state 
)
Try adding accessory to bridge if configured beforehand.

Definition at line 729 of file __init__.py.

◆ add_bridge_triggers_accessory()

None homeassistant.components.homekit.HomeKit.add_bridge_triggers_accessory (   self,
dr.DeviceEntry  device,
list[dict[str, Any]]   device_triggers 
)
Add device automation triggers to the bridge.

Definition at line 784 of file __init__.py.

◆ async_configure_accessories()

list[State] homeassistant.components.homekit.HomeKit.async_configure_accessories (   self)
Configure accessories for the included states.

Definition at line 820 of file __init__.py.

◆ async_reload_accessories()

None homeassistant.components.homekit.HomeKit.async_reload_accessories (   self,
Iterable[str]  entity_ids 
)
Reload the accessory to load the latest configuration.

Definition at line 616 of file __init__.py.

◆ async_remove_bridge_accessory()

HomeAccessory | None homeassistant.components.homekit.HomeKit.async_remove_bridge_accessory (   self,
int  aid 
)
Try adding accessory to bridge if configured beforehand.

Definition at line 813 of file __init__.py.

◆ async_reset_accessories()

None homeassistant.components.homekit.HomeKit.async_reset_accessories (   self,
Iterable[str]  entity_ids 
)
Reset the accessory to load the latest configuration.

Definition at line 606 of file __init__.py.

◆ async_start()

None homeassistant.components.homekit.HomeKit.async_start (   self,
*Any  args 
)
Load storage and start.

Definition at line 860 of file __init__.py.

◆ async_stop()

None homeassistant.components.homekit.HomeKit.async_stop (   self,
*Any  args 
)
Stop the accessory driver.

Definition at line 1080 of file __init__.py.

◆ async_unpair()

None homeassistant.components.homekit.HomeKit.async_unpair (   self)
Remove all pairings for an accessory so it can be repaired.

Definition at line 913 of file __init__.py.

◆ setup()

bool homeassistant.components.homekit.HomeKit.setup (   self,
AsyncZeroconf  async_zeroconf_instance,
str  uuid 
)
Set up bridge and accessory driver.

Returns True if data was loaded from disk

Returns False if the persistent data was not loaded

Definition at line 572 of file __init__.py.

Member Data Documentation

◆ _advertise_ips

homeassistant.components.homekit.HomeKit._advertise_ips
private

Definition at line 559 of file __init__.py.

◆ _cancel_reload_dispatcher

homeassistant.components.homekit.HomeKit._cancel_reload_dispatcher
private

Definition at line 865 of file __init__.py.

◆ _devices

homeassistant.components.homekit.HomeKit._devices
private

Definition at line 563 of file __init__.py.

◆ _entry_id

homeassistant.components.homekit.HomeKit._entry_id
private

Definition at line 560 of file __init__.py.

◆ _entry_title

homeassistant.components.homekit.HomeKit._entry_title
private

Definition at line 561 of file __init__.py.

◆ _exclude_accessory_mode

homeassistant.components.homekit.HomeKit._exclude_accessory_mode
private

Definition at line 558 of file __init__.py.

◆ _filter

homeassistant.components.homekit.HomeKit._filter
private

Definition at line 554 of file __init__.py.

◆ _homekit_mode

homeassistant.components.homekit.HomeKit._homekit_mode
private

Definition at line 562 of file __init__.py.

◆ _ip_address

homeassistant.components.homekit.HomeKit._ip_address
private

Definition at line 553 of file __init__.py.

◆ _name

homeassistant.components.homekit.HomeKit._name
private

Definition at line 551 of file __init__.py.

◆ _port

homeassistant.components.homekit.HomeKit._port
private

Definition at line 552 of file __init__.py.

◆ _reset_lock

homeassistant.components.homekit.HomeKit._reset_lock
private

Definition at line 569 of file __init__.py.

◆ aid_storage

homeassistant.components.homekit.HomeKit.aid_storage

Definition at line 872 of file __init__.py.

◆ bridge

homeassistant.components.homekit.HomeKit.bridge

Definition at line 1014 of file __init__.py.

◆ driver

homeassistant.components.homekit.HomeKit.driver

Definition at line 581 of file __init__.py.

◆ hass

homeassistant.components.homekit.HomeKit.hass

Definition at line 550 of file __init__.py.

◆ iid_storage

homeassistant.components.homekit.HomeKit.iid_storage

Definition at line 873 of file __init__.py.

◆ status

homeassistant.components.homekit.HomeKit.status

Definition at line 566 of file __init__.py.


The documentation for this class was generated from the following file: