hass_openwrt
hass_openwrt copied to clipboard
fix object not found
This fixes the following two issues, most likely occurring due to WIFI interfaces with no clients.
Traceback (most recent call last):
File "/config/custom_components/openwrt/coordinator.py", line 300, in async_update_data
result['wireless'] = await self.update_ap(wireless_config['ap'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwrt/coordinator.py", line 227, in update_ap
result[item['ifname']] = await self.update_hostapd_clients(item['ifname'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwrt/coordinator.py", line 131, in update_hostapd_clients
for key, value in response['clients'].items():
~~~~~~~~^^^^^^^^^^^
KeyError: 'clients'
Traceback (most recent call last):
File "/config/custom_components/openwrt/coordinator.py", line 300, in async_update_data
result['wireless'] = await self.update_ap(wireless_config['ap'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwrt/coordinator.py", line 227, in update_ap
result[item['ifname']] = await self.update_hostapd_clients(item['ifname'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwrt/coordinator.py", line 125, in update_hostapd_clients
response = await self._ubus.api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwrt/ubus.py", line 41, in api_call
return await self._api_call(rpc_method, subsystem, method, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwrt/ubus.py", line 109, in _api_call
raise NameError(message)
NameError: Object not found
This will most likely fix: #24