homeassistant.helpers.device_registry module provides a registry to track devices and their associations with config entries.
DeviceRegistry Class
The main class for managing device registration and lookup.Key Methods
async_get
Get a device by device ID.Device ID to retrieve
Device entry or None if not found
async_get_device
Check if device is registered by identifiers or connections.Set of identifier tuples (domain, unique_id)
Set of connection tuples (connection_type, connection_id)
Device entry or None if not found
async_get_or_create
Get device or create if it doesn’t exist.Config entry ID to link device to
Config subentry ID
Device connections (e.g., MAC addresses)
Device identifiers
Device manufacturer
Device model
Device name
Software version
Hardware version
URL for device configuration
Device entry type (e.g., SERVICE)
Identifier of hub device
What disabled the device (if creating)
Device entry (created or existing)
DeviceEntry
Frozen dataclass representing a device registry entry.Properties
Unique device ID
Config entry IDs linked to this device
Subentries per config entry
Device connections (normalized)
Device identifiers
Device manufacturer
Device model
Device model ID
Device name
User-customized device name
Software version
Hardware version
Device serial number
URL for device configuration
Type of device entry
What disabled the device (USER, INTEGRATION, CONFIG_ENTRY)
Area ID where device is located
Labels assigned to device
Device ID of hub device
Primary config entry ID
When device was created
When device was last modified
Methods
Whether the device is disabled
Dictionary representation of the device
DeviceInfo TypedDict
Type definition for device information provided by integrations.Device connections (e.g., MAC addresses)
Unique identifiers for the device
Manufacturer name
Model name
Model identifier
Device name
Software/firmware version
Hardware version
Serial number
URL to configure the device
Suggested area for the device
Type of entry (e.g., SERVICE)
Device identifier of hub device
Connection Types
CONNECTION_BLUETOOTH = "bluetooth"- Bluetooth connectionCONNECTION_NETWORK_MAC = "mac"- MAC address connectionCONNECTION_UPNP = "upnp"- UPnP connectionCONNECTION_ZIGBEE = "zigbee"- Zigbee connection
Events
EVENT_DEVICE_REGISTRY_UPDATED
Fired when a device is created, updated, or removed.Helper Functions
format_mac
Format MAC address string for device registry entry.MAC address in any common format
Normalized MAC address (lowercase with colons)