Home Assistant Unofficial Reference 2024.12.1
util.py
Go to the documentation of this file.
1 """Utilities for deCONZ integration."""
2 
3 from __future__ import annotations
4 
5 
6 def serial_from_unique_id(unique_id: str | None) -> str | None:
7  """Get a device serial number from a unique ID, if possible."""
8  if not unique_id or unique_id.count(":") != 7:
9  return None
10  return unique_id.partition("-")[0]
str|None serial_from_unique_id(str|None unique_id)
Definition: util.py:6