Set target temperature mode flow on Melcloud

Using pymelcloud directly in python, I am able to set target temperature when using mode FLOW on Air-to-Water unit (ECODAN), but I am not able to do the same using the Home Assistant climate device (which uses pymelcloud as far as I know).

The working code to change FLOW heat temperature with pymelcloud is the following:

import pymelcloud
token = await pymelcloud.login("email", "password")
devices = await pymelcloud.get_devices(token)
device = devices[pymelcloud.DEVICE_TYPE_ATW][0]
await device.zones[0].set_target_heat_flow_temperature(35)

Could you implement this in Home Assistant MELCloud integration?

Thanks a lot.

@fmonera First of all this forum is trash and I canā€™t keep track of things happening on it. I honestly tough thereā€™s no interest in the ATW stuff.

Second, I have a fork for testing experimental features that Iā€™ve been intending to bring to the integration: GitHub - vilppuvuorinen/hass-melcloud

That fork happens to contain the exact feature you are asking for, but in a bit more elaborate package. If you are still interested in the topic, please give it a go. It can be run side by side with the regular integration, but preferrably not for extended periods.

I think it is severely out dated tho. Iā€™m afraid I need to update it before it can be run with more recent HA versions. Lemme know if you are interested.

1 Like

Considering the above comment, I hope I can try to hijack this thread :slight_smile:

I am trying to run:


service: climate.set_temperature
data:
  temperature: {{states("input_number.climate_target_temp")|float}}
  hvac_mode: cool
target:
  device_id: ab9b0f272f834ec6b5b6494e1c802793

But Iā€™ve got two problems. The jinja template seems to be impossible to use. Pasting the same thing into DevTools==>Templates, renders fine. But that parsing should happen long before the api-call gets to the melcloud code I guess? But my logs show:

2021-06-07 19:12:58 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data[ā€˜temperatureā€™]

The melcloud specific issue, is that the hvac_mode is ignored. According to the API, you should be able to set hvac_mode as well, but it does seem so, no matter what I try.
(And if this is fixed, it would be REAL nice if ā€œon/offā€ was available on the same API)

Tested on Home Assistant 2021.6.2.

(And of course, the jinja issue was cause by the missing ā€™ ā€™ chars, but Iā€™ll leave it in, if someone else is as forgetful as me)

It looks like the hvac mode being ignored is caused by partial implementation of the service handler. I had not realized you are supposed to be able to do that much with the set_temperature service. I think I need to expand the implementation at some point.

The on/off control is omitted on purpose. AFAIK you cannot turn off the zones of an ATW device without turning off the entire unit. The only option for disabling the zones is to set the target temp below the actual ambient with a healthy margin.

1 Like

It only took 3 months, but thereā€™s now an open PR that adds a full climate.set_temperature implementation to ATA climate entities.

3 Likes

Great!!! Thanks a lot. Iā€™ve been waiting for this for a long time.

Unfortunately I was trying to respond to the hijacking comment on the thread. Your request is still in the works :sweat:

@fmonera Are you able to run home-assistant from source to test out features? Iā€™ve finally started to port over the better ATW climate mapping to upstream home-assistant and it would be great if you could test it out as well.

In any case, hereā€™s a WIP PR with flow control: https://github.com/home-assistant/core/pull/56099

Iā€™d appreciate if if you could give it a go and let me know what you think. Please donā€™t comment on the PR unless you are doing review :pray:

1 Like

Hello,
@vilppuvuorinen thank you a lot for your work. I was able to deploy the melcloud on my HA and easily fix some sensors that was not correctly reporting.
Iā€™m able to get the following states :

I have a combo of: PUHZ-SHW80VHA + EHSC-VM6C
In my case the room zones flow was not mapped correctly.
I used the following fixes in sensor.py :

#Flow
value_fn=lambda zone: zone._device._device_conf['Device'][f"FlowTemperatureZone{zone.zone_index}"],
value_fn=lambda zone: zone._device._device_conf['Device'][f"ReturnTemperatureZone{zone.zone_index}"],

#Energy
value_fn=lambda x: x.device._device_conf['Device']['DailyHeatingEnergyProduced'],  
value_fn=lambda x: x.device._device_conf['Device']['DailyHeatingEnergyConsumed'],

Two weeks ago our newly built house with a ATW heatpump was finished (PUHZ-SW100YAA, ERST30C-VM2ED combo).
I see you have daily energy sensors for consumed, produced and COP working. I have a one zone setup but am missing those very important sensors:
image

Could you assist me getting these sensors exposed?

It makes me really sad this died outā€¦ I would have loved to have it integrated in the main one to be able to change mode between flow temperature and room temperatureā€¦

2 Likes

I too am getting tired of clicking through the melcloud website every time I want to change the flow temp. (I want to vary the load according to the price of electricity per half hour, which would be trivial to automate since HA knows the price)

Please let me know if there is anything I can do to help. Coding, testing, screaming into the voidā€¦ Iā€™ll do anything!

1 Like

Hell yeah!

I bet you basically do the same as I:

  1. Low electricity price = Room temperature
  2. High electricity price = A low flow temperature (like 30-35c)

There is obviously no interest in this project, so I resolved it by reprogramming the control of my ECODAN in python.

I built a simple flask app, and put everything on a docker image. Then I can control everything with node-red.

It works for me, but the code is horrible. There might even be passwords written directly :smiley:

If anyone is interested, I can make a bit of cleanup and upload everything to GitHub.

2 Likes

hello, can you control and change the flow temp with it?

Yes, nearly, high electricity price => 25C, when the price is negative, flow temp => 60 lol

Fascinating! I would love to see it (without the passwords obviously!).

I donā€™t know what Iā€™m doing wrong, but when I

await device.zones[0].set_target_flow_temperature(25)

it just hangs forever :man_shrugging:

FYI for anyone following along. I managed to get melcloudexp working:

Although I have just now realised that I should have been using the closed PR mentioned above.

I hope @vilppuvuorinen is still active and reading this (I noticed that the pymelcloud repository is archived on github). I think we must be close to having a working heat-flow device.

Attached is the code I wrote to control my Mitsubishi Ecodan with Melcloud. It is working for me for months now, as I can set and get the floor and hot water tank temperatures.

At the moment is winter in Spain, so I didnā€™t implement the cold temperature flow yet.

You donā€™t need to build it yourself, as I have uploaded a working docker image. Just follow the quickstart described in the README.md.

1 Like