Connecting to Midea...
 
Notifications
Clear all

Connecting to Midea MSmartHome using a PC

364 Posts
13 Users
23 Reactions
21.4 K Views
cathodeRay
(@cathoderay)
Famed Member Moderator
6888 kWhs
Joined: 2 years ago
Posts: 1390
Topic starter  

I may or may not have made some progress on this Holy Grail. The goal is to be able to download historical power consumption and capacity data etc to provide a record of this data plus calculated COPs over time.  

I have found a couple of python modules that claim to be able to connect to Midea appliances (the names are also links to the github pages):

(1) midea-beautiful-air

(2) msmart

Both can see my Midea controller on my local network, and both report stuff like IP address, port, tokens and IDs and what looks like Midea's server:

Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False

but that link just gets  

{"msg":"调用业务系统异常(访问地址不存在) [no Route matched with those values]","code":40404}

This indicates the url is something, but I am not using the right full url to connect.

I can ping the device ip address but not connect to it... The connection strings produce authentication errors.

I will carry on testing. If anyone else fancies working on this as well, I would very much welcome that. 

 

 

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


   
Quote
cathodeRay
(@cathoderay)
Famed Member Moderator
6888 kWhs
Joined: 2 years ago
Posts: 1390
Topic starter  

I have now managed to connect to the Midea Cloud, but can't get anything from it:

>>> cloud = connect_to_cloud(
account="email", # Account e-mail
password="pass", # Account password
appname="MSmartHome"
)
>>> cloud
<midea_beautiful.cloud.MideaCloud object at 0x000000000xxxxxx>
>>>

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


   
ReplyQuote
Mars
 Mars
(@editor)
Illustrious Member Admin
16899 kWhs
Veteran
Joined: 3 years ago
Posts: 2337
 

@cathoderay, thanks for starting this useful thread.

This just reaffirms my thoughts about heat pumps – they are ridiculously overcomplicated in some ways and things they should be doing (like telling you what the COP of your system) they don't want to willingly do. 

I come from a geeky background so I'm not put off by doing overly techy stuff, but 99% of homeowners don't have the time, inclination and/or money to go to such great lengths to figure out what their heat pump is up to.

Cynically, this makes me think that manufacturers don't want to be sharing this data with homeowners or they're trying to mask the "truth" about performance

Very curious to see how your project turns out @cathoderay.

Buy Bodge Buster – Homeowner Air Source Heat Pump Installation Guide: https://amzn.to/3NVndlU

Follow our sustainability journey at My Home Farm: https://myhomefarm.co.uk


   
ReplyQuote



cathodeRay
(@cathoderay)
Famed Member Moderator
6888 kWhs
Joined: 2 years ago
Posts: 1390
Topic starter  

@editor - thanks, and I agree with everything you say, especially the not at all out of place cynicism about manufacturers' ways with data. I've said it before, but it's worth mentioning again, that dieselgate is a reminder of how far 'reputable' manufacturers will go to make the numbers look good. Part of the answer with our heat pumps is to make use of data that hasn't been 'touched' by the manufacturer, eg external kWh meters of known accuracy, which can reliably tell us what is going into the system, but we still have the problem of measuring output, hence my attempts to estimate it from heat loss calcs, which again are totally untouched by the manufacturer. Intriguingly, the COPs I got doing that were nearer 3, while the Midea numbers gave a COP nearer 4. The problem, of course, is we don't know how accurate estimating heat output using calculated heat loss as a proxy is. 

I've tried various approaches to connecting to the Midea server using the various Midea related python modules/packages and libraries, and I am now even more sure I am at a basic level making a connection. Buried on the responses are snippets that couldn't possibly have got there by chance eg there is registered time which corresponds exactly with when I first registered my account on the server using the mobile. As this is being recovered using my PC, which has no connection with my mobile, it seems I must be getting into my account on the Midea server, there is no other way that date/time could appear. There are other clues eg 'name':'ASHP' despite the fact the python libraries are intended for use with air conditioners. There is also 'type':'0xC3', I think if this was an air conditioner response it might be '0xAC'. Part of the problem is the handshaking is fiendishly complicated, it appears to involve not just user ids (as in email address) and password, but a whole host of dynamic tokens keys sessionids and heaven knows what else. This seems absurdly over-complicated for what are after all domestic accounts. The cynic in me wonders whether it is a smokescreen to take our eyes of the possibility that there are Chinese operatives in white coats zooming in on our personal data. What if one day in my imagined nightmares the same operatives send a turd down the line that takes out my router and zaps my PC, or even worse, gets hold of sensitive data?  

The other problem is that, as I mentioned, these python libraries are set up for air conditioners. They can use the same app as ASHPs use, MSmartHome, but they use a different model code (probably the 0xC3/0xAC codes above) and these are hard coded into the python code. What I am trying to do at the moment is work out the API endpoints. One candidate is https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/appliance/user/list/get which does get a response but it is not exactly helpful: {"msg":"签名缺失 [sign is empty]","code":44001}. There is a sign key: value pair in another response but adding &sign=blahblahblah to the url still gets the same response. Another 'clue' is the v numbers, it seems likely MSmartHome uses a v3 or v5 endoint, which adds even more security, the other apps use v1 (and a different base url), and yet the url above has both v5 and v1 in it! Lastly, as is often the way with python libraries, the documentation is sparse, and all too often wrong, eg it may say use id= when in fact you need to use appliance_id= in the code. Sometimes the python error message gives a clue, but more often that not it doesn't. 

It seems that although a number of coders have accessed the Midea server for air conditioners, no one appears to have done it for ASHPs. This may be because simply no one has got round to doing it, or it may be because it is just too darn complicated! I will keep beavering away...   

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


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

@cathoderay I actually suspect that Midea under reports its COP figures. My power use for the whole house is 1.6kw when the ASHP is ticking over - the App reports 2kw. The latter clearly isnt true so I suspect its rounding up to the nearest single digit. I am clearly not sure on heat delivered. As I said in another post, Midea has said they are working on a decimal point update. I'll go back to them on Monday to see when we might expect that update.

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
6888 kWhs
Joined: 2 years ago
Posts: 1390
Topic starter  

@batalto - I agree, I too have noticed the curiously always whole number kWh numbers (the ambient temp does however have decimals). I suspect both the kWh in and kWh values are always rounded up, that will partly cancel out for COP purposes but not entirely as the rounding as a percentage of the actual value will tend to be larger for the lower kWh in values (1.1 -> 2 is proportionally a bigger jump that 5.1 -> 6). We also need to bear in mind these are all only compressor numbers, the ASHP is also guzzling other kWhs through its circulating pump etc, and we don't even know how it determines the kWhs out number, surely the most tricky one to get right. That said, if we use the COP as only a relative number, my COP today compared to my COP last week, then it does have utility.

I have emailed MSmartHome about the downloads etc, thanks again for letting me have their email address.    

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


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

@cathoderay I think KWh out is actually quite easy. It knows the flow temps in and out and know the flow rate. 1kw heats 1m3 of water by 1 degree. 

The formula is Power needed/delivered (KWh) = (4.2 × L × T ) ÷ 3600    : where L is litres (flow rate) and T is the temp change. We can take the temp change as our delta and there you go

That's probably the most accurate figure in the whole system (but its probably still using rounded figures!)

someone please correct me if I am being an idiot here.

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
(@derek-m)
Illustrious Member Moderator
13705 kWhs
Veteran Expert
Joined: 3 years ago
Posts: 4163
 

Posted by: @batalto

@cathoderay I think KWh out is actually quite easy. It knows the flow temps in and out and know the flow rate. 1kw heats 1m3 of water by 1 degree. 

The formula is Power needed/delivered (KWh) = (4.2 × L × T ) ÷ 3600    : where L is litres (flow rate) and T is the temp change. We can take the temp change as our delta and there you go

That's probably the most accurate figure in the whole system (but its probably still using rounded figures!)

someone please correct me if I am being an idiot here.

Ignoring any losses, it takes approximately 1.167kWh of energy to raise the temperature of 1000l by 1C.

If a heat pump has a flow rate of 25l/min, and the DeltaT (DT) between LWT and RWT is 5C, the formula to approximate the heat energy produced would be:-

(L x 60 x DT) / 1167 = Energy Produced.

(25 x 60 x 5) / 1167 = 6.429kWh

If the electrical power input is say 1.8kWh, then the COP over that 1 hour period would be 3.57.

When the system is running in a fairly steady state, it should be possible to calculate a fairly accurate COP figure, but if the flow and DT are varying it will be much more difficult.

 


   
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6888 kWhs
Joined: 2 years ago
Posts: 1390
Topic starter  

Posted by: @batalto

I think KWh out is actually quite easy.

Yes, the formula is easy, but the measuring is not! Neither the flow rate not the LWT/RWT are constant, they vary continuously. That said, I have noticed my flow rate tends to hover around 1.4m3/h, and although the LWT/RWT vary, the delta T tends to be, as it should be, around 5. Using these numbers, and my last hour's energy consumption (2kWh), I get 

kWh = (4.2 x 1400 x 5)/3600 = 8.16 

which gives a COP of 4.08.

I think that is optimistic! And that is with a likely rounded up kWh in figure.

PS @derek-m just beat me to it, his COP looks more realistic, but still a bit high, its cool outside today.

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


   
ReplyQuote



cathodeRay
(@cathoderay)
Famed Member Moderator
6888 kWhs
Joined: 2 years ago
Posts: 1390
Topic starter  

Using @derek-m's formula and my numbers for the last hour, I get (23.3 x 60 x 5)/1167 = 5.99kWh, giving a COP of 2.995 (3 decimals places not because I believe them, just to avoid rounding to 3). Seems more realistic... In fact, energy in for the last 6 hours has been 2kWh for each hour, so the COP for the last six hours has been ~3, with ambients between 4-6 degrees.

@batalto - do defrost cycles show up in the Midea app - I haven't seen anything that looks like it might be one? It was below 5 ambient for most of last night. Does the ambient go up when it should be going down or staying the same, or maybe the set temp changes? Power in presumably stays the same, only the compressor is working in reverse.

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


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

@cathoderay to be honest I'm not sure. There might be a power spike overnight, but we set the dishwasher on timer for early in the morning. I'll take a look tomorrow morning as we have nothing on timer tonight. Any spike will have to be some kind of defrost.

Screenshot 2022 12 01 19 52 22 91 55ef112fdffe44c65de534f40acb2de5

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: 3 years ago
Posts: 1091
 

@cathoderay there might be a small spike from defrost in the image below. I think since we changed the settings we've had a lot less than we did last year. But it's not been really cold yet

Screenshot 2022 12 02 08 37 50 80 55ef112fdffe44c65de534f40acb2de5

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
Page 1 / 31
Share:

Join Us!

Latest Posts

Heat Pump Humour

Members Online

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