kvj / hass_openwrt

Home Assistant integration with OpenWrt devices
MIT License
114 stars 20 forks source link

Integration fails to (re-)connect if wifi is disabled #29

Open jabdoa2 opened 4 months ago

jabdoa2 commented 4 months ago

I regularly disable Wifi on some of my access points (via ubus). When HA restarts and Wifi is disabled the extension fails to reconnect those access points. I have to manually reenable Wifi to reconnect them.

Error:

Traceback (most recent call last):
  File "/config/custom_components/openwrt/coordinator.py", line 297, in async_update_data
    wireless_config = await self.discover_wireless()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/openwrt/coordinator.py", line 57, in discover_wireless
    conf = dict(ifname=iface['ifname'],
                       ~~~~~^^^^^^^^^^
KeyError: 'ifname'