Skip to content

Add tado water heater#27266

Closed
andersonshatch wants to merge 2 commits into
home-assistant:devfrom
andersonshatch:tado-water-heater
Closed

Add tado water heater#27266
andersonshatch wants to merge 2 commits into
home-assistant:devfrom
andersonshatch:tado-water-heater

Conversation

@andersonshatch
Copy link
Copy Markdown
Contributor

@andersonshatch andersonshatch commented Oct 6, 2019

Breaking Change:

Tado hot water zones with temperature control previously created an climate entity, e.g. climate.hot_water, these will be replaced by a water_heater.hot_water entity instead.
Hot water zones without temperature control did not have a climate zone, so change is not breaking for them.

Description:

Support for tado water heater zones.

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10642

Example entry for configuration.yaml (if applicable):

tado:
  username: !secret tado_username
  password: !secret tado_password

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

Copy link
Copy Markdown
Contributor

@michaelarnauts michaelarnauts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also probably want to filter out the zones with type == HOT_WATER in the climate.py to avoid creating duplicate entities for the same object.

CONST_MODE_OFF = "OFF"
CONST_OVERLAY_TADO_MODE = "TADO_MODE"

SUPPORT_FLAGS_HEATER = SUPPORT_OPERATION_MODE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried these changes, but the water_heater.water_heater entity that is created doesn't allow to change the temperature. I do have a climate.hot_water that does allow this. I guess this is because the SUPPORT_TARGET_TEMPERATURE flag is missing here.

Copy link
Copy Markdown
Contributor

@michaelarnauts michaelarnauts Nov 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I correct myself, the interface allows this for the climate.hot_water, but the API replies with a 422 error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, that's interesting... My hot water zone does not do temperature control, so I don't have a climate zone for it and didn't add in temp control to this component.
Does the tado app let you control temperature for your hot water zone then? I may need some extra details in order to add support for that here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I have temperature control, but can't see the current temperature. I've send you an email with more details.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added temperature control -- I think! Unable to test myself, so would appreciate if you can check the latest version out and provide feedback since yours has temp control.
Will update description to mention this is a breaking change for those with temp control on hot water zones.

@michaelarnauts
Copy link
Copy Markdown
Contributor

I've tried your PR, but I get a 422 Error when I change the temperature. The configured value is returned fine.

2019-11-29 15:31:32 INFO (SyncWorker_1) [custom_components.tado.water_heater] Switching mytado.com to True mode for zone Hot Water
2019-11-29 15:31:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140231243094352] HTTP Error 422: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1236, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1261, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 348, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 372, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 311, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 243, 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 "/config/custom_components/tado/water_heater.py", line 163, in set_temperature
    self._control_heater()
  File "/config/custom_components/tado/water_heater.py", line 229, in _control_heater
    device_type="HOT_WATER",
  File "/config/custom_components/tado/__init__.py", line 139, in set_zone_overlay
    zone_id, overlay_mode, temperature, duration, device_type, "ON", mode
  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: 

@michaelarnauts
Copy link
Copy Markdown
Contributor

@andersonshatch there is still quote some stuff missing when comparing with the climate platform (unit, step, operation mode). I've merged PR #29191 since it fixed it when you have temperature control.

In the end, I would like to move the water heater to the water_heater component.

Copy link
Copy Markdown
Contributor

@michaelarnauts michaelarnauts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked at it a bit further. It seems that water_heater doesn't support step yet, something that should be added to make it match climate in my opinion, but out of scope for this PR.

This PR also doesn't support the operation modes like the climate counterpart (auto = SMART_SCHEDULE, heating = TADO_MODE, off = MANUAL). This should be adressed.

I'll try to find out why the api is responding with a 422 on the requests.

@michaelarnauts
Copy link
Copy Markdown
Contributor

I'm working something out for tado to use the dispatcher for updates, since the current way is quite messy. I will be modifying your water_heater to work with this. Please hold for a few days. :)

@michaelarnauts michaelarnauts mentioned this pull request Nov 30, 2019
8 tasks
@michaelarnauts michaelarnauts mentioned this pull request Dec 20, 2019
9 tasks
@michaelarnauts
Copy link
Copy Markdown
Contributor

Now that my tado rework branch has been merged, I've created #30095 with code that works fine for my temperature controllable water_heater.

Could you check this out if it also works for you?

@andersonshatch
Copy link
Copy Markdown
Contributor Author

It does! 👍

@Diondk
Copy link
Copy Markdown

Diondk commented Dec 22, 2019

Yes work for me also, one step closer to full automation. Only need to be able to set the home and away modus through HA and i am a happy man :) Thanks!

edit
i forgot to remove my custom component, its all working now. including changing the water status to off. Thanks!

@lock lock Bot locked and limited conversation to collaborators Dec 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants