mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Remove assert for unique_id (#106910)
* Remove assert for unique_id * Use str | None return instead
This commit is contained in:
parent
1526c321f1
commit
f0d520d91f
@ -101,10 +101,9 @@ class AxisNetworkDevice:
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str | None:
|
||||||
"""Return the unique ID (serial number) of this device."""
|
"""Return the unique ID (serial number) of this device."""
|
||||||
assert (unique_id := self.config_entry.unique_id)
|
return self.config_entry.unique_id
|
||||||
return unique_id
|
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
|
||||||
@ -176,8 +175,8 @@ class AxisNetworkDevice:
|
|||||||
device_registry.async_get_or_create(
|
device_registry.async_get_or_create(
|
||||||
config_entry_id=self.config_entry.entry_id,
|
config_entry_id=self.config_entry.entry_id,
|
||||||
configuration_url=self.api.config.url,
|
configuration_url=self.api.config.url,
|
||||||
connections={(CONNECTION_NETWORK_MAC, self.unique_id)},
|
connections={(CONNECTION_NETWORK_MAC, self.unique_id)}, # type: ignore[arg-type]
|
||||||
identifiers={(AXIS_DOMAIN, self.unique_id)},
|
identifiers={(AXIS_DOMAIN, self.unique_id)}, # type: ignore[arg-type]
|
||||||
manufacturer=ATTR_MANUFACTURER,
|
manufacturer=ATTR_MANUFACTURER,
|
||||||
model=f"{self.model} {self.product_type}",
|
model=f"{self.model} {self.product_type}",
|
||||||
name=self.name,
|
name=self.name,
|
||||||
|
@ -42,7 +42,7 @@ class AxisEntity(Entity):
|
|||||||
self.device = device
|
self.device = device
|
||||||
|
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(AXIS_DOMAIN, device.unique_id)},
|
identifiers={(AXIS_DOMAIN, device.unique_id)}, # type: ignore[arg-type]
|
||||||
serial_number=device.unique_id,
|
serial_number=device.unique_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user