Home Assistant Unofficial Reference 2024.12.1
names.py
Go to the documentation of this file.
1 """Functions to generate names for devices and entities."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 
5 
6 def sam_device_uid(entry: ConfigEntry) -> str:
7  """Return the UID for the SAM device."""
8  return entry.entry_id
9 
10 
11 def system_device_uid(sam_uid: str, system_id: int) -> str:
12  """Return the UID for a given system (e.g., 1) under a SAM."""
13  return f"{sam_uid}-S{system_id}"
14 
15 
16 def zone_entity_uid(sam_uid: str, system_id: int, zone_id: int) -> str:
17  """Return the UID for a given system and zone (e.g., 1 and 2) under a SAM."""
18  return f"{sam_uid}-S{system_id}-Z{zone_id}"
str system_device_uid(str sam_uid, int system_id)
Definition: names.py:11
str sam_device_uid(ConfigEntry entry)
Definition: names.py:6
str zone_entity_uid(str sam_uid, int system_id, int zone_id)
Definition: names.py:16