mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix Method GetNetworkInterfaces not implemented (#36243)
This commit is contained in:
parent
a7a58b9eac
commit
0e2e39a5f2
@ -205,10 +205,20 @@ class OnvifFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
# Get the MAC address to use as the unique ID for the config flow
|
# Get the MAC address to use as the unique ID for the config flow
|
||||||
if not self.device_id:
|
if not self.device_id:
|
||||||
network_interfaces = await device_mgmt.GetNetworkInterfaces()
|
try:
|
||||||
for interface in network_interfaces:
|
network_interfaces = await device_mgmt.GetNetworkInterfaces()
|
||||||
if interface.Enabled:
|
for interface in network_interfaces:
|
||||||
self.device_id = interface.Info.HwAddress
|
if interface.Enabled:
|
||||||
|
self.device_id = interface.Info.HwAddress
|
||||||
|
except Fault as fault:
|
||||||
|
if "not implemented" not in fault.message:
|
||||||
|
raise fault
|
||||||
|
|
||||||
|
LOGGER.debug(
|
||||||
|
"Couldn't get network interfaces from ONVIF deivice '%s'. Error: %s",
|
||||||
|
self.onvif_config[CONF_NAME],
|
||||||
|
fault,
|
||||||
|
)
|
||||||
|
|
||||||
# If no network interfaces are exposed, fallback to serial number
|
# If no network interfaces are exposed, fallback to serial number
|
||||||
if not self.device_id:
|
if not self.device_id:
|
||||||
|
@ -217,10 +217,20 @@ class ONVIFDevice:
|
|||||||
|
|
||||||
# Grab the last MAC address for backwards compatibility
|
# Grab the last MAC address for backwards compatibility
|
||||||
mac = None
|
mac = None
|
||||||
network_interfaces = await device_mgmt.GetNetworkInterfaces()
|
try:
|
||||||
for interface in network_interfaces:
|
network_interfaces = await device_mgmt.GetNetworkInterfaces()
|
||||||
if interface.Enabled:
|
for interface in network_interfaces:
|
||||||
mac = interface.Info.HwAddress
|
if interface.Enabled:
|
||||||
|
mac = interface.Info.HwAddress
|
||||||
|
except Fault as fault:
|
||||||
|
if "not implemented" not in fault.message:
|
||||||
|
raise fault
|
||||||
|
|
||||||
|
LOGGER.debug(
|
||||||
|
"Couldn't get network interfaces from ONVIF deivice '%s'. Error: %s",
|
||||||
|
self.name,
|
||||||
|
fault,
|
||||||
|
)
|
||||||
|
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
device_info.Manufacturer,
|
device_info.Manufacturer,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user