yo-han / Home-Assistant-Carelink

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

Integration error with 2023.12.1 #53

Closed nightfever77 closed 4 months ago

nightfever77 commented 4 months ago

Updated to the new 2023.12.1 and followed the instructions: created a follower account, logged in and copied and pasted temp auth token. Debug shows the following: (time zone UTC+1)

2023-12-28 14:10:46.911 DEBUG (MainThread) [custom_components.carelink.api] Carelink country: at 2023-12-28 14:10:46.911 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: Initial token expires in 1954s (Thu Dec 28 13:43:21 UTC 2023) 2023-12-28 14:10:46.927 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_my_user() 2023-12-28 14:10:46.927 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:47.339 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_my_profile() 2023-12-28 14:10:47.339 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:47.492 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_country_settings() 2023-12-28 14:10:47.492 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:47.676 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_monitor_data() 2023-12-28 14:10:47.676 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:47.868 DEBUG (MainThread) [custom_components.carelink.api] Carelink country: at 2023-12-28 14:10:47.868 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: Initial token expires in 1953s (Thu Dec 28 13:43:21 UTC 2023) 2023-12-28 14:10:47.883 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_my_user() 2023-12-28 14:10:47.883 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:48.073 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_my_profile() 2023-12-28 14:10:48.073 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:48.304 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_country_settings() 2023-12-28 14:10:48.304 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:48.471 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_monitor_data() 2023-12-28 14:10:48.471 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:48.640 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_connect_display_message() 2023-12-28 14:10:48.640 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() 2023-12-28 14:10:48.790 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: 400 2023-12-28 14:10:48.790 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: get_data() failed: exception __get_data() session get response is not OK400 2023-12-28 14:10:48.790 DEBUG (MainThread) [custom_components.carelink] Using timezone Europe/Vienna 2023-12-28 14:10:48.791 DEBUG (MainThread) [custom_components.carelink] Using timezone Europe/Vienna 2023-12-28 14:10:48.791 ERROR (MainThread) [custom_components.carelink] 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 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/carelink/init__.py", line 172, in _async_update_data recent_data["lastSG"] = recent_data.setdefault("lastSG", {}) ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'setdefault' 2023-12-28 14:10:48.795 DEBUG (MainThread) [custom_components.carelink] Finished fetching carelink data in 0.927 seconds (success: False)

sedy89 commented 4 months ago

I think the only time I had such an issue was when I did not provide the patients account.. or you don't have permission to read. You need to create a new follower account and request to read data from the patient. And add the patient's username to the initial integration of the addon.

Sure, you probably might have done all the steps, but since you have a valid token, this is the only thing I can think of.

And you can ignore the 'setdefault' warnings/error... they are (only) follow up issues and need to be improved separately.

nightfever77 commented 4 months ago

I did request and grant to read the patient data but did not put in the patient's username as it was meant to be optional. Will try that, thanks for the hint

nightfever77 commented 4 months ago

It worked by typing in the optional patient id.