Mitsubishi MELCLOUD integration with Home Assistant

I was able to setup development environment and MelCloud integration. What should be now tested?There is now two new heat flow entities (I have two zones). Is this intented? The new entities are somehow not usable. The information is duplicate and the temperature is not possible to set or change.

Other odd thing is that both zones are showing same temperature all the time for flow and flow return temps. Edit: both zones are now showing the internal flow and return temperature, instead of Flow/Flow return temperature Zone 1/2. Edit2: It would be nice to have those temperatures also visible, cause one can see that atw is working by looking those values.

This is intentional. The thermostats are duplicated for different control modes because the way MELCloud manages these makes it convenient to manage them as separate entities. Additionally it does not look like a device would transition between control modes too often in regular use. The reasoning here is that you should use only the climate entity of the control mode you are actually using and remove everything else form these dashboards. In your case I’d assume it is heat flow versions that you want to keep around. The climate entity of the disabled control mode is presented as being turned off.

This whole setup is a bit weird, but I did try to put some thought into it. For example, any automations that would toggle a ATW devide between heat and cool could accidentally target the set point of the previous mode unless caution is taken. With the separate entities there’s no chance for these weird race conditions and the targets of the actions are always clear.

The responses contain fields for zone specific flow temperatures, but they do not seem to be updated. The upstream version of home-assistant used to use these fields pymelcloud/tests/samples/atw_2zone_listdevice.json at 75c8aff664d6aad31e15f8bce1a626fb291ae3cc · vilppuvuorinen/pymelcloud · GitHub without much success. You can scroll the thread up to find the recent workarounds that use the internal flow temp.

You can compare the API responses in MELCloud and see if you can find the corresponding values.

There’s one curious detail in your screencap. Both of the upstairs climates appear to be off. This thing looks like a bug to me.

@vilppuvuorinen: The upstream version of home-assistant used to use these fields

It seems that in my system the upstream version values look quite the same as in MelCloud. It may be so, that my earlier comment about the values being wrong was, wrong.

image image

image
image

It seems that the new zone flow temp and return temp correspond to internal flow value.
image
image

I have the two zone kit installed to my system.

Anyone who wants to add the Mitsubishi to the energy dashboard. My device gives a (estimate) about the used energy after a day. I already had these code in sensor.yaml:

    dailyhotwaterenergyconsumed:
      value_template: "{{ state_attr('sensor.ecodan_cmd', 'DailyHotWaterEnergyConsumed') }}"
      unit_of_measurement: "kWh"
      unique_id: "ecodan_cmd_DailyHotWaterEnergyConsumed"
    dailyheatingenergyconsumed:
      value_template: "{{ state_attr('sensor.ecodan_cmd', 'DailyHeatingEnergyConsumed') }}"
      unit_of_measurement: "kWh"
      unique_id: "ecodan_cmd_DailyHeatingEnergyConsumed"

I added these code to customize.yaml to make it able to be in the energy dashboard. I gave it a 1 day offset so it appears on the right day (yesterday):
</s> <s>sensor.dailyhotwaterenergyconsumed:</s> <s> state_class: total_increasing</s> <s> device_class: energy</s> <s> friendly_name: "SWW energie"</s> <s> cycle: daily</s> <s> offset:</s> <s> days: 1</s> <s>sensor.dailyheatingenergyconsumed:</s> <s> state_class: total_increasing</s> <s> device_class: energy</s> <s> friendly_name: "Verwarmingsenergie"</s> <s> cycle: daily</s> <s> offset:</s> <s> days: 1</s> <s>
Now these sensors can be selected in the energy dashboard as individual devices:


Had my legionella run yesterday, that’s why it used so much :wink:

Edit:
To be honest it works half. Sometimes the difference between days is shown, sometimes the correct state…?

Actually I had some help with this on tweakers.net and it works correctly now so I post it here as well to help others:
template.yaml:

- trigger:
    - platform: state
      entity_id: sensor.dailyhotwaterenergyconsumed
    - platform: homeassistant
      event: start
    - platform: event
      event_type: event_template_reloaded
  sensor:
    - name: dailyhotwaterenergyconsumed sum
      unique_id: 2a25a8ee-42e7-47c8-9abd-2144a125d086
      state: >
        {{ [ state_attr('sensor.stats', 'max_value') | float, states('sensor.dailyhotwaterenergyconsumed_sum') | float + states('sensor.dailyhotwaterenergyconsumed') | float] | max }}
      state_class: total_increasing
      device_class: energy
      unit_of_measurement: kWh
      icon: mdi:chart-line

- trigger:
    - platform: state
      entity_id: sensor.dailyheatingenergyconsumed
    - platform: homeassistant
      event: start
    - platform: event
      event_type: event_template_reloaded
  sensor:
    - name: dailyheatingenergyconsumed sum
      unique_id: 2a25a8ee-42e7-47c8-9abd-2144a125d886
      state: >
        {{ [ state_attr('sensor.stats', 'max_value') | float, states('sensor.dailyheatingenergyconsumed_sum') | float + states('sensor.dailyheatingenergyconsumed') | float] | max }}
      state_class: total_increasing
      device_class: energy
      unit_of_measurement: kWh
      icon: mdi:chart-line

sensor.yaml:

- platform: statistics
  entity_id: sensor.dailyhotwaterenergyconsumed_sum
- platform: statistics
  entity_id: sensor.dailyheatingenergyconsumed_sum

customise.yaml:

sensor.dailyhotwaterenergyconsumed_sum:
  friendly_name: "SWW energie"
sensor.dailyheatingenergyconsumed_sum:
  friendly_name: "Verwarming energie"
2 Likes

great to see that, I was just looking for a Dutch HA fellow with Mitsubishi Airco experience. Could you please indicate which device you have, and how you integrated it in HA?

I want to buy a split airco unit, and operate is via HA, but dont know if thats possible at all. Ofc course preferably local… thats why I stumbled on Mitsubishi AirCon - #4 by nickrout

That code is now available in esphome as a custom component too. https://github.com/geoffdavis/esphome-mitsubishiheatpump

thanks, thats mighty impressive. Requires some old school handwork though, I am afraid thats not my forte…But, there’s always a first, and never having used Esphome yet, this might be as good as ever a reason to consider. Cool.

I don’t have an airco but a heatpump (PUHZ-SHW112YAA+ERSC-VM2D). The unit is connected to internet via a MAC-567IF-E. In the MELcloud online version I was able to look up the required contextkey, device- and building id’s. Via curl on my HA server I was able to lookup stuff. You might have to play with the exact command depending on your model, see various configurations in this topic. You pick out the usefull information you see in the curl output and put that in the json attributes to integrate those reading in HA.

There is not much to control for me, I can control the temperature setting and that’s it. But that’s te same I can do from my Mitsubishi thermostat. I would like to switch between cooling and heating but that doesn’t seem to be an option on my unit.

However, I use home assistant to lookup varius temperature readings that I can only access in the MELcloud app or on the inner unit otherwise. So I use it to be able to check if something might be wrong and I calculate the coefficient of performance (cop) daily:

3 Likes

@breinonline Could you consider creating PRs for these sensors to https://github.com/vilppuvuorinen/pymelcloud :pray:

Having everyone configure their own rest sensors with arbitrary poll rates adds to the load originating from HA instances. I don’t want go back to the half-baked feature set my ATA unit offers :sweat_smile:

What is the best way to derive power (watts) from the reported energy consumption (kWh)? I’m having trouble - possibly because Melcloud seems to report every time 0.1 kWh has been consumed, which is like anything between 5 min and a day.

1 Like

I’m afraid those are the best numbers you can get. At least you don’t have one of those Ecodan units that reports power consumption in 1 kWh increments.

MELCloud connected devices seem to send sampled values once a minute. That’s the best case. IIRC the ATW devices report outdoor temperature with 1°C accuracy and once every 10 minutes.

If you want to go to extremes you could get one of those zigbee clip-on current probes and measure the current draw externally.

1 Like

Yesterday my air-to-air got a firmware update.
Now my energy measurements are very strange. In HA it appears to fetch the energy counter correctly, then 5 minutes later it receives 0 kWh. Another 5 minutes and the correct counter is recorded again, and so on. It looks as if the integration doesn’t understand that this is an accumulating counter and adds them all up. I currently have more than 170MWh of energy spending in the control panel.
Edit: Over 250MWh now

How did you get the firmware update? I wasn’t aware of such. Mine still seems to be working normally

In the app (on my phone). You can probably find it by opening the app, choose the “Settings” icon on the bottom row and then select “Firmware update” in the menu.
I can’t find firmware versions numbers in the app, it just reports that I am on the current version.

I’m also experiencing this issue since the firmware update. It’s nice that the units respond to commands in (near) real time now, but the energy reporting issue does massively skew the Home Assistant energy reports.

As this issue seems to relate to the recent firmware update, and not a configuration issue, I have opened up a bug for this on Github. Edit: Bug opened on the upstream library instead.

@nilux @KingJ @ks_ha: Is the communication between the browser (or the app) and MELCloud any different or does this change just improve the adapter to MELCloud communication? A simple test would be to change a value through the IR remote and see if the change propagates to the app any faster than before.

This firmware update sounds pretty neat. I hope my adapter gets something similar soon. I have an automation for running the fan a bit slower when the room with the ATA box is occupied. The 1 minute delay is really messing it up. The funny thing is that there is some sort of a built-in “comfort” feature for something similar in spirit, but I think it will actually try to aim the air-flow towards people in the room :sweat_smile:

The MELCloud UI appears to be exactly the same as before, it’s just that the communication is faster. Previously when i’d make a change in the UI, it would say something along the lines of the change would take effect at the next update interval, with the timestamp of the previous update interval.

Interestingly the LastCommunication and NextCommunication fields are still present in the responses back from the SetAta endpoint, despite the fact they now take effect immediately. I wonder if that’s just a fallback mode though?

If I turn the unit on/off via the IR remote, the change isn’t instantly reflected in the MELCloud UI on the overview screen. If I click on a unit, then it does perform a refresh and gets the current status. Using the remote control whilst on this screen also doesn’t appear to result in an instant refresh - it won’t change until I manually hit the refresh button. In Home Assistant the change is reflected after a 1-minute delay.

So overall, it really does only appear to improve the adapter’s communication with MELCloud. There are no improvements on the app side itself.

@KingJ Thanks for checking this. Given the stack they appear to be running (I think it looked like .NET) they could have switched to some sort of a WebSocket setup for the communication between the adapter and MELCloud.

I have a PR open towards home-assistant for fixing the zero energy readings. Similar upgrades have been merged pretty quick in the past but then again there are currently 402 other open PRs waiting for their turn.

1 Like

Thanks, I had same PUHZ, can U provide Code that U are using?

Thanks