Waterkotte Heatpump Integration

I actually found some data in the HAR file, it’s a bit weird.
Forget the above just try if you can get this:

curl 'http://192.168.0.193/config/xml.cgi?D%7C1%7C1350%7CA%7C1%7C1700%7CI%7C1%7C3100'

If you are don’t have curl, just copy & past the url in a browser window and if you get a result send it to me. I would expect to either get a big XML structure or an Authentication error.

If you get an Authentication error please try this:

curl 'http://192.168.0.193/config/xml.cgi?D%7C1%7C1350%7CA%7C1%7C1700%7CI%7C1%7C3100'  -H 'Authorization: Basic d2F0ZXJrb3R0ZTp3YXRlcmtvdHRl'

Edit: Please also not the temperature values for heating/water/cooling from the dashboard at the same time so I can correlate them later.

Just to be clear, did you use curl or did you do it in a browser?
Can you send me the current temp for heating/cooling/water?
And finally, if you did it in a browser, can you do it again in an incognito window?

WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free2023-01-26 19_06_26-WATERKOTTE3

this time i used curl, temperature on screen

Did you use the first or second curl?
Sorry to be pedantic, I just want to understand if we need to authenticate to the heat pump to get the data.
From the HAR file it looks like the UI needs authentication but querying the actual data is not protected :exploding_head:.
It looks quite straight forward so far.
Are you able to run a bit of python code if I send you something?

I use first url “curl http://192.168.0.193/config/xml.cgi?D|1|1350|A|1|1700|I|1|3100 > waterkotte3.xml”
Of course, I can run python code, I have an RPi at my disposal, but it would be best if you write me how to use it

Can you download and run this file please?

run this should be enough:
python xmltest.py

If you get errors about missing requests library you need to ‘pip install requests’
Ideally you should get a lot of lines like this:

D1=0
D2=0
D3=0
D4=0
D5=0
D6=0
D7=0
D8=0
...

and some XML at then end.
Maybe put everything in a file and send to me.

some error
python xmltest.py Status code: 200
Traceback (most recent call last):
File “/home/pi/pywaterkotte-51629697842f3bf6009fd5b6efbd7d5d78066ee4/xmltest.py”, line 373, in
root = tree.getroot()
AttributeError: ‘xml.etree.ElementTree.Element’ object has no attribute ‘getroot’

ah… sorry I wasn’t able to test it properly
Can you change line 373 and 394 to

root = tree[0]

I think that should do it. worst case I need to setup a little mock service here to test.

pi@test-raspberrypi:~ $ python xmltest.py
Status code: 200
Traceback (most recent call last):
  File "/home/pi/xmltest.py", line 379, in <module>
    if int(tag[0].text) < 50:
IndexError: child index out of range

can you redownload it from github please?
The xmlparse behaves a bit different when you load the data from a website, but i think i fixed it now.

okay, i’m done

That looks good. At first glance the data is the same just in a different structure.
It’s kind of shocking that there is an authentication for the web ui, but the actual data you can just access directly :smiley:

I need two more HAR from you where you do everything as quickly as possible and with as little interaction as possible. Ideally just capture when you actually do something.

  1. Change Heating mode (doesn’t matter to what, just change it)
  2. Set & activate the holiday mode

That should hopefully give me all the data i need to add it.

I turned off the heating and then set and activated holiday mode

Hello,

Many thanks for your contribution it’s very cool :slight_smile:

I have a Waterkotte too and I find your integration today.

I had connected my Waterkotte to jeedom but I don’t have much experience with HA

I’have put your github folder to my custom_components folder and restart my HA.

I have config the integration with the IP address of my Waterkotte, login and password.

The entitie return the Bios 6.51 and EcoTouch 5014.5Ai, my correct model name :slight_smile: .

It’s been 5 hours since I installed it so I think the values should come back, but all the sensor is in “unknown” mode.

I have enable the log:

2023-01-29 10:10:24.975 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform waterkotte_heatpump
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 438, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 709, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 803, in add_to_platform_finish
await self.async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 373, in async_added_to_hass
self.coordinator.async_add_listener(
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 113, in async_add_listener
self._schedule_refresh()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 162, in _schedule_refresh
utcnow().replace(microsecond=self._microsecond) + self.update_interval,
TypeError: unsupported operand type(s) for +: ‘datetime.datetime’ and ‘int’
2023-01-29 10:10:25.126 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up waterkotte_heatpump platform for binary_sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 297, in _async_setup_platform
await asyncio.gather(*pending)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 438, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 709, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 803, in add_to_platform_finish
await self.async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 373, in async_added_to_hass
self.coordinator.async_add_listener(
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 113, in async_add_listener
self._schedule_refresh()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 162, in _schedule_refresh
utcnow().replace(microsecond=self._microsecond) + self.update_interval,
TypeError: unsupported operand type(s) for +: ‘datetime.datetime’ and ‘int’
2023-01-29 10:51:20.245 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Interface Shelly USB Lenovo C data: Error fetching data: DeviceConnectionError()
2023-01-29 11:43:55.518 WARNING (Thread-4) [pychromecast.socket_client] [KD-55XF9005(192.168.1.44):8009] Heartbeat timeout, resetting connection
2023-01-29 11:47:43.276 ERROR (Thread-4) [pychromecast.socket_client] [KD-55XF9005(192.168.1.44):8009] Error reading from socket.
2023-01-29 11:47:43.279 WARNING (Thread-4) [pychromecast.socket_client] [KD-55XF9005(192.168.1.44):8009] Error communicating with socket, resetting connection
2023-01-29 12:18:57.253 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Interface Shelly USB Lenovo C data: Error fetching data: DeviceConnectionError()
2023-01-29 13:11:22.246 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Interface Shelly USB Lenovo C data: Error fetching data: DeviceConnectionError()
2023-01-29 13:21:26.244 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Interface Shelly USB Lenovo C data: Error fetching data: DeviceConnectionError()
2023-01-29 14:37:30.256 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Interface Shelly USB Lenovo C data: Error fetching data: DeviceConnectionError()
2023-01-29 14:46:15.245 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Lumière Fontaine data: Error fetching data: DeviceConnectionError()
2023-01-29 14:47:34.256 ERROR (MainThread) [homeassistant.components.shelly] Error fetching Interface Shelly USB Lenovo C data: Error fetching data: DeviceConnectionError()
2023-01-29 14:50:10.657 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform waterkotte_heatpump
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 438, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 709, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 803, in add_to_platform_finish
await self.async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 373, in async_added_to_hass
self.coordinator.async_add_listener(
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 113, in async_add_listener
self._schedule_refresh()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 162, in _schedule_refresh
utcnow().replace(microsecond=self._microsecond) + self.update_interval,
TypeError: unsupported operand type(s) for +: ‘datetime.datetime’ and ‘int’
2023-01-29 14:50:10.729 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up waterkotte_heatpump platform for binary_sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 297, in _async_setup_platform
await asyncio.gather(*pending)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 438, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 709, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 803, in add_to_platform_finish
await self.async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 373, in async_added_to_hass
self.coordinator.async_add_listener(
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 113, in async_add_listener
self._schedule_refresh()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 162, in _schedule_refresh
utcnow().replace(microsecond=self._microsecond) + self.update_interval,
TypeError: unsupported operand type(s) for +: ‘datetime.datetime’ and ‘int’
2023-01-29 15:08:52.559 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140119376831024] ‘NoneType’ object is not subscriptable
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 200, in handle_call_service
await hass.services.async_call(
File “/usr/src/homeassistant/homeassistant/core.py”, line 1755, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1792, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 213, in handle_service
await service.entity_service_call(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 678, in entity_service_call
future.result() # pop exception if have
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 958, in async_request_call
await coro
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 715, in _handle_entity_call
await result
File “/config/custom_components/waterkotte_heatpump/switch.py”, line 95, in async_turn_off
await self._coordinator.async_write_tag(SENSOR_TYPES[self._type][1], False)
File “/config/custom_components/waterkotte_heatpump/init.py”, line 190, in async_write_tag
self.data[tag][‘value’] = res[tag.tags[0]][‘value’]
TypeError: ‘NoneType’ object is not subscriptable

This is my HA version:
Home Assistant 2023.1.7
Supervisor 2023.01.1
Operating System 9.5

My EasyCon version is 2.2.6 in a web browser.

Can you help me ?

Many thanks and have a nice day

That looks quite promising!
Just to confirm, can you do the following curl and post the result.
Unfortunately the HAR file seems to not always capture the response data and I want to be certain there is really nothing coming back… My Heatpump will always confirm back the current setting when you change it.

curl ' -vv http://192.168.0.193/config/query.cgi?var%7CI%7C30%7C0%7C'

This should switch the heating off again.

Can you try to restart HA?
Did you try to change a setting? If yes which one?

pi@test-raspberrypi:~ $ curl ’ -vv http://192.168.0.193/config/query.cgi?var|I|30|0|
curl: (3) URL using bad/illegal format or missing URL

ahhhh sorry typo

curl -vv 'http://192.168.0.193/config/query.cgi?var%7CI%7C30%7C0%7C'

it works! The heating turned off

pi@test-raspberrypi:~ $ curl -vv 'http://192.168.0.193/config/query.cgi?var%7CI%7C30%7C0%7C'
*   Trying 192.168.0.193:80...
* Connected to 192.168.0.193 (192.168.0.193) port 80 (#0)
> GET /config/query.cgi?var%7CI%7C30%7C0%7C HTTP/1.1
> Host: 192.168.0.193
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
<
<html><head></head><body><pre>Operation completed succesfully
</pre></body></html>
* Closing connection 0