Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.homekit.accessories.HomeAccessory Class Reference
Inheritance diagram for homeassistant.components.homekit.accessories.HomeAccessory:
[legend]
Collaboration diagram for homeassistant.components.homekit.accessories.HomeAccessory:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, HomeDriver driver, str name, str entity_id, int aid, dict[str, Any] config, *Any args, int category=CATEGORY_OTHER, str|None device_id=None, **Any kwargs)
 
None async_call_service (self, str domain, str service, dict[str, Any]|None service_data, Any|None value=None)
 
None async_reload (self)
 
None async_stop (self)
 
None async_update_battery (self, Any battery_level, Any battery_charging)
 
None async_update_event_state_callback (self, Event[EventStateChangedData] event)
 
None async_update_linked_battery_callback (self, Event[EventStateChangedData] event)
 
None async_update_linked_battery_charging_callback (self, Event[EventStateChangedData] event)
 
None async_update_state (self, State new_state)
 
None async_update_state_callback (self, State|None new_state)
 
bool available (self)
 
None run (self)
 
None stop (self)
 

Public Attributes

 category
 
 config
 
 device_id
 
 entity_id
 
 hass
 
 linked_battery_charging_sensor
 
 linked_battery_sensor
 
 low_battery_threshold
 

Private Member Functions

None _update_available_from_state (self, State|None new_state)
 

Private Attributes

 _available
 
 _char_battery
 
 _char_charging
 
 _char_low_battery
 
 _reload_on_change_attrs
 

Detailed Description

Adapter class for Accessory.

Definition at line 283 of file accessories.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.homekit.accessories.HomeAccessory.__init__ (   self,
HomeAssistant  hass,
HomeDriver  driver,
str  name,
str  entity_id,
int  aid,
dict[str, Any]  config,
*Any  args,
int   category = CATEGORY_OTHER,
str | None   device_id = None,
**Any  kwargs 
)
Initialize a Accessory object.

Definition at line 288 of file accessories.py.

Member Function Documentation

◆ _update_available_from_state()

None homeassistant.components.homekit.accessories.HomeAccessory._update_available_from_state (   self,
State | None  new_state 
)
private
Update the available property based on the state.

Definition at line 425 of file accessories.py.

◆ async_call_service()

None homeassistant.components.homekit.accessories.HomeAccessory.async_call_service (   self,
str  domain,
str  service,
dict[str, Any] | None  service_data,
Any | None   value = None 
)
Fire event and call service for changes from HomeKit.

Definition at line 603 of file accessories.py.

◆ async_reload()

None homeassistant.components.homekit.accessories.HomeAccessory.async_reload (   self)
Reload and recreate an accessory and update the c# value in the mDNS record.

Definition at line 628 of file accessories.py.

◆ async_stop()

None homeassistant.components.homekit.accessories.HomeAccessory.async_stop (   self)
Cancel any subscriptions when the bridge is stopped.

Reimplemented in homeassistant.components.homekit.type_triggers.DeviceTriggerAccessory, and homeassistant.components.homekit.type_cameras.Camera.

Definition at line 637 of file accessories.py.

◆ async_update_battery()

None homeassistant.components.homekit.accessories.HomeAccessory.async_update_battery (   self,
Any  battery_level,
Any  battery_charging 
)
Update battery service if available.

Only call this function if self._support_battery_level is True.

Definition at line 563 of file accessories.py.

◆ async_update_event_state_callback()

None homeassistant.components.homekit.accessories.HomeAccessory.async_update_event_state_callback (   self,
Event[EventStateChangedData]   event 
)
Handle state change event listener callback.

Definition at line 489 of file accessories.py.

◆ async_update_linked_battery_callback()

None homeassistant.components.homekit.accessories.HomeAccessory.async_update_linked_battery_callback (   self,
Event[EventStateChangedData]   event 
)
Handle linked battery sensor state change listener callback.

Definition at line 541 of file accessories.py.

◆ async_update_linked_battery_charging_callback()

None homeassistant.components.homekit.accessories.HomeAccessory.async_update_linked_battery_charging_callback (   self,
Event[EventStateChangedData]   event 
)
Handle linked battery charging sensor state change listener callback.

Definition at line 554 of file accessories.py.

◆ async_update_state()

None homeassistant.components.homekit.accessories.HomeAccessory.async_update_state (   self,
State  new_state 
)
Handle state change to update HomeKit value.

Overridden by accessory types.

Reimplemented in homeassistant.components.homekit.type_thermostats.WaterHeater, homeassistant.components.homekit.type_thermostats.Thermostat, homeassistant.components.homekit.type_switches.SelectSwitch, homeassistant.components.homekit.type_switches.ValveBase, homeassistant.components.homekit.type_switches.Vacuum, homeassistant.components.homekit.type_switches.Switch, homeassistant.components.homekit.type_switches.Outlet, homeassistant.components.homekit.type_sensors.BinarySensor, homeassistant.components.homekit.type_sensors.LightSensor, homeassistant.components.homekit.type_sensors.CarbonDioxideSensor, homeassistant.components.homekit.type_sensors.CarbonMonoxideSensor, homeassistant.components.homekit.type_sensors.VolatileOrganicCompoundsSensor, homeassistant.components.homekit.type_sensors.NitrogenDioxideSensor, homeassistant.components.homekit.type_sensors.PM25Sensor, homeassistant.components.homekit.type_sensors.PM10Sensor, homeassistant.components.homekit.type_sensors.AirQualitySensor, homeassistant.components.homekit.type_sensors.HumiditySensor, homeassistant.components.homekit.type_sensors.TemperatureSensor, homeassistant.components.homekit.type_security_systems.SecuritySystem, homeassistant.components.homekit.type_remotes.ActivityRemote, homeassistant.components.homekit.type_media_players.TelevisionMediaPlayer, homeassistant.components.homekit.type_media_players.MediaPlayer, homeassistant.components.homekit.type_locks.Lock, homeassistant.components.homekit.type_lights.Light, homeassistant.components.homekit.type_humidifiers.HumidifierDehumidifier, homeassistant.components.homekit.type_fans.Fan, homeassistant.components.homekit.type_covers.WindowCoveringBasic, homeassistant.components.homekit.type_covers.OpeningDevice, homeassistant.components.homekit.type_covers.OpeningDeviceBase, and homeassistant.components.homekit.type_covers.GarageDoorOpener.

Definition at line 595 of file accessories.py.

◆ async_update_state_callback()

None homeassistant.components.homekit.accessories.HomeAccessory.async_update_state_callback (   self,
State | None  new_state 
)
Handle state change listener callback.

Definition at line 517 of file accessories.py.

◆ available()

bool homeassistant.components.homekit.accessories.HomeAccessory.available (   self)
Return if accessory is available.

Reimplemented in homeassistant.components.homekit.type_triggers.DeviceTriggerAccessory.

Definition at line 430 of file accessories.py.

◆ run()

◆ stop()

None homeassistant.components.homekit.accessories.HomeAccessory.stop (   self)
Stop the accessory.

This is overrides the parent class to call async_stop
since pyhap will call this function to stop the accessory
but we want to use our async_stop method since we need
it to be a callback to avoid races in reloading accessories.

Definition at line 642 of file accessories.py.

Member Data Documentation

◆ _available

homeassistant.components.homekit.accessories.HomeAccessory._available
private

Definition at line 427 of file accessories.py.

◆ _char_battery

homeassistant.components.homekit.accessories.HomeAccessory._char_battery
private

Definition at line 369 of file accessories.py.

◆ _char_charging

homeassistant.components.homekit.accessories.HomeAccessory._char_charging
private

Definition at line 370 of file accessories.py.

◆ _char_low_battery

homeassistant.components.homekit.accessories.HomeAccessory._char_low_battery
private

Definition at line 371 of file accessories.py.

◆ _reload_on_change_attrs

homeassistant.components.homekit.accessories.HomeAccessory._reload_on_change_attrs
private

Definition at line 310 of file accessories.py.

◆ category

homeassistant.components.homekit.accessories.HomeAccessory.category

Definition at line 361 of file accessories.py.

◆ config

homeassistant.components.homekit.accessories.HomeAccessory.config

Definition at line 311 of file accessories.py.

◆ device_id

homeassistant.components.homekit.accessories.HomeAccessory.device_id

Definition at line 317 of file accessories.py.

◆ entity_id

homeassistant.components.homekit.accessories.HomeAccessory.entity_id

Definition at line 362 of file accessories.py.

◆ hass

homeassistant.components.homekit.accessories.HomeAccessory.hass

Definition at line 363 of file accessories.py.

◆ linked_battery_charging_sensor

homeassistant.components.homekit.accessories.HomeAccessory.linked_battery_charging_sensor

Definition at line 373 of file accessories.py.

◆ linked_battery_sensor

homeassistant.components.homekit.accessories.HomeAccessory.linked_battery_sensor

Definition at line 372 of file accessories.py.

◆ low_battery_threshold

homeassistant.components.homekit.accessories.HomeAccessory.low_battery_threshold

Definition at line 376 of file accessories.py.


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