Skip to content

Commit 8072103

Browse files
authored
Fix crash when wifi interface is down
Fix #29
1 parent 8eb8a37 commit 8072103

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

custom_components/openwrt/coordinator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ async def discover_wireless(self) -> dict:
5454
if item.get('disabled', False):
5555
continue
5656
for iface in item['interfaces']:
57+
if 'ifname' not in iface:
58+
continue
5759
conf = dict(ifname=iface['ifname'],
5860
network=iface['config']['network'][0])
5961
if iface['config']['mode'] == 'ap':
@@ -326,4 +328,4 @@ def new_coordinator(hass, config: dict, all_devices: dict) -> DeviceCoordinator:
326328
_LOGGER.debug(f"new_coordinator: {config}, {all_devices}")
327329
connection = new_ubus_client(hass, config)
328330
device = DeviceCoordinator(hass, config, connection, all_devices)
329-
return device
331+
return device

0 commit comments

Comments
 (0)