Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.device Namespace Reference

Functions

dr.DeviceInfo|None async_device_info_to_link_from_device_id (HomeAssistant hass, str|None device_id)
 
dr.DeviceInfo|None async_device_info_to_link_from_entity (HomeAssistant hass, str entity_id_or_uuid)
 
str|None async_entity_id_to_device_id (HomeAssistant hass, str entity_id_or_uuid)
 
None async_remove_stale_devices_links_keep_current_device (HomeAssistant hass, str entry_id, str|None current_device_id)
 
None async_remove_stale_devices_links_keep_entity_device (HomeAssistant hass, str entry_id, str source_entity_id_or_uuid)
 

Detailed Description

Provides useful helpers for handling devices.

Function Documentation

◆ async_device_info_to_link_from_device_id()

dr.DeviceInfo | None homeassistant.helpers.device.async_device_info_to_link_from_device_id ( HomeAssistant  hass,
str | None  device_id 
)
DeviceInfo with information to link a device from a device id.

DeviceInfo will only return information to categorize as a link.

Definition at line 41 of file device.py.

◆ async_device_info_to_link_from_entity()

dr.DeviceInfo | None homeassistant.helpers.device.async_device_info_to_link_from_entity ( HomeAssistant  hass,
str  entity_id_or_uuid 
)
DeviceInfo with information to link a device from an entity.

DeviceInfo will only return information to categorize as a link.

Definition at line 25 of file device.py.

◆ async_entity_id_to_device_id()

str | None homeassistant.helpers.device.async_entity_id_to_device_id ( HomeAssistant  hass,
str  entity_id_or_uuid 
)
Resolve the device id to the entity id or entity uuid.

Definition at line 9 of file device.py.

◆ async_remove_stale_devices_links_keep_current_device()

None homeassistant.helpers.device.async_remove_stale_devices_links_keep_current_device ( HomeAssistant  hass,
str  entry_id,
str | None  current_device_id 
)
Remove the link between stale devices and a configuration entry.

Only the device passed in the current_device_id parameter linked to
the configuration entry will be maintained.

Definition at line 81 of file device.py.

◆ async_remove_stale_devices_links_keep_entity_device()

None homeassistant.helpers.device.async_remove_stale_devices_links_keep_entity_device ( HomeAssistant  hass,
str  entry_id,
str  source_entity_id_or_uuid 
)
Remove the link between stale devices and a configuration entry.

Only the device passed in the source_entity_id_or_uuid parameter
linked to the configuration entry will be maintained.

Definition at line 62 of file device.py.