Mitsubishi Ecodan control to make use of Agile pricing


We’ve got a Mitsubishi Ecodan with Melcloud app, I’ve messed about with the settings and got a lot better COP figures but we’ve recently swapped over to the agile electricity tariff so I’d like to trigger the hot water to heat up when the electric rate is at it’s cheapest and come the winter do something similar with the heating.
I’ve seen a few users on here have written their own scripts to do this kind of thing but I have to be honest I don’t have a clue about any of this but I’m willing to lean if someone can point me in the right direction. Or is there an easier way of doing this?

I guess the main thing that prompted me to want to do this was the electricity pricing went negative the other Sunday so it would have been great if I could have set something up to automatically switch the legionella cycle on so it used a lot of electricity.


The rough outline of what you need to do is:

  1. Turn off or prohibit the regular water heating on the main controller.
  2. When you want the hot water cycle to start, tell Melcloud to “Heat now”…
  3. …and tell it how hot to heat the tank up to (optional).
  4. Plus some logic that monitors the price and decides when do heat the tank.

This would typically be done using pymelcloud, or similar to write a script.
Alternatively, there are plugins for HomeAssistant that can control Ecodan, and maybe also for Agile.

Note: it’s not possible to tell Ecodan to turn on the immersion directly, but setting the tank temperature high enough (say 55°) will eventually switch the immersion on.

How far along are you on this project?

1 Like

There are various Integrations for Agile (none official). You need to dig about a bit. None of them are completely ‘out of the box’ solutions, but HA is magic for the amount of control you can exert on anything IoT. Quickly becomes an obsession!

Hi Tim / Brian

Thanks for the replies, that very helpful! I’ve have to be honest I’ve not got anywhere with it yet, I’ve not used HomeAssistant before so that going to be another thing to learn but I’m looking forward to the challenge. I think from what I’ve read I’m best buying a Raspberry Pi and setting HomeAssistant up on that, by the look of it it will come in useful for other things.

I currently have the Hot water heating coming on at 2pm till 3pm with the timer, it heats the tank up to 42°C and that will last us till the next day, I choose 2pm as the outside air temp is usually at it’s highest so I get a better COP, same reason for the low temp (the lower the set temp the better the COP) and only heating it once during the day (this reduces the temp of the water your heating so you get better COP). Thankfully since I’ve swapped to Agile tariff the price has been pretty low at this time of day but I guess in the winter this will change to be cheaper during the early hours of the morning.
So yeah I was thinking a bit of logic to find the cheapest 30min slot (the majority of the time it just takes 30mins to reach the set temperature), then if the price is below a set amount (say 5p/kWh or negative) turn the temperature up to 60°C (the highest temp my heat pump will output), I might add something to only turn it up to 60°C if the price is negative or it’s been a few weeks since it was last run this high, I’m thinking this will allow me to turn the legionella cycle off completely.

For the room heating in the winter months I’d been running the heat pump 24/7 and at a low flow temp for best COP, originally I started off using the weather compensation but then swapped to the target room temp and found that to be slightly more efficient, I use the Melcloud timer to set to over night temp at 18°C and then at 6am ramp it up to 18.5°C and then up too 19°C at 8am, I ramp it down with the same 2h break at night. But now I’ve moved to Agile I definitely need to miss the usual 4pm to 7pm peak and start turning the flow temps up when the price is cheap.

I see @MyForest has wrote his own python script that goes way deeper than I want to go but it may be easier to just copy and modify what he has already done and hope I don’t run into too many issues. GitHub - MyForest/heatpump-act: Send commands to a heatpump to make it do things
Newbie question, does anyone know what MyForest runs this script in? I see you can run python scripts in HomeAssitant or would it be run on something else? Sorry I know I have a lot to learn!

Cheers Chris

1 Like

If you just want to try it out without buying a Pi, you can install it on an old laptop or something while you get familiar with it.

This is the strategy that I follow, which I find works well for my household.

An alternative strategy would be to switch to Octopus Cosy tariff, which gives you two cheap periods at 04:00 - 07:00 and 13:00 - 16:00 - perfect for heating up water in the afternoon.
But with Agile, even if you end up doing DHW in the coldest part of the day, it’ll likely be cheaper than Cosy. Figuring out which would be better overall is a much bigger consideration…

I do something similar when I have excess solar power, setting the heat pump to a higher temperature on those days.

One in three heat pump owners turn off legionella cycle completely. Depending on how your household uses hot water, you may be able to do the same. See this article by HeatGeek.

I think he runs it in Docker, which adds a layer of complexity if you’re not already familiar with it, but does bring some advantages when attempting to deploy the same solution.


Pis are a bit underpowered (even a Pi4). I bought one of the ‘Blues’ when they came out, but they stopped doing them for some reason and the Yellow seems a bit over priced IMHO. It seems that an X86 system is now favoured, either an old laptop, NUC, or a mini PC. If you happen to have a Proxmox system then there are scripts to install the HA OS (which I would suggest).

Legionella is only an issue if you heat and store potable water (i.e. the water you use). If the cold mains passes through a coil in the tank to heat the water to be used ‘instantaneously’ then there is no legionella risk.

This is very interesting, thank you. I’m considering getting a proper Mitsubishi remote room controller installed to replace the awful Honeywell stat that was supplied with my Ecodan, but I couldn’t see how I would configure the set back temperature overnight. The penny finally dropped after reading your message - use Melcloud’s timer function!

I’ve been running my own program for controlling the heating, which is finely tuned to get the maximum performance out of an otherwise mediocre system. Trouble is, it relies on several bits of cobbled-together technology, and sometimes it fails cos of an internet outage or a flat battery. I’d prefer to have local control that will keep working no matter what, though I’ll probably end up overriding it with my own control code anyway. Still undecided…

During the Saving Sessions that Octopus was doing last winter, I would boost the room temperature a bit just before hand, and then reduce it during the 1 or 2 hours. This seemed to work reasonably well, and might work well with Agile and Cosy too.


You can set times and temperature on the main system controller with the the remote room controllers when in auto adaptation mode (which is the only reason to have them). I have two as the system is zoned.

1 Like

Yes I have wondered about maybe doing this in the future. We have the main controller in our hallway, the ground floor is the coldest part of the house and the part we are more likely to want warmer. Adding a wireless controller to the upstairs landing set at a lower set point could allow us to schedule it to be in control at night and the main controller during the day.

There is also the option of using the Smart Grid inputs if you have a FTC6.
You could maybe wire something up to trigger a higher setpoint when electricity is cheap or just before a peak to get you over it and then force-off for the duration of the peak.

I plan to experiment with this for DHW connected to an Eddi so when a threshold is met of excess solar the heat pump will heat water.

It is unclear to me how it works with heating. It looks like a set flow temperature will be triggered if recommend-on or force-on are triggered. This might only be useful with a buffer tank.

After a bit more digging, it does appear that the Smart Grid inputs are useful for DHW (allowing the target temp to be increased a bit) but for heating this is designed for a large buffer vessel in the system where its temperature can be increased at times of surplus (cheap?) electricity and the HP stopped during constrained (expensive / High CO2e) electricity with the emitters fed from the stored energy in the buffer.

This site suggests that 30l is required per kW size of the system:

Tread on another forum where someone discovered that the circulation pump continues to run when force-off is triggered as it is assumed the house needs to be fed from the buffer during this period:
Mitsubishi Ecodan “Smart Grid” - what does it do? - Air Source Heat Pumps (ASHP) -

1 Like

Hi @cre

You might be interestde in an article I published on LinkedIn re controlling my Ecodan on Agile…



Hi Chris,

How did you get on in the end? I also have an Ecodan heat pump and would like to do exactly as you described.

Hi Rachel, I’ve read your article and would very much like to speak with you about your results. I have contacted you via LinkedIn.

Very interesting Rachel! Are you further refining the code or happy with the current status?
How are you controlling your Ecodan, through MelCloud or via Arduino (or something similar)?

Hi David, I’ve been working on some control algorithms as well. Happy to discuss if you want?

Hi Henri, thank you! I am no coder I’m afraid, just a lowly energy journalist who is struggling (ie failing) to install HACS in Home Assistant. I’ve cleared the cache and rebooted Home Assistant Green repeatedly, but still no joy. I simply cannot follow the next level of advice that you see in the specialist chatrooms. Not sure what to do next!

Hi David! Yes it becomes quite complex very fast.
I’m happy to have a quick call and see if I can help. No guarantees, but perhaps we jointly find a solution.

Henri, thank you that’s very kind. Are you free tomorrow? And how do we set it up?

Hi David, perhaps best to arrange via DM. Just sent you one!