Monitoring & Controlling Ecodan via CN105

I’ve finally managed to get one of my systems hooked up using a direct serial connection using this Arduino sketch running on an ESP32 which is now reporting in via MQTT → Home Assistant → Emoncms.

Much respect to the author (Richard Broker according to his github profile) for writing and sharing a fabulous project building on the work done in some of the other github projects (credited in his github readme).

I’m not doing any control yet but thought it was worth sharing, in case anyone else is thinking of doing similar. Particuarly as it’s been a trying couple of weeks getting to this point! Probably worthy of its own topic once I’m out of rehab.

4 Likes

[I split into this post off as a new topic]

Nice work! How frequently do you get updates through this interface?

Thanks for the split @Timbones.

Looking at the MQTT data for temperature sensors, the updates are every 30 seconds.

In the past couple of days the code has been updated to support getting and setting the zone 1 flow set temperature which I have just tested (I’ve got this system running in fixed flow temp at the moment) and the updates are instant when setting values. I shouldn’t be amazed by this in 2023 but having used MELcloud for the past few years it feels like a big step up :rofl:.

2 Likes

Does it accept control commands over mqtt? If so, does it really need HA?

@Dan_Nichols - is there a discussion on the HA forum on this addin?

@mjr - Looks like it must be possible directly via MQTT. Ask the question on GitHub.

Looks like a neat integration!

I assume this can only obtain the same information as the ListDevices Json that can be scraped from MelCloud?
Although doing it locally and at a higher frequency sounds good.
Is it possible to have both the Wifi dongle (so MelCloud still also works) and this rigged up?

1 Like

@mjr @borpin it is using the MQTT integration to create devices/entities within HA.

It maintains it’s own MQTT namespace where it stores running values and accepts commands.

So you could use MQTT directly if preferred.

You can see a couple of examples below, with the respective MQTT paths for HA to send commands;

Home Assistant Cimate Device:

{
  "name": "climate_control_d475b629e748",
  "unique_id": "climate_control_d475b629e748",
  "icon": "mdi:heat-pump-outline",
  "device": {
    "ids": [
      "d475b629e748"
    ],
    "name": "Mitsubishi A2W Heat Pump",
    "sw": "v0.1.4",
    "mdl": "Ecodan Air Source Heat Pump",
    "mf": "MITSUBISHI ELECTRIC",
    "cu": "http://192.168.0.118/configuration"
  },
  "mode_stat_t": "ecodan/ashp2/climate_control_d475b629e748/state",
  "mode_stat_tpl": "{% if (value_json is defined and value_json.mode is defined) %}{{ value_json.mode }}{% else %}off{% endif %}",
  "act_t": "ecodan/ashp2/climate_control_d475b629e748/state",
  "act_tpl": "{% if (value_json is defined and value_json.mode is defined) %}{{ value_json.action }}{% else %}off{% endif %}",
  "temp_stat_t": "ecodan/ashp2/climate_control_d475b629e748/state",
  "temp_stat_tpl": "{% if (value_json is defined and value_json.temperature is defined) %}{% if (value_json.temperature|int >= 8.00 and value_json.temperature|int <= 28.00) %}{{ value_json.temperature }}{% elif (value_json.temperature|int < 8.00) %}8.00{% elif (value_json.temperature|int > 28.00) %}28.00{% endif %}{% else %}21{% endif %}",
  "curr_temp_t": "ecodan/ashp2/climate_control_d475b629e748/state",
  "curr_temp_tpl": "{% if (value_json is defined and value_json.curr_temp is defined) %}{{ value_json.curr_temp }}{% else %}0{% endif %}",
  "temp_cmd_t": "ecodan/ashp2/climate_control_d475b629e748/temp_cmd",
  "temp_cmd_tpl": "{{ value }}",
  "initial": 10,
  "min_temp": 8,
  "max_temp": 28,
  "temp_unit": "C",
  "temp_step": 0.5,
  "modes": [
    "heat",
    "off"
  ]
}

Home Assistant Switch to Force DHW:

{
  "name": "force_dhw_d475b629e748",
  "unique_id": "force_dhw_d475b629e748",
  "icon": "mdi:toggle-switch-variant",
  "device": {
    "ids": [
      "d475b629e748"
    ],
    "name": "Mitsubishi A2W Heat Pump",
    "sw": "v0.1.4",
    "mdl": "Ecodan Air Source Heat Pump",
    "mf": "MITSUBISHI ELECTRIC",
    "cu": "http://192.168.0.118/configuration"
  },
  "stat_t": "ecodan/ashp2/mode_dhw_forced_d475b629e748/state",
  "stat_t_tpl": "{{ value }}",
  "stat_on": "on",
  "stat_off": "off",
  "cmd_t": "ecodan/ashp2/force_dhw_d475b629e748/set",
  "cmd_tpl": "{{ value }}"
}
1 Like

@borpin I haven’t looked to be honest, I found this trawling github after failed attempts to implement some of the other projects for various reasons.

Technically, not a HA integration (it’s using the MQTT integration) but yes it is very neat and so far working very well (after resolving the stability issue with the ESP32 - described here Connection · Issue #3 · rbroker/ecodan-ha-local · GitHub).

@ajdunlop the limits to what data can be pulled from the serial port are still being discovered looking at some of the github projects, certainly all of the data/control that is available through MELcloud should be possible (most is already avalailable).

The near realtime updates are a big improvement over MELcloud, if you want to take action etc. based on certain events (such as a defrost for example) often they get missed by MELcloud in the polling gap.

3 Likes

Yes it is using the HA MQTT Discovery mechanism to ‘appear’ in HA, but that in itself doesn’t make it an HA Component. Equally, because of that, a correctly crafted MQTT message will control the unit.

2 Likes

@Dan_Nichols I want to try monitoring my heatpump using CN105. How do you connect rx, tx to esp32?Directly or level shifter is needed?

Hi @pcman, you need to use a level shifter as the Ecodan is 5V. I used one of these https://www.amazon.co.uk/gp/product/B095H64XSV.

1 Like

EDIT: Figured out that the CN105 is connected to the FTC board inside the Ecodan unit. And first gen Ecodan does not have it. Oh well.

@ajdunlop and for anyone else thinking of building an ESP32 powered CN105 ready serial adapter with MQTT/Home Assistant integration here is what I have built which has been working well for me for several months now. My systems are Ecodan FTC5/R410a with PAC-IF062B-E controllers, I believe these instructions will also work for systems with FTC6/R32 with PAC-IF072 generation controllers.

Caution: check your CN105 pins for voltage before connecting anything to ensure that you are not sending 12V into your ESP32 module etc. or it will be destroyed. I accept no responsibility for damage caused to Ecodan controllers/ESP32s or anything/anyone else. Proceed at your own risk.

ESP32 Module - https://amzn.eu/d/auL8aAL

I am using AZ-Delivery ESP32 Dev Kit C v4 modules and having tried some cheaper modules which had some stability issues I’d recommend avoiding the cheaper options. I believe that all ESP32 modules run 3.3V across the GPIO pins, however this module can be powered by a 5V supply which the CN105 on the FTC5 (and I believe FTC6) Ecodan provides. This avoids having to run a separate power supply to the ESP32.

3.3V ↔ 5V Level Converter - https://amzn.eu/d/gwUKwT5

The voltage across the serial tx/rx pins on the Ecodan is 5V, the ESP32 is 3.3V so a level converter is required.

CN105 Connector - PAP-05V-S - 5pin Pa Series Pap-05v-s Wire To Board Jst 2.0mm Pitch Connector To Pap Wire Harness - Buy Pap-05v-s Wire Harness,Jst Pa Wire,5pin Pa Wire Product on Alibaba.com

I ordered a sample from Alibaba as these were not readily available in small quanities at a sensible unit price in the UK.

If you prefer screw terminals you can mount your ESP32 module in something like this (also makes swapping the module simpler) Amazon.co.uk

I used a length of 4 core 24AWG to make the cable from the CN105 long enough that the module can be housed externally from the controller box (in a plastic project box) - https://amzn.eu/d/8Ff3POd

Below is the wiring diagram.

Last piece of the puzzle is to download Arduino IDE - https://www.arduino.cc/en/software

Then install the Espressif ESP32 libraries for Arduino IDE - Installing - - — Arduino ESP32 latest documentation

Plus any other missing library dependencies listed in the ecodan-ha-local readme

Then download the the ecodan-ha-local sketch (ecodan-ha-local folder and contents from the github project), connect the ESP32 via USB and flash the sketch to the board then follow the instructions in the ecodan-ha-local github readme.

It’s been a while since I installed and configured Arduino IDE so forgive me if I have missed any steps out!

Good luck.

3 Likes

Thanks for that, just need to decide whether or when to take the plunge and put this together.