Mitsubishi MELCLOUD integration with Home Assistant

Ah yes I know. The issue is that I don’t know how to solve it.

I just tried this and i could get some more data out. but I am not sure about the update fequency. I set it to fetch data every 60 seconds but it does not seem to update that often.

That can be correct. kWh sensors update only once a day. Depending on the settings of your heat pump the flow and return temperatures, frequency can be quite stable as well.

hello,
has anyone had issues with receiving firmware for the Melcloud wifi-adapter?

I have recently got 5 units (MSZ-EF & MSZ-LN), all with wifi.
Four units have received the firmware update (the one that changes the communication from happening every 1 minute, to happening in realtime).
A 5th unit stubbornly stays on the old firmware. I never get the update proposed in Melcloud app for that one, and I can’t find a way to provoke the update myself. (my installer has no idea, and Mitsubishi tells me to talk to my installer). Any help really appreciated. (apologies, I realize this isn’t about home-assistant).

PS: for the updated units, the response of https://app.melcloud.com/Mitsubishi.Wifi.Client/User/ListDevices includes “FirmwareAppVersion: 37000”; and for the 5th one, it has 34000 value.

If there is a repeater in between this could be the problem. I had the same with 3 units 1 of them doesn’t update, after switching the repeater off and put the router near by side the Update finished.

In case someone is also struggling with the MelCloud, here is something with pictures to follow.
Who wants can paste this code into the cnfiguration.yaml or into the sensors.yaml.

Short explanation:
id = id of the device; in my case marked by XXXXX
buildingID = BuildingID; in my case marked by YYYYY
X-MitsContextKey = X-MitsContextKey; in my case marked by TTTTTTTTTTTTTTT

These three codes must be replaced by your own.
You can find them as follows:
Open Firefox => go to the Melcloud page => enter your credentials, before logging in press the F12 key on your keyboard => in the opened command line click on networkanalys see attached pictures.

sensor:
  - platform: rest
    name: heat_pump_api
    resource: https://app.melcloud.com/Mitsubishi.Wifi.Client/user/ListDevices?id=XXXXX&buildingID=YYYYY
    method: GET
    headers: 
        X-MitsContextKey: 'TTTTTTTTTTTTTTTTTTTTT'
    value_template: "OK"
    scan_interval: 60
    json_attributes_path: "$..Devices[?(@.DeviceID==XXXXX)].Device"
    json_attributes:
      - CurrentEnergyConsumed
      - DailyHeatingEnergyConsumed
      - DailyHotWaterEnergyConsumed
      - DailyEnergyConsumedDate
      - HeatPumpFrequency
      - DefrostMode
  - platform: template
    sensors:
      heat_pump_power:
        friendly_name: "Heat Pump Power"
        # availability_template: "{{ is_state('sensor.heat_pump_api', 'OK') }}"
        availability_template: >-
          {{ (states("sensor.heat_pump_api") not in ["unknown", "unavailable"]) and (state_attr('sensor.heat_pump_api', 'CurrentEnergyConsumed') != None) }}
        value_template: "{{ state_attr('sensor.heat_pump_api', 'CurrentEnergyConsumed') }}"
        device_class: power
        unit_of_measurement: "kW"
        unique_id: 010320231
      heat_pump_daily_heating_energy_consumed:
        friendly_name: "Daily Heating Energy"
        # availability_template: "{{ is_state('sensor.heat_pump_api', 'OK') }}"
        availability_template: >-
          {{ (states("sensor.heat_pump_api") not in ["unknown", "unavailable"]) and (state_attr('sensor.heat_pump_api', 'DailyHeatingEnergyConsumed') != None) }}
        value_template: "{{ state_attr('sensor.heat_pump_api', 'DailyHeatingEnergyConsumed') }}"
        device_class: energy
        unit_of_measurement: "kWh"
        unique_id: 010320232
      heat_pump_daily_hot_water_energy_consumed:
        friendly_name: "Daily Hot Water Energy"
        # availability_template: "{{ is_state('sensor.heat_pump_api', 'OK') }}"
        availability_template: >-
          {{ (states("sensor.heat_pump_api") not in ["unknown", "unavailable"]) and (state_attr('sensor.heat_pump_api', 'DailyHotWaterEnergyConsumed') != None) }}
        value_template: "{{ state_attr('sensor.heat_pump_api', 'DailyHotWaterEnergyConsumed') }}"
        device_class: energy
        unit_of_measurement: "kWh"
        unique_id: 010320233
      heat_pump_daily_energy_consumed:
        friendly_name: "Daily Heat Pump Energy"
        availability_template: >-
          {{ (states("sensor.heat_pump_api") not in ["unknown", "unavailable"]) and (state_attr('sensor.heat_pump_api', 'DailyHotWaterEnergyConsumed') != None) }}
        value_template: "{{ state_attr('sensor.heat_pump_api', 'DailyHeatingEnergyConsumed') + state_attr('sensor.heat_pump_api', 'DailyCoolingEnergyConsumed') + state_attr('sensor.heat_pump_api', 'DailyHotWaterEnergyConsumed') }}"
        device_class: energy
        unit_of_measurement: "kWh"
        unique_id: 010320234
      heat_pump_frequency:
        friendly_name: "Heat Pump Frequency"
        # availability_template: "{{ is_state('sensor.heat_pump_api', 'OK') }}"
        availability_template: >-
          {{ (states("sensor.heat_pump_api") not in ["unknown", "unavailable"]) and (state_attr('sensor.heat_pump_api', 'HeatPumpFrequency') != None) }}
        value_template: "{{ state_attr('sensor.heat_pump_api', 'HeatPumpFrequency') }}"
        device_class: frequency
        unit_of_measurement: "Hz"
        unique_id: 010320235
      heat_pump_defrost_mode:
        friendly_name: "Heat Pump Defrost"
        # availability_template: "{{ is_state('sensor.heat_pump_api', 'OK') }}"
        availability_template: >-
          {{ (states("sensor.heat_pump_api") not in ["unknown", "unavailable"]) and (state_attr('sensor.heat_pump_api', 'DefrostMode') != None) }}
        value_template: "{{ state_attr('sensor.heat_pump_api', 'DefrostMode') }}"
        device_class: aqi
        unit_of_measurement: ""
        unique_id: 010320236
3 Likes

Aren’t some of those values useless like frequency when it only updates once a day?

In my system, they are polled every 60 seconds.

Interesting, may I ask what pump(s) you have?

I have
Mitsubishi Ecodan
Outdoor: WM85 YAA
Indoor: EHPT20X-YM9D

Manufactured November 2022.

I would love to get the compressor frequency in HA for troubleshooting my pump but could not find a way except 24h updates which of course is useless. Also the CurrentEnergyConsumed just says 0 on mine all the time. I guess it lacks the necessary hardware/sensors for it.

I have a PUHZ-SHW112YAA in combination with a PAC-061B.
I also had problems at first when I worked with your config. Try mine.

It also works with my air conditioner (4 indoor units and 1 outdoor unit) MXZ-4D72.

I tried yours, but it still only updates once when I restarted HA.

If you log into the MelCloud and read out the code, you can check for a few minutes if this value changes, not that the heat pump is currently running at 36Hz for quite a long time. With mine it is really that it sometimes runs for 2 hours at 30Hz when there is hardly any demand.

Since I have an electrical meter sensor as well. I polled a few times when it was at 500w. (heatpump essentially not doing anything). I then forced hot water, my meter reports 4000w, making loud sounds (:slight_smile: ). I continued to poll and the field actually seems to have been updated in MelCloud after a few minutes. So its the polling that is broken somehow in HA or how we designed the sensor? Either way MelCloud seems very slow to actually update the value. I have been polling for 30 minutes now, still same frequency even though the pump winded down to 1000w.

Oh well, i will leave it on 60 seconds in HA until tomorrow and see then if it ever updated.

thanks for the suggestion. In my case, there are no repeaters.
btw, should there be a misunderstanding: It’s not that the “update doesn’t finish”, it’s really that the update is never being offered to that one unit.

Are you sure it is running on the compressor, or is the unit heating on the electric element then?

Hmm I think so? A while back during troubleshooting, I put it to electrical heating mode only. There was a loud sound as the relay(?) engagerad. The electrial meter jumped and there was a lightning bolt on the display of the indoor unit. Nothing of that has happened recently as far as I know.

If you use the display and go into service mode, you can check various values using codes. Code 16 displays the current freq while 17 shows the target freq.

However, it seems that it indeed has updated a little bit this morning? Not sure why it did not updated during the whole night though.

The lightning bolt indicates the internal element indeed. The frequency is 0 but the internal element uses enough. By the look of the history I should say it all works fine. It might be simple that the frequency didn’t change over night.

trallan, i’m glad it works for you now :slight_smile:
My kwh meter is not updated daily, but that’s because of Mitsubishi, so the value doesn’t change either.
As good as the devices are, the communication is stupid if you are not directly connected to the bus system.
Does anyone happen to know what protocol they use? :smiley:

Another thing, has anyone ever written a value using the template function?
method: POST
and can provide me with some code so that I don’t have to write everything myself?

Thanks a lot :wink:

Yeah I actually thought it would be better 2022.:rofl: Yeah my power meter is new with HAN port so I have a live feed from it.



But as you can see here, compressor freq does not match the power:

@trallan wich Card is this with the line bars for phase power?