yo-han / Home-Assistant-Carelink

Unofficial Home Assistant Carelink Component
MIT License
19 stars 8 forks source link

No devices or entities/ Cannot access local variable 'timezone_map' #43

Closed KobeNuyts closed 8 months ago

KobeNuyts commented 10 months ago

When I log in, it says no devices or entities, and it gives an error Cannot access local variable 'timezone_map' where it is not associated with a value

my logs:

Logger: custom_components.carelink Source: custom_components/carelink/init.py:167 Integration: carelink First occurred: 18:36:35 (16 occurrences) Last logged: 18:49:42 Unexpected error fetching carelink data: cannot access local variable 'timezone_map' where it is not associated with a value

Traceback (most recent call last): File "/config/custom_components/carelink/init.py", line 152, in _async_update_data if "clientTimeZonseName" in recent_data: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/carelink/init.py", line 167, in _async_update_data "Can not set timezone to %s. The error was: %s", timezone_map, error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnboundLocalError: cannot access local variable 'timezone_map' where it is not associated with a value

yo-han commented 10 months ago

I'm not sure why there are no devices or entities. But the error is triggered by the fact that no data is available. I made a quick fix. You can try to update the integration and see if it helps.

KobeNuyts commented 10 months ago

I updated to the newest version, but it sadly doesn't work... Now I get an error: 'NoneType' object has no attribute 'setdefault'

my logs:

Logger: custom_components.carelink Source: custom_components/carelink/init.py:173 Integration: carelink First occurred: 17:54:32 (9 occurrences) Last logged: 18:01:27

Unexpected error fetching carelink data: 'NoneType' object has no attribute 'setdefault' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/carelink/init.py", line 173, in _async_update_data recent_data["lastSG"] = recent_data.setdefault("lastSG", {}) ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'setdefault'

yo-han commented 9 months ago

The issue occurs because there is not data. Try making a dump from your Carelink account using this tool and post is here. Without it I can only guess what's happening on your end.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 8 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.