Mitsubishi MELCLOUD integration with Home Assistant

It’s a bit of a hack. You can check previous posts.

1 Like

Thanks! Tried the script from @Chrissi28 and it shows me: image

Hope the ‘Daily Heat Pump Energy’ will update at least daily, as with MELCloud integration/Daily energy consumption entity(which doesn’t work for me anymore for some reason) so I can put it into Energy Dashboard.

(updated image - previously showed 0Hz and 0kW consumption, because it was … idle :smile: )

1 Like

BTW, what is your graph type? It looks way more scientific and accurat than my current ones from daycare style.

Hi, I use both Melcloud integration and Melcloud custom integration. After updating Home Assistant to version 2023.5.1, below error occurs:

Logger: homeassistant.config_entries
Source: custom_components/melcloud_custom/__init__.py:165
Integration: MELCloud Custom (documentation, issues)
First occurred: 06:16:15 (2 occurrences)
Last logged: 06:21:53
Error setting up entry [email protected] for melcloud_custom

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/melcloud_custom/__init__.py", line 165, in async_setup_entry
    hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

Any ideas, how can this be addressed?
Zrzut ekranu z 2023-05-05 06-29-59
Zrzut ekranu z 2023-05-05 06-30-19

Out of curiosity: how do you calculate the COP with an external kWh sensor?

The same as without. But you can then use the measured used energy data instead of calculated/guessed of the heat pump.

What do you mean? There are only uessed values i melcloud?

If you use the curl command from this topic you should be able to see DailyHeatingEnergyConsumed and
DailyHeatingEnergyProduced
And for DHW and cooling as well. These are all not measured exactly but calculated internally. They can be off a fair amount if you use an external meter.

Ah yes, that is what I use.

Hi all,

I’ve got a problem with this command

curl -v -H "X-MitsContextKey: XXXXXXXX" "https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/Get?id=XXXXXX&buildingID=XXXXXX"| jq ".[].Structure.Devices[].Device.DailyHeatingEnergyProduced"

This is the error I get in the logs

Logger: homeassistant.components.command_line.utils
Source: components/command_line/utils.py:54
Integration: command_line (documentation, issues)
First occurred: 5:20:40 PM (31 occurrences)
Last logged: 6:20:40 PM

Command failed (with return code 5): curl -v -H "X-MitsContextKey: XXXXXXXX" "https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/Get?id=XXXXXX&buildingID=XXXXXX"| jq ".[].Structure.Devices[].Device.DailyHeatingEnergyProduced"

And then another error which I think might have something to do with it

Logger: homeassistant.components.command_line.sensor
Source: components/command_line/sensor.py:139
Integration: command_line (documentation, issues)
First occurred: 5:20:40 PM (31 occurrences)
Last logged: 6:20:40 PM

Empty reply found when expecting JSON data

This one is in secrets.yaml

melcloud_curl: 'curl -v -H "X-MitsContextKey: XXXXXXXX" "https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/Get?id=XXXXXX&buildingID=XXXXXX"| jq ".[].Structure.Devices[].Device"'

The key en ID’s are correct. When I execute this command in the proxmox terminal it works.
Only the last line is an error.

jq: error (at <stdin>:0): Cannot index number with string "Structure"

sensor.yaml

#############################################################################################################
## Uitlezen melcloud informatie                                                                            ##
#############################################################################################################
#https://community.home-assistant.io/t/mitsubishi-melcloud-integration-with-home-assistant/26275/366
- platform: command_line
  command: !secret melcloud_curl
  name: ecodan_cmd
  json_attributes:
    - DailyHeatingEnergyConsumed
    - DailyHeatingEnergyProduced
    - DailyHotWaterEnergyConsumed
    - DailyHotWaterEnergyProduced
    - DailyCoolingEnergyConsumed
    - DailyCoolingEnergyProduced
    - FlowTemperature
    - OutdoorTemperature
    - ReturnTemperature
    - TargetHCTemperatureZone1
    - SetTankWaterTemperature
    - TankWaterTemperature
    - OperationMode
    - UnitStatus
    - OperationModeZone1
    - HeatPumpFrequency
  value_template: "OK"
  scan_interval: 120
  command_timeout: 30

I’m a beginner with HA and linux so it’s hard to figure out what’s wrong.
What I did so far.

  • jg install via proxmox
  • python3 install via proxmox
  • home assistant update via proxmox

So does anybody have an idea what might be the problem here?

Since the last update (to Ha 2023.5.2) 2 days ago (7. 5. 2023) this code (REST sensor) doesn’t work for me anymore. Does anybody have a similar issue? It shows all attributes (frequency, energy consumed,…) as ‘unknown’.

I only use the integration, do you tested if you get the values via the website via rest?

I have since 5 days connection loss info from melcloud but the connection is working.

May they are working on the cloud…

I tried accessing melcloud from chrome, developer mode and it shows responses for ‘ListDevices’ as it should:

Then I tried curl:

curl -v -H "X-MitsContextKey: XXXXX" "https://app.melcloud.com/Mitsubishi.Wifi.Client/user/ListDevices?id=YYYY&buildingID=ZZZZ"| jq ".[].Structure.Devices[].Device"

Which returns (after the handshake, which seems ok):

 GET /Mitsubishi.Wifi.Client/user/ListDevices?id=XXX&buildingID=YYY HTTP/2
> Host: app.melcloud.com
> user-agent: curl/7.68.0
> accept: */*
> x-mitscontextkey:ZZZZZZZ
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 401 
< date: Mon, 08 May 2023 11:44:20 GMT
< content-type: text/html; charset=utf-8
< content-length: 37
< cache-control: no-cache, no-store, must-revalidate
< pragma: no-cache
< expires: -1
< server: Microsoft-IIS/10.0
< strict-transport-security: max-age=63072000; includeSubDomains
< x-robots-tag: noindex, nofollow, noimageindex
< x-content-type-options: nosniff
< access-control-allow-origin: *
< 

* Connection #0 to host app.melcloud.com left intact
{ Success: false, ErrorMessage: ""}

Not sure what’s wrong.

*** Update!

Resolved the issues above:

  1. Few days ago, X-MitsContextKey was changed. Had to change it in HA config.
  2. The structure of the JSON is a little different for my heatpump. It includes ‘Floors’ and the full working command is
curl -v -H "X-MitsContextKey: xxxx" "https://app.melcloud.com/Mitsubishi.Wifi.Client/user/ListDevices?id=yyyyy&buildingID=zzzz"| jq ".[].Structure.Floors[].Devices[].Device"**

Does anyone else have problems with melcloud? I have 3 air condition devices and today HA doesn’t connect to melcloud… Melcloud app on my phone works ok, melcloud web page also, so problem is, as it seems, not on Mitsubushi’s site. When i reload melcloud in HA i get error:

Cannot connect to host app.melcloud.com:443 ssl:True [SSLCertVerificationError: (1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)’)]

If i delete integration and try to add it again i get this after entering user/password:

and it won’t add anymore at all…
I did update my router’s fw yesterday… can be anything related? But, then, i guess that android app wouldn’t work also…?

since 5PM CEST time, i have the same issue with my automations:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1124)

Same problem here!

Ufff…thanks, guys… i’m just a little bit relieved, since in this case it’s not a problem in my HA/router…
so, it must be something “global”…?

pretty sure mitsubishi changed things, but it would be nice to communicate it upfront, also no possibility to request tokens on melcloud app :frowning:

I noticed that certificate on web page - when i login into melcloud.com - is prety new, since start date is 28.4.2023. But, it couldn’t be this, since in that case things would go south a good 10 days ago already…

Also I was logged out from melcloud app and cannot login anymore…