yo-han / Home-Assistant-Carelink

Unofficial Home Assistant Carelink Component
MIT License
24 stars 12 forks source link

exception __get_data() session get response is not OK204 #82

Open milekrisz opened 7 months ago

milekrisz commented 7 months ago

Dear Yo-ha! Thank you for your work! I have a little issue. The new integration (2024.3.1) working fine, but no data is received. I tried to write the optional PatientID, too. The oldiest integration (2024.1.0) brought the informations.

The debug log:

2024-04-25 18:04:04.135 WARNING (SyncWorker_6) [homeassistant.loader] We found a custom integration carelink which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-04-25 18:04:20.299 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __execute_init_procedure()
2024-04-25 18:04:20.299 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _process_token_file()
2024-04-25 18:04:20.302 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-04-25 18:04:20.302 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_config_settings()
2024-04-25 18:04:21.377 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: User region: EU
2024-04-25 18:04:21.466 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_my_user()
2024-04-25 18:04:21.467 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_data()
2024-04-25 18:04:21.467 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __handle_authorization_token()
2024-04-25 18:04:21.467 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-04-25 18:04:21.586 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __getPatients()
2024-04-25 18:04:21.586 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_data()
2024-04-25 18:04:21.586 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __handle_authorization_token()
2024-04-25 18:04:21.586 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: Found patient **redacted** (**redacted**)
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __handle_authorization_token()
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_connect_display_message()
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_data()
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __handle_authorization_token()
2024-04-25 18:04:21.637 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-04-25 18:04:21.740 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_data() failed: exception __get_data() session get response is not OK204
2024-04-25 18:04:21.741 DEBUG (MainThread) [custom_components.carelink] Using timezone Europe/Budapest
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] Using timezone Europe/Budapest
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] the marker with type 'MEAL' could not be tracked correctly. Check if your Carelink data contains a key with the name list index out of range, it seems to be missing.
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] the marker with type 'INSULIN' could not be tracked correctly. Check if your Carelink data contains a key with the name list index out of range, it seems to be missing.
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] the marker with type 'AUTO_BASAL_DELIVERY' could not be tracked correctly. Check if your Carelink data contains a key with the name list index out of range, it seems to be missing.
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] the marker with type 'AUTO_MODE_STATUS' could not be tracked correctly. Check if your Carelink data contains a key with the name list index out of range, it seems to be missing.
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] the marker with type 'LOW_GLUCOSE_SUSPENDED' could not be tracked correctly. Check if your Carelink data contains a key with the name list index out of range, it seems to be missing.
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] _async_update_data: {'client_timezone': zoneinfo.ZoneInfo(key='Europe/Budapest'), 'pump_battery_level': None, 'conduit_battery_status': None, 'sensor_battery_level': None, 'sensor_duration_hours': None, 'sensor_duration_minutes': None, 'reservoir_level': None, 'reservoir_amount': None, 'reservoir_remaining_units': None, 'last_sg_trend': None, 'time_to_next_calib_hours': None, 'active_insulin': None, 'active_insulin_attributes': {}, 'last_alarm': None, 'last_alarm_attributes': {}, 'active_basal_pattern': None, 'average_glucose_level_mgdl': None, 'below_hypo_limit': None, 'above_hyper_limit': None, 'time_in_range': None, 'max_auto_basal_rate': None, 'sg_below_limit': None, 'last_marker_meal': None, 'last_marker_insulin': None, 'last_marker_auto_basal_delivery': None, 'last_marker_auto_mode_status': None, 'last_marker_low_glucose_suspend': None, 'binary_sensor_pump_comm_state': None, 'binary_sensor_sensor_comm_state': None, 'binary_sensor_conduit_in_range': None, 'binary_sensor_conduit_pump_in_range': None, 'binary_sensor_conduit_sensor_in_range': None, 'pump serial': None, 'pump name': 'Name Unvailable', 'pump model': None, 'app_model_type': None}
2024-04-25 18:04:21.742 DEBUG (MainThread) [custom_components.carelink] Finished fetching carelink data in 1.443 seconds (success: True)

What could be the problem? Thank you for your help!

yo-han commented 7 months ago

I redacted some personal info in your issue. You do not want that to be found on the internet.

The error is not very specific, but when ik can find the time I will take a look at it.

milekrisz commented 7 months ago

Ohh, thank you, I did not notice.

github-actions[bot] commented 6 months ago

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

warmfire540 commented 5 months ago

Hey,

I'm getting the same error - maybe slightly different area of code? I added 3 extra debug lines to try and figure it out on my own. I'll do some more digging later and maybe get new tokens and go from there..

What's odd is the refresh token is a guid? maybe that's ok, in the past refresh tokens have been token looking

2024-06-22 16:45:04.386 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-06-22 16:45:04.387 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_config_settings()
2024-06-22 16:45:04.691 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: User region: US
2024-06-22 16:45:05.575 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_my_user()
2024-06-22 16:45:05.575 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_data()
2024-06-22 16:45:05.575 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __handle_authorization_token()
2024-06-22 16:45:05.575 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: _get_access_token_payload()
2024-06-22 16:45:05.576 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: Current token is valid until Sat Jun 22 00:21:22 UTC 2024
2024-06-22 16:45:05.576 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __refreshToken
2024-06-22 16:45:05.576 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: Trying to refresh token
2024-06-22 16:45:05.576 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: https://mdtlogin.medtronic.com:443/mmcl/auth/oauth/v2/token
2024-06-22 16:45:05.577 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: {'mag-identifier': 'redacted=='}
2024-06-22 16:45:05.577 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: {'refresh_token': 'guid'-redacted, 'client_id': 'guid-redacted', 'client_secret': 'redacted', 'grant_type': 'refresh_token'}
2024-06-22 16:45:05.890 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: {'error': 'invalid_client', 'error_description': 'The given client credentials were not valid'}
2024-06-22 16:45:05.890 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: Failed to refresh token (401)
2024-06-22 16:45:05.972 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_data() failed: exception __get_data() session get response is not OK401
2024-06-22 16:45:05.973 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __execute_init_procedure() failed: exception 'NoneType' object is not subscriptable
Fandegith commented 3 months ago

Hi, did you solve the problem?