mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Prefer mac for onvif device identifier (#38864)
This commit is contained in:
parent
96a1c80626
commit
8500e3c5a8
@ -28,17 +28,17 @@ class ONVIFBaseEntity(Entity):
|
||||
"model": self.device.info.model,
|
||||
"name": self.device.name,
|
||||
"sw_version": self.device.info.fw_version,
|
||||
"identifiers": {
|
||||
# MAC address is not always available, and given the number
|
||||
# of non-conformant ONVIF devices we have historically supported,
|
||||
# we can not guarantee serial number either. Due to this, we have
|
||||
# adopted an either/or approach in the config entry setup, and can
|
||||
# guarantee that one or the other will be populated.
|
||||
# See: https://github.com/home-assistant/core/issues/35883
|
||||
(DOMAIN, self.device.info.mac or self.device.info.serial_number)
|
||||
},
|
||||
}
|
||||
|
||||
# MAC address is not always available, and given the number
|
||||
# of non-conformant ONVIF devices we have historically supported,
|
||||
# we can not guarantee serial number either. Due to this, we have
|
||||
# adopted an either/or approach in the config entry setup, and can
|
||||
# guarantee that one or the other will be populated.
|
||||
# See: https://github.com/home-assistant/core/issues/35883
|
||||
if self.device.info.serial_number:
|
||||
device_info["identifiers"] = {(DOMAIN, self.device.info.serial_number)}
|
||||
|
||||
if self.device.info.mac:
|
||||
device_info["connections"] = {
|
||||
(CONNECTION_NETWORK_MAC, self.device.info.mac)
|
||||
|
Loading…
x
Reference in New Issue
Block a user