Connecting to Midea...
 
Notifications
Clear all

Connecting to Midea MSmartHome using a PC

364 Posts
13 Users
22 Reactions
44.5 K Views
(@fishboy25uk)
New Member Member
20 kWhs
Joined: 2 years ago
Posts: 1
 

@cathoderay I've just had a Midea heat pump installed and I was struggling to even get the M-thermal controller to connect to my WiFi, although I've made a little bit of progress.

The only Android app that seemed to want to connect was the Midea "NetHome Plus" one - MSmartHome didn't find it - and even then, NetHome Plus won't let me see anything after adding, saying the "network is not very good" although I know I've got reasonable WiFi signal where the unit is.

The msmart Python module finds it but, like you, I can only see device type, IP etc. The type is "C3".

This "midea_ac_lan" integration for Home Assistant works ( https://github.com/georgezhao2010/midea_ac_lan) so I can now at least see flow and DHW temperatures in HA and modify it if I want to, but there are only basic controls and temperature sensors available and not KWh.

I've had a quick look at the Python code for the midea_ac_lan module and it's way over my head, but it's possible someone might be able to work out how to query extra parameters.


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

@fishboy25uk - only just spotted your post. It seems we have had similar frustrating experiences using the Midea app (defo shiteware in my humble opinion), but I hadn't come across the python code you managed to find, that does look promising, and it even explicitly mentions heat pumps (which is unusual, it's normally just air conditioning units). I'll have a look and see what I can come up with.

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

@fishboy25uk - we are definitely onto something. I'm running a weirdo Windows version of HA, but I managed to install midea_ac_lan manually, following the instructions on the github page you linked to, and it found my Midea controller automatically (a good sign), all the setting made sense, and I can now see my DHW tank temp in HA, and it is correct, ie it is the same as the temp showing on the wired controller. All done in about 15 minutes. I'll have a poke around in the python code and see if we can get to see other data.

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote



cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

@fishboy25uk - a bit of progress. I have managed to add an entity called Outdoor Temperature and can get it to collect some data. The key bit of code for getting the data is in \c3\message.py eg this gets the DHW tank temp:

self.tank_actual_temperature = body[data_offset + 21]

Various offsets get different values (as you can see in the code) and I have tried various offsets but none make credible outdoor temps, especially this one! 

Airing cupboard

But you can see the added entity. I think with time we might crack this. The Zone 1 Water-Temp by the way uses a binary sensor, it's either running or it is not, it doesn't give the actual LWT, at least on my setup.

 

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

A little bit more info gathered by turning on debugging (instructions on the github page, log is in \config\home-assistant.log):

midea_ac_lan requests data and then gets a 50 character string back that looks like this:

010d77910303231e323041231905371919053c223c14310080

this then gets decoded/parsed into something like this:

Status update: {'zone1_power': True, 'zone2_power': False, 'dhw_power': True, 'disinfect': False, 'fast_dhw': False, 'zone_temp_type': [True, True], 'mode': 3, 'mode_auto': 3, 'zone_target_temp': [35, 30], 'dhw_target_temp': 50, 'room_target_temp': 24.0, 'zone_heating_temp_max': [65, 55], 'zone_heating_temp_min': [35, 25], 'zone_cooling_temp_max': [25, 25], 'zone_cooling_temp_min': [5, 5], 'room_temp_max': 30.0, 'room_temp_min': 17.0, 'dhw_temp_max': 60, 'dhw_temp_min': 20, 'tank_actual_temperature': 50, 'outdoor_temperature': 25, 'zone1_water_temp_mode': True, 'zone2_water_temp_mode': False, 'zone1_room_temp_mode': False, 'zone2_room_temp_mode': False}

which just happens to have 25 name:value pairs in it, making me think the 50 character string has two characters for each name:value pair (note the above examples are with my added 'outdoor_temperature' entity, which retrieves something that isn't outdoor temperature). Then there is that data_offset, +21, for tank_actual_temperature, but the tank_actual_temperature name:value pair is the 20th, not 21st, name:value pair. Perhaps it is using zero based counting? This might mean '14' represents 50?

The midea v3 protocol (which is in use here) also has encode/decode 8370 but I can't make any sense of the code that does this.

Any thoughts anybody? The code is available here:

https://github.com/georgezhao2010/midea_ac_lan

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@batalto)
Famed Member Member
3655 kWhs
Joined: 4 years ago
Posts: 1091
 

@cathoderay just a simple one. Have you considered messaging the guy who wrote it?

12kW Midea ASHP - 8.4kw solar - 29kWh batteries
262m2 house in Hampshire
Current weather compensation: 47@-2 and 31@17
My current performance can be found - HERE
Heat pump calculator spreadsheet - HERE


   
ReplyQuote
(@batalto)
Famed Member Member
3655 kWhs
Joined: 4 years ago
Posts: 1091
 

@cathoderay just a simple one. Have you considered messaging the guy who wrote it?

12kW Midea ASHP - 8.4kw solar - 29kWh batteries
262m2 house in Hampshire
Current weather compensation: 47@-2 and 31@17
My current performance can be found - HERE
Heat pump calculator spreadsheet - HERE


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

@batalto - I've gone one further, started a new thread on his github ishoos page.

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
(@derek-m)
Illustrious Member Member
15283 kWhs
Veteran Expert
Joined: 4 years ago
Posts: 4429

   
ReplyQuote



cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

@derek-m - thanks, a bit pricey though, I think there may be open source alternatives.

Home Assistant is continuing to be the great time thief it always is. Yesterday I added the midea_ac_lan integration and managed to get DHW actual temp on the HA dashboard and available in History showing tank_actual_temp over time. Yesterday I had a DIY go at adding a new sensor entity for outdoor temperature and while I could get the option to show up, and could add the entity, it got the wrong data (see posts passim).

I then found some code buried in the midea_ac_lan git-hub pull pages which allowed me to add total_energy consumption and it worked! For a brief moment of glory, HA's dashboard showed the same total energy consumption as that shown in the wired controller. Proof of concept! It is possible to get custom data via wifi from the Midea controller! The necessary code was mostly just about understandable apart from the bit that actually gets and parses the data. Somehow you have to know the 'address' of the data, and then how to parse it, and I can't any references on how to do that anywhere. The actual relevant code that extracts and parses the data from the 'message. that comes back from the Midea controller is:

class C3Notify1MessageBody(MessageBody):
def __init__(self, body, data_offset=0):
super().__init__(body)
self.total_energy_consumption = (
body[data_offset + 4] +
(body[data_offset + 3] << 8) +
(body[data_offset + 2] << 16))
    

The key questions are how to know what data_offset to use, and where did the bitwise operators (<<) come from???

Now all that is history. The HA dashboard reports the Midea entities are unavailable. Nothing will resurrect them. I've no idea what terminated them but they are sure as hell terminated. Unfortunately I didn't take a screen grab, so you will have to take my word for the fact it did briefly work yesterday evening.

Nonetheless, I do have a History chart for the DHW, and it is rather revealing (this is why I persist in trying to get these things to work: they give you insights no manufacturer will ever tell you about). Basic parameters ate DHW set to 50 degrees, reheat kicks in at 40 degrees, timed to only happen between 1300 and 1400 daily. Here's the chart for yesterday:

DHW temp 3

 On the left hand side, we see what we would expect, the water temp low and falling until 1300 when the reheat hicks in, as by then the water temp was 39 degrees. It took about 20 minutes to do the reheat, and by 1330 the tank was at 50 degrees, as it should be. The rest of the chart is the interesting bit. The tank is a standard Telford Tempest large coil 200L ASHP tank. These are blagged as having negligible heat loss. I don't think so. Look at the right hand side of the chart, from 1330 onwards. The temperature drop is far from negligible. Two hours after the reheat it had dropped two degrees, over the next two hours it dropped another degree, and so on, until I turned my PC (and so HA) off. The only time I took off any hot water was around 1800, when I drew off enough to wash my hands. All the other heat loss is passive loss from the tank.     

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

I have now got the two Midea sensors back, by deleting the device and then re-adding it in Home Assistant. It looks like the token and key used to connect to the Midea wifi changed overnight... which could be an infernal nuisance if it happens all the time. Anyhow, for now, here is the proof of concept, a so-called card from my dashboard in Home Assistant, showing DHW tank actual temp (available out of the box) and total energy consumption (a custom addition, if it can be added, then hopefully others can as well): 

Airing cupboard 2

 

Midea 14kW (for now...) ASHP heating both building and DHW


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
9925 kWhs
Joined: 3 years ago
Posts: 1998
Topic starter  

I have now added something called History Explorer (<=link) to Home Assistant and things are looking up. You download a ~300kb javascipt file, add it as a dashboard resource (need to run HA in Advanced mode to have that option) and then add the card to a new dashboard (so there is no clutter). Here's the chart for the last few hours showing DHW tank temp and energy use: 

History Explorer

 The DHW is fine (and the temp does not appear to be dropping as fast today) but the energy consumption is a little ambiguous. It is based on the total energy consumption sensor, so somewhere some maths is being done. But its credible, and broadly agrees with what the Midea app shows.

History Explorer has two very useful features. Firstly, it is very interactive eg I can change intervals, slide the charts left and right etc. I can change from looking at what happened in the last hour to all last month in a few clicks. Secondly, it allows you to download the data in csv format - extremely useful

Midea 14kW (for now...) ASHP heating both building and DHW


   
👍
2
ReplyQuote
Page 2 / 31
Share:

Join Us!

Heat Pump Dramas?

Thinking about installing a heat pump but unsure where to start? Already have one but it’s not performing as expected? Or are you locked in a frustrating dispute with an installer or manufacturer? We’re here to help.

Pre-Installation Planning
Post-Installation Troubleshooting
Performance Optimisation
✅ Complaint Support (Manufacturer & Installer)

👉 Book a one-to-one consultation now.

Latest Posts

x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security