MislavMandaric / home-assistant-vaillant-vsmart

Home Assistant custom component for Vaillant vSMART.
MIT License
59 stars 12 forks source link

"Integration requires reconfiguration" After restart always asking for credentials user/password only #312

Open bigtarget opened 7 months ago

bigtarget commented 7 months ago

Hello,

Thanks for all your work !!! It is working nice, but i have problem with expired session or something.

obraz Of course after enter user and password all starting to work, but it is annoying to do it every day/restart.

Can you please check it?

bigtarget commented 7 months ago

More details:

Logger: custom_components.vaillant_vsmart Source: helpers/update_coordinator.py:366 Integration: Vaillant vSMART (documentation, issues) First occurred: 09:46:16 (1 occurrences) Last logged: 09:46:16 Authentication failed while fetching vaillant_vsmart data: ('Access token is invalid or expired. Refresh the access token and try again.', {'method': 'POST', 'url': URL('https://api.netatmo.com/api/getthermostatsdata'), 'body': b'device_type=NAVaillant&data_amount=app&sync_device_id=all&access_token=&'}, {'status_code': 403, 'url': URL('https://api.netatmo.com/api/getthermostatsdata'), 'body': b'{"error":{"code":2,"message":"Invalid access token"}}', 'duration': datetime.timedelta(microseconds=77999)})

bigtarget commented 7 months ago

Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.vaillant_vsmart.config_flow Source: custom_components/vaillant_vsmart/config_flow.py:65 Integration: Vaillant vSMART (documentation, issues) First occurred: 09:46:16 (1 occurrences) Last logged: 09:46:16

("Server processed the request and returned a 4xx response. Don't retry the request without changing the arguments as the new request will fail again with the same error.", {'method': 'POST', 'url': URL('https://api.netatmo.com/oauth2/token'), 'body': b'username=&password=&app_version=1.0.4.0&grant_type=password&client_id=na_client_android_vaillant&client_secret=&scope=read_thermostat+write_thermostat'}, {'status_code': 400, 'url': URL('https://api.netatmo.com/oauth2/token'), 'body': b'{"error":"invalid_request","error_description":"Missing parameters, \"username\" and \"password\" are required"}', 'duration': datetime.timedelta(microseconds=59633)}) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/vaillant_netatmo_api/errors.py", line 79, in client_error_handler yield File "/usr/local/lib/python3.12/site-packages/vaillant_netatmo_api/base.py", line 55, in _post resp.raise_for_status() File "/usr/local/lib/python3.12/site-packages/httpx/_models.py", line 759, in raise_for_status raise HTTPStatusError(message, request=request, response=self) httpx.HTTPStatusError: Client error '400 ' for url 'https://api.netatmo.com/oauth2/token' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/vaillant_vsmart/config_flow.py", line 65, in _async_step_all data = await self._get_config_storage_data(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/vaillant_vsmart/config_flow.py", line 155, in _get_config_storage_data await client.async_token( File "/usr/local/lib/python3.12/site-packages/vaillant_netatmo_api/auth.py", line 74, in async_token body = await self._post( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 314, in iter return fut.result() ^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in get_result raise self._exception File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/vaillant_netatmo_api/base.py", line 47, in _post with client_error_handler(): File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/usr/local/lib/python3.12/site-packages/vaillant_netatmo_api/errors.py", line 90, in client_error_handler raise RequestClientException("Server processed the request and returned a 4xx response. Don't retry the request without changing the arguments as the new request will fail again with the same error.", e.request, e.response) from e vaillant_netatmo_api.errors.RequestClientException: ("Server processed the request and returned a 4xx response. Don't retry the request without changing the arguments as the new request will fail again with the same error.", {'method': 'POST', 'url': URL('https://api.netatmo.com/oauth2/token'), 'body': b'username=&password=&app_version=1.0.4.0&grant_type=password&client_id=na_client_android_vaillant&client_secret=&scope=read_thermostat+write_thermostat'}, {'status_code': 400, 'url': URL('https://api.netatmo.com/oauth2/token'), 'body': b'{"error":"invalid_request","error_description":"Missing parameters, \"username\" and \"password\" are required"}', 'duration': datetime.timedelta(microseconds=59633)})

bigtarget commented 7 months ago

I am using all latest: v.0.9.0 and
HA Core 2024.2.0 Supervisor 2024.01.1 Operating System 11.5 UI 20240207.0

liberatofiasca commented 7 months ago

Same problem here, starting from february 2024 versions and above.

mgolec commented 5 months ago

Same problem here too. I'm not sure from which version but the problem has been present for at least a couple of months.

MislavMandaric commented 3 months ago

I'm sorry to hear that you have issues with the integration. I tried reproducing this, but I can't. I don't have any disconnects and I get reauth request almost exclusively after I work on this locally, thus generating a lot of tokens, making them invalid. Other than that, I don't get any issues.