oischinger / ha_vicare

Inofficial Home Assistant custom component for Viessmann ViCare API
61 stars 33 forks source link

Dont work in viessmann Vitodens b2ha 200w (preset_modes: comfort, eco, none) #100

Closed amgstone closed 2 years ago

amgstone commented 2 years ago

Dont work in viessmann Vitodens b2ha 200w (preset_modes: comfort, eco, none) qwer

`Logger: homeassistant.components.websocket_api.http.connection Source: components/vicare/climate.py:364 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 11:32:10 (5 occurrences) Last logged: 13:32:11

[547040388448] (PyViCareCommandError(...), 'Command failed with status code 502. Reason given was: COMMAND_NOT_FOUND') [547038150224] (PyViCareCommandError(...), 'Command failed with status code 502. Reason given was: COMMAND_NOT_FOUND') [547354976864] (PyViCareCommandError(...), 'Command failed with status code 502. Reason given was: COMMAND_NOT_FOUND') Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 89, in post self.handle_expired_token(response) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 49, in handle_expired_token raise TokenExpiredError(response) oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) {'viErrorId': 'req-65c418c737ec4999ab560ca8c1d286e9', 'statusCode': 401, 'errorType': 'UNAUTHORIZED', 'message': 'Token provided in request is expired or invalid.', 'error': 'EXPIRED TOKEN'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 488, in async_set_preset_mode await self.hass.async_add_executor_job(self.set_preset_mode, preset_mode) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/vicare/climate.py", line 364, in set_preset_mode self._circuit.deactivateProgram(self._current_program) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareDevice.py", line 467, in deactivateProgram return self.service.setProperty(f"heating.circuits.{self.circuit}.operating.programs.{program}", "deactivate", {}) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareCachedService.py", line 29, in setProperty response = super().setProperty(property_name, action, data) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareService.py", line 60, in setProperty return self.oauth_manager.post(url, post_data) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 95, in post return self.post(url, data) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 91, in post self.handle_command_error(response) File "/usr/local/lib/python3.10/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 67, in handle_command_error raise PyViCareCommandError(response) PyViCare.PyViCareUtils.PyViCareCommandError: (PyViCareCommandError(...), 'Command failed with status code 502. Reason given was: COMMAND_NOT_FOUND')`

oischinger commented 2 years ago

Did you check that your token is correct? 'errorType': 'UNAUTHORIZED', 'message': 'Token provided in request is expired or invalid.', 'error': 'EXPIRED TOKEN' seems pretty clear.

On the other hand setting the preset is bound to some prerequisites. Please see my comment in a similar issue: https://github.com/home-assistant/core/issues/67984#issuecomment-1236076019