Connecting to Midea...
 
Notifications
Clear all

Connecting to Midea MSmartHome using a PC

364 Posts
13 Users
22 Reactions
47.1 K Views
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

@derek-m - it's OK, I've already done them, I recall sometime in the past I missed something out in one of the other files, didn't crash the code, but nothing got recorded anywhere for the added variable.

I'm trying to think of a way of seeing if there is a Notify2 / 05 message type with some data. I did try duplicating the Notify1 /04 message type code with suitable changes but got nothing back. 

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


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

Posted by: @cathoderay

@derek-m - it's OK, I've already done them, I recall sometime in the past I missed something out in one of the other files, didn't crash the code, but nothing got recorded anywhere for the added variable.

I'm trying to think of a way of seeing if there is a Notify2 / 05 message type with some data. I did try duplicating the Notify1 /04 message type code with suitable changes but got nothing back. 

Was the Notify1 and 2 already in the code or did you add them?

There will be a limit on the packet size available, so to transmit more data may require more than one message. That is the way that I interpret the meaning.

Did you find anything in the HA code that may specify message structure? I noticed in some of the Python routines it loads data from HA before running the code.

 


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

Notify1 (elif self._message_type == MessageType.notify1 and self._body_type == 0x04: at bottom of C3\message.py) was in the original code from git hub, and is what i have been calling the 04/04 message type, the one that has the total energy data. Notify2 I tried adding, by duplicating and changing where necessary the Notify1 code, hoping to get a third (05) message type, with a different data, but I couldn't get it to work.

I've looked hard for some way of working out the message structure. It very quickly gets very complicated because of all of the to-ing and fro ing in the code. I'll have another go. I still think it may be the case that the structure (the carriages in the train, and what is in each carriage) is set in the wired controller, by some code we are not aware of, and what the midea_ac_lan code does relies on that fixed structure (so there isn't any code in midea_ac_lan specifying the structure, it just works with already structured data, if that makes sense). That does suggest though that the original developers of the code had some way of knowing what that structure is, I can't believe they found the structure/data by random experimentation. I did consider the modbus address tables might provide a clue, but haven't found anything yet.

The only other clue I have seen is in the app javascript, it has the same data structure as the 03/01 message type. Maybe that was the starting point for the midea_ac_lan developers, but it doesn't explain how the cracked the 04 message type.

    

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


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

@cathoderay

Actually, I don't think that cracking the structure may be too difficult, since we now have a reasonable idea of how the data is encoded. The reason that I suggested adding Bytes 10 to 20 was to see what further data may be in the message, which could then be monitored and compared to the displayed data, or adjustments made to settings to see where changes occur in the message.

This is where the 'make one change', then see 'what changes', logical approach that may take time, but often proves effective. 


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

Posted by: @fishboy25uk

@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.

I have just noticed that you can see the flow rate measurement, could you explain how?

 


   
ReplyQuote
(@filipe)
Estimable Member Member
Joined: 2 years ago
Posts: 62
 

Posted by: @cathoderay

I still think it may be the case that the structure (the carriages in the train, and what is in each carriage) is set in the wired controller, by some code we are not aware of, and what the midea_ac_lan code does relies on that fixed structure (so there isn't any code in midea_ac_lan specifyi

I think I mentioned a few days ago that the Midea Documentation that came with mine contained all the details. There is a small booklet called Operation Manual with section 8 entitled Modbus Mapping Table. 

Phil

image

   
ReplyQuote



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

Posted by: @filipe

There is a small booklet called Operation Manual with section 8 entitled Modbus Mapping Table

Yes, I have that booklet as well, the thing is the modbus mappings don't correspond with the midea_ac_lan mappings, as in they don't have the same addresses in any shape or form, and are not even in the same order. The table is useful though for what might be in the wired controller LAN messages that we are trying to get the data from. @derek-m I think has also said he thinks the tables may throw some light on the calculations needed.

Posted by: @derek-m

I have just noticed that you can see the flow rate measurement, could you explain how?

I think he meant flow (temp) and DHW temp, not flow rate and DHW temp. If you look in a 03/01 message there are temperatures, but the seem to be static settings, not readings from actual sensors.

I've added bytes 10 to 16 inclusive for now, because I don't want the code crashing. I haven't done the necessary in HA to get it into the database, because it will seriously bloat the database, at the moment the data is just being recorded in the log files. That's why I was trying to add the code the other day to get just the data we want logged to a text file. I'll see it I can find a way to parse the logs to pull out what we want. They do have a regular structure so it may be possible.

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


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

@derek-m - I've worked out a way of getting the data out of the log files, here's a snapshot (actual file will be csv):

image

As you can see, most of the bytes are static. Byte_09 continues to look like ambient (outdoor) temperature, byte_14 I think might be the set (not actual) LWT.

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


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

Posted by: @cathoderay

@derek-m - I've worked out a way of getting the data out of the log files, here's a snapshot (actual file will be csv):

image

As you can see, most of the bytes are static. Byte_09 continues to look like ambient (outdoor) temperature, byte_14 I think might be the set (not actual) LWT.

I believe that the ff (255) may be an end of data indicator, or a no data indicator, since the data you have captured is what normally appears in the type 04 message.

Adding extra parameters to the particular Python routine does not find any additional data, so the type 04 message either has fixed data, or the list requesting the data, located elsewhere, needs additional parameters to be added to collect more data.

 


   
ReplyQuote
(@filipe)
Estimable Member Member
Joined: 2 years ago
Posts: 62
 

@cathoderay I have got HA installed using Oracle VirtualBox on an old Lenovo i3. I didn’t want to make it a dedicated server at this stage. It’s still consuming 34W some would rather be down to 10W. Waiting for the HA App to report what had been discovered.

Phil


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

Posted by: @filipe

@cathoderay I have got HA installed using Oracle VirtualBox on an old Lenovo i3. I didn’t want to make it a dedicated server at this stage. It’s still consuming 34W some would rather be down to 10W. Waiting for the HA App to report what had been discovered.

Well done! Virtual machines are not easy from what I gather, which echoes my own experience, things like network access via the host's hardware being problematic. 34W is not ideal, but it is still less than an old fashioned 40W incandescent light bulb. 

HA should discover what it calls devices and entities pretty much straight away, at least those that it has inbuilt capabilities for. It can't connect to a Midea of branded Midea heat pump out of the box, you have to add a 'custom component', a modified version of midea_ac_lan (the code we have been discussing in this thread) to make the connection, and before you can do that, you have to 'discover' the heat pump using another python module.

All being well, I will publish the next post in my Beginner's Guide to Heat Pump Monitoring later today, which covers the generic basics of setting up HA, and then maybe another post over the weekend on how to set up the Midea bit. In the meantime, you may well manage to crack it by yourself! 

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


   
👍
1
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
Joined: 3 years ago
Posts: 2040
Topic starter  

Posted by: @derek-m

I believe that the ff (255) may be an end of data indicator, or a no data indicator, since the data you have captured is what normally appears in the type 04 message.

It does seems very possible it is an end of data indicator, given most of the message after it is made up of zeros, like this:

"04010000272c0000691106281e32302eff01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000014"

I'm not sure whether the f3 and 14 towards the end mean anything. The 14 stays static, but the f3 shows some variation (f2, f6, f4, f7, f4, f8 in a section of a log that I looked at eb, ef  etc in another).

The majority of the data in both of the message types (01 and 04) we have decoded is static. In the 04 message Byte_09 is all but confirmed as ambient temp, as it followed the drop in temperature overnight last night, and byte_14 increasingly looks like Set LWT, it went up overnight into the low 50s, as it should do with my current weather comp curve.

I'm leaning towards trying to get another message type, specifically the Notify2/05 type, to see, if we can get one, what data it may contain.

In the meantime, I am going to set up database recording of byte_14 (byte_09 is already being recorded). It will be interesting to plot ambient vs set LWT, which should of course mirror my weather comp curve. I rather suspect it won't be a straight line, nor a tight plot.    

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


   
ReplyQuote



Page 19 / 31



Share:

Join Us!

Trusted Installers

Struggling to find a reliable heat pump installer? A poor installation can lead to inefficiencies and high running costs. We now connect homeowners with top-rated installers who deliver quality work and excellent service.

✅ Verified, trusted & experienced installers
✅ Nationwide coverage expanding
✅ Special offers available

👉 Find your installer now!

Latest Posts

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