core: Tado - set hot water temprature gives an error

Home Assistant release with the issue: 0.96.0

Last working Home Assistant release (if known): Never worked, but never got an error either.

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Component/platform: https://www.home-assistant.io/components/tado/

Description of problem: I am getting a http 422 error when trying to set my water temprature.

Log files shows the following error.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 339, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 497, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 358, in async_set_temperature
    ft.partial(self.set_temperature, **kwargs))
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/tado/climate.py", line 240, in set_temperature
    self._control_heating()
  File "/usr/src/homeassistant/homeassistant/components/tado/climate.py", line 381, in _control_heating
    self.zone_id, self._current_operation, self._target_temp)
  File "/usr/src/homeassistant/homeassistant/components/tado/__init__.py", line 120, in set_zone_overlay
    self.tado.setZoneOverlay(zone_id, mode, temperature, duration)
  File "/usr/local/lib/python3.7/site-packages/PyTado/interface.py", line 287, in setZoneOverlay
    data = self._apiCall(cmd, "PUT", post_data)
  File "/usr/local/lib/python3.7/site-packages/PyTado/interface.py", line 81, in _apiCall
    response = self.opener.open(req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 422: 

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):


Additional information:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (4 by maintainers)

Most upvoted comments

The reason for this issue is, that the Tado Component uses a fixed “type”:“HEATING” for setting a Tado-device except a/c-devices (see line 535 in home-assistant/homeassistant/components/tado/climate.py):

            self._store.set_zone_overlay(
                self.zone_id,
                self._current_operation,
                self._target_temp,
                None,
                "HEATING",
            )

To set a Tado-hot-water-device, type has to be “type”:“HOT_WATER”, otherwise you’ll get the http error 422 from tado server. If you read the zones, hot water devices are nearly identically to thermostats, except they have a different type-attribute:

{"id":0,"name":"Warmwasser","type":"HOT_WATER","dateCreated":"2017-12-27T08:53:52.580Z","deviceTypes":["RU01"],"devices":[{"deviceType":"RU01","serialNo":"RUxxxxxxxxxx","shortSerialNo":"RUxxxxxxxxxx","currentFwVersion":"54.11","connectionState":{"value":true,"timestamp":"2019-11-21T08:34:14.391Z"},"characteristics":{"capabilities":["INSIDE_TEMPERATURE_MEASUREMENT","IDENTIFY"]},"batteryState":"NORMAL","duties":["ZONE_UI","ZONE_DRIVER","ZONE_LEADER"]}],"reportAvailable":false,"supportsDazzle":false,"dazzleEnabled":false,"dazzleMode":{"supported":false},"openWindowDetection":{"supported":false}

So if a programmer could change this part of the component and uses the “type:”-value not fixed but as reported from tado-device (thermostats reports “HEATING” as fixed in component), everything would work with hot water control (perhaps self.type instead of "HEATING"). But i can’t code this because sadly i’m not a programmer.

No, cause i think, “type” is not assinged. First someone has to modify the code and assign “type” to JSON value of each tado device!

I’ve ended up just doing it with a template rest switch, as below:

switch:
  - platform: rest
    method: put
    name: hot_water_power
    resource: https://my.tado.com/api/v2/homes/666/zones/0/overlay?username=foo&password=bar
    body_on: '{"setting": {"type": "HOT_WATER","power": "ON"},"termination": {"type": "MANUAL"}}'
    body_off: '{"setting": {"type": "HOT_WATER","power": "OFF"},"termination": {"type": "MANUAL"}}'
    is_on_template: '{{states.sensor.hot_water_power.state=="ON"}}'
    headers:
      Content-Type: application/json