jaroschek / home-assistant-myuplink

Custom Home Assistant integration for devices and sensors in myUplink account.
39 stars 8 forks source link

myUplink is running for only one hour #19

Closed UmsumDK closed 9 months ago

UmsumDK commented 10 months ago

Hey myUplink is running for one hour and then I get this error in Home Assistant. I can then delete the integration and at set it up again, and it is running for one hour and stops again.

That is it I do wroong?

Home Assistant Core Unexpected error fetching myUplink data: 'refresh_token' 21:24:34 – (ERROR) myUplink (custom integration) - message first occurred at 19:05:34 and shows up 140 times.

This error originated from a custom integration.

Logger: custom_components.myuplink Source: helpers/config_entry_oauth2_flow.py:186 Integration: myUplink (documentation, issues) First occurred: 19:05:34 (140 occurrences) Last logged: 21:24:34

Unexpected error fetching myUplink data: 'refresh_token' 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 "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/myuplink/init.py", line 54, in async_update_data return await api.get_systems() ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/myuplink/api.py", line 378, in get_systems await system.async_fetch_data() File "/config/custom_components/myuplink/api.py", line 331, in async_fetch_data await device.async_fetch_data() File "/config/custom_components/myuplink/api.py", line 292, in async_fetch_data self.parameters = await self.api.get_parameters(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/myuplink/api.py", line 406, in get_parameters resp = await self.auth.request("get", f"devices/{device.id}/points") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/myuplink/api.py", line 47, in request access_token = await self.async_get_access_token() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/myuplink/api.py", line 34, in async_get_access_token await self._oauth_session.async_ensure_token_valid() File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 499, in async_ensure_token_valid new_token = await self.implementation.async_refresh_token(self.token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 92, in async_refresh_token new_token = await self._async_refresh_token(token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 186, in _async_refresh_token "refresh_token": token["refresh_token"],


KeyError: 'refresh_token'

Best regards

Rasmus
UmsumDK commented 10 months ago

I found out what my problem was.

During setup of the intergration, you are asked for 4 settings. I did only marked Read data and Remember my decision.

I also have to have Offline Access marked.

Now myUplink is running.

Best regards

Rasmus