mirror of
https://github.com/home-assistant/core
synced 2024-08-28 03:36:46 +02: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
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
def unique_id(self) -> str | None:
|
||||
"""Return the unique ID (serial number) of this device."""
|
||||
assert (unique_id := self.config_entry.unique_id)
|
||||
return unique_id
|
||||
return self.config_entry.unique_id
|
||||
|
||||
# Options
|
||||
|
||||
@ -176,8 +175,8 @@ class AxisNetworkDevice:
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=self.config_entry.entry_id,
|
||||
configuration_url=self.api.config.url,
|
||||
connections={(CONNECTION_NETWORK_MAC, self.unique_id)},
|
||||
identifiers={(AXIS_DOMAIN, self.unique_id)},
|
||||
connections={(CONNECTION_NETWORK_MAC, self.unique_id)}, # type: ignore[arg-type]
|
||||
identifiers={(AXIS_DOMAIN, self.unique_id)}, # type: ignore[arg-type]
|
||||
manufacturer=ATTR_MANUFACTURER,
|
||||
model=f"{self.model} {self.product_type}",
|
||||
name=self.name,
|
||||
|
@ -42,7 +42,7 @@ class AxisEntity(Entity):
|
||||
self.device = device
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user