dontinelli / fyta-custom_component

Home Assistant integration for FYTA plant sensors, configured as custom component
GNU General Public License v3.0
11 stars 1 forks source link

Unexpected error fetching FYTA Coordinator data: cannot access local variable 'msg' where it is not associated with a value #18

Closed resterampeberlin closed 7 months ago

resterampeberlin commented 7 months ago

System Health details

See #17

Checklist

Describe the issue

This exception occurs randomly.

Reproduction steps

Occurs randomly

Debug logs

2024-03-26 01:23:56.167 ERROR (MainThread) [custom_components.fyta.coordinator] Unexpected error fetching FYTA Coordinator data: cannot access local variable 'msg' where it is not associated with a value
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fyta/coordinator.py", line 46, in _async_update_data
    data = await self.fyta.update_all_plants()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 70, in update_all_plants
    plant_list = await self.update_plant_list()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 61, in update_plant_list
    self.plant_list = await self.client.get_plants()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_client.py", line 122, in get_plants
    msg,
    ^^^
UnboundLocalError: cannot access local variable 'msg' where it is not associated with a value

Diagnostics dump

No response

resterampeberlin commented 7 months ago

This exception occurs independently from #17, see the log below: 2024-03-25 11:42:28.976 ERROR (MainThread) [custom_components.fyta.coordinator] Unexpected error fetching FYTA Coordinator data: 'plant' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fyta/coordinator.py", line 46, in _async_update_data data = await self.fyta.update_all_plants() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 73, in update_all_plants current_plant = await self.update_plant_data(plant) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 85, in update_plant_data plant_data: dict = p["plant"] ~^^^^^^^^^ KeyError: 'plant' 2024-03-25 19:51:30.301 ERROR (MainThread) [custom_components.fyta.coordinator] Unexpected error fetching FYTA Coordinator data: 'plant' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fyta/coordinator.py", line 46, in _async_update_data data = await self.fyta.update_all_plants() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 73, in update_all_plants current_plant = await self.update_plant_data(plant) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 85, in update_plant_data plant_data: dict = p["plant"] ~^^^^^^^^^ KeyError: 'plant' 2024-03-26 01:23:56.167 ERROR (MainThread) [custom_components.fyta.coordinator] Unexpected error fetching FYTA Coordinator data: cannot access local variable 'msg' where it is not associated with a value Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fyta/coordinator.py", line 46, in _async_update_data data = await self.fyta.update_all_plants() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 70, in update_all_plants plant_list = await self.update_plant_list() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_connector.py", line 61, in update_plant_list self.plant_list = await self.client.get_plants() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/fyta_cli/fyta_client.py", line 122, in get_plants msg, ^^^ UnboundLocalError: cannot access local variable 'msg' where it is not associated with a value