Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

VALIDATION_ERROR #69

Open
RafalHo opened this issue Nov 25, 2021 · 15 comments
Open

VALIDATION_ERROR #69

RafalHo opened this issue Nov 25, 2021 · 15 comments

Comments

@RafalHo
Copy link

RafalHo commented Nov 25, 2021

Hello,

from the very beginning I have a problem with this integration, the HA displays the temperature of domestic water and heating, but I can not change anything, nor, for example, turn off the heating. I can only set the temperature of domestic water. I tried the version with energy support, but there was no new entity for gas or electricity consumption, and I have all this data in the Vicare application.

Below I am pasting the log that was generated when I tried to turn off the heating.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/vicare/climate.py:277
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:23:01 (1 occurrences)
Last logged: 12:23:01

[140010213410080] (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 470, in async_set_hvac_mode
    await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/vicare/climate.py", line 277, in set_hvac_mode
    self._circuit.setMode(vicare_mode)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareDevice.py", line 330, in setMode
    r = self.service.setProperty(
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareCachedService.py", line 29, in setProperty
    response = super().setProperty(property_name, action, data)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareService.py", line 52, in setProperty
    return self.oauth_manager.post(url, post_data)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 91, in post
    self.__handle_command_error(response)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 67, in __handle_command_error
    raise PyViCareCommandError(response)
PyViCare.PyViCareUtils.PyViCareCommandError: (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')
@oischinger
Copy link
Owner

Looks like an auth failure. Are you sure you retrieved the correct client id and use correct username and password?

@RafalHo
Copy link
Author

RafalHo commented Dec 1, 2021

I checked again, but the data is correct.
If they were wrong, would I see the current heating and domestic water temperature in HA?
I can even change the domestic hot water temperature, but I cannot turn off the heating or change to a schedule.

@oischinger
Copy link
Owner

Maybe it's a read only token or so.
Did you follow the instructions here to create the token: https://github.com/somm15/PyViCare#api-usage-in-postman

@RafalHo
Copy link
Author

RafalHo commented Dec 1, 2021

@oischinger
Copy link
Owner

Yes, that's the same.
Maybe it's also the stored token. The integration persists a token in /config (vicare.token I believe) can you tryto delete it?

@RafalHo
Copy link
Author

RafalHo commented Dec 4, 2021

Found the token and removed it (found here: config.storage\vicare_token.save)
I even generated a new Client ID on developer.viessmann.com/en/clients.
Unfortunately, still an error, the log is attached below.
Should I use some other integration instead of the original one (https://www.home-assistant.io/integrations/vicare/)?
Is it possible to read gas and electricity consumption at all through integration?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/vicare/climate.py:277
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 22:30:59 (2 occurrences)
Last logged: 22:31:12

[140698296623648] (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 470, in async_set_hvac_mode
    await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/vicare/climate.py", line 277, in set_hvac_mode
    self._circuit.setMode(vicare_mode)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareDevice.py", line 330, in setMode
    r = self.service.setProperty(
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareCachedService.py", line 29, in setProperty
    response = super().setProperty(property_name, action, data)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareService.py", line 52, in setProperty
    return self.oauth_manager.post(url, post_data)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 91, in post
    self.__handle_command_error(response)
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 67, in __handle_command_error
    raise PyViCareCommandError(response)
PyViCare.PyViCareUtils.PyViCareCommandError: (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')

@Pampasgras
Copy link

Pampasgras commented Feb 3, 2022

I have the very same issue when choosing the Auto option in Pyvicare Heating
(I can set the temperature, and read other statistics)

Logger: homeassistant.components.websocket_api.http.connection
Source: components/vicare/climate.py:276
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 14:54:41 (1 occurrences)
Last logged: 14:54:41

[547861626112] (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
..............................
..............................
..............................
  File "/usr/local/lib/python3.9/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 67, in __handle_command_error
    raise PyViCareCommandError(response)
PyViCare.PyViCareUtils.PyViCareCommandError: (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')

--> I use climate.set_vicare_mode instead
So I cannot use the lovelace thermostat

@oischinger
Copy link
Owner

Can you please check which vicare_modes your device supports? you should see it as an attribute of the climate entity

@Pampasgras
Copy link

Pampasgras commented Feb 4, 2022

Can you please check which vicare_modes your device supports? you should see it as an attribute of the climate entity

hvac_modes:

  • heat
  • 'off'
  • auto

vicare_modes:

  • standby
  • forcedReduced
  • forcedNormal
  • heating

Vicare modes are all supported with climate.set_vicare_mode. (tested them all)

climate.set_hvac_mode "heat" --> vicare_mode forcedNormal
climate.set_hvac_mode "off" --> vicare_mode forcedReduced
climate.set_hvac_mode "auto" -->error 422 (I expect vicare_mode heating)

@oischinger
Copy link
Owner

I have created a branch with a potential fix @KurtSponik : #85

To the others: Can you please provide the same information as @KurtSponik did?
Do all your heating devices have in common that they don't provide domestic hot water?

@ol3k
Copy link

ol3k commented Feb 5, 2022

I get the same Validation Error (but with dhw mode)

hvac_modes:

  • heat
  • 'off'
  • auto
    min_temp: 3
    max_temp: 37
    preset_modes:
  • comfort
  • eco
    current_temperature: 28
    temperature: 22
    hvac_action: idle
    preset_mode: null
    room_temperature: null
    active_vicare_program: normal
    active_vicare_mode: dhwAndHeating
    heating_curve_slope: 0.3
    heating_curve_shift: 0
    vicare_modes:
  • standby
  • dhw
  • dhwAndHeating
    friendly_name: ViCare Heating
    supported_features: 17

@oischinger
Copy link
Owner

@ol3k
I'm interested in the data shown in the developer tools like below:
image

@ol3k
Copy link

ol3k commented Feb 5, 2022

I think this is the data I copied above (just c&p with mobile phone out of HA, find screenshot attached)

image

@darianf01
Copy link

Same issue as encountered by @ol3k when trying to change the hvac mode

PyViCare.PyViCareUtils.PyViCareCommandError: (PyViCareCommandError(...), 'Command failed with status code 422. Reason given was: VALIDATION_ERROR')
Vitodens 100-w + Vitoconnect OT2 + Vitotrol OT1

image

@TOMSLAUS
Copy link

Same issue to me, error gets thrown when trying to do anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants