Connecting Home Ass...
 
Notifications
Clear all

Connecting Home Assistant to a Midea Heat Pump

207 Posts
15 Users
54 Reactions
12.3 K Views
(@filipe)
Estimable Member Member
466 kWhs
Joined: 1 year ago
Posts: 62
 

Posted by: @cathoderay

All he has done is use the modbus register address tables, and then wrapped it in that complex code. For example, he uses this to get the ambient temp:

  - platform: modbus_controller
    id: ${heat_pump_name}_107 # Outdoor ambient temperature 
    name: "hp_T4_outdoor_temperature"
    state_class: measurement
    register_type: holding
    address: 0x6B
    unit_of_measurement: "°C"
    value_type: S_WORD

whereas I do the same thing with:

    ambient = instrument.read_register(107, 0)

Nor do I need things like Visual Studio, I can edit my code in something like Notepad++. 

My entire code for collecting the minute by minute data is less than 100 lines. Complexity and obfuscation are not virtues!

You are not comparing similar things though! This is defining a sensor to HA. Once configured HA does the rest. That is what HA is all about. 

Phil


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

Posted by: @filipe

You are not comparing similar things though!

Absolutely! One is complex and obscure, full of endless indents meaningless to man, the other is simple and transparent. That is the whole point!

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


   
Transparent reacted
ReplyQuote
(@william1066)
Reputable Member Member
1333 kWhs
Joined: 1 year ago
Posts: 206
 

Posted by: @cathoderay

the other is simple and transparent.

I think it is disingenuous to not mention all the code that you likely have had to write or hard code to do the following.

#1 scale the register value
#2 present the correct unit of measurement when you chart it
#3 write out legends when presenting the the data
#4 the logic that controls how often this value is read
#5 configure the RS485 device (or TCP/IP config)
and probably many more things

Not to mention all the work to persist this data somewhere, and all the work to chart it.

On top of that you are likely "sitting on the shoulders of others" through all the libraries you have had to include in order to have your "single line of code" do anything useful at all.

 

 


   
Filipe reacted
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6909 kWhs
Joined: 2 years ago
Posts: 1391
Topic starter  

@william1066 - of course I am 'sitting on the shoulders of other' and I have never denied it, I always say what libraries etc I am using, minimalmodbus, Highcharts JS etc.

Yes there is extra coding, of course there is, but it is uncomplicated and easy for beginners to understand. The instruction 'read.register(address, decimal places) is a lot easier to understand than eight lines of HA mumbo jumbo. Python has various timer options, not complicated and easy to implement, almost down to a couple of lines of code. The data is written (appended) to csv files, simple and robust and easily backed up, as well as being easy to manipulate. Things like the chart units and legends just happen, or need minimal editing to make them happen.

Please don't forget that the background to all this for me is the Beginner's Guide (to heat pump monitoring). If I am going to be stupid enough to try to put that guide together, I need something simple and robust and easily enough understood by beginners as the basis for the write up. For countless reasons retold too many times, I personally do not believe HA and its kling-ons, or whatever they are called, do not meet that requirement.

Only the other day I came across yet another HA irritation. Instead of using human readable date/times in the database, it now uses timestamps. It just does things like this, random acts of sadism to make users' life hell. Yes I know there will be countless reasons why it was the right thing to do - but was it? Who knows, and frankly, in this parish, who cares?  

 

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


   
ReplyQuote
(@william1066)
Reputable Member Member
1333 kWhs
Joined: 1 year ago
Posts: 206
 

Posted by: @cathoderay

Instead of using human readable date/times in the database, it now uses timestamps.

I am not sure what you mean by "now uses timestamps", what did it se before?

I expect this comment is because you are not aware of the concept of the epoch, something that has been used for many years as an easy and convenient way to store date information.  If this is what you are talking about, this is a pretty trivial thing to manage given the helper functions available to convert this to whatever presentation format you need.

When I am using software that is made freely available and something irritates me I typically take the approach of "seek first to understand, before trying to be understood".  I certainly don't feel it is morally right to slander something given away for free.  In most cases the people writing this free software are significantly smarter than I am with way more experience than I have.  There is almost always a very good reason for the approach that was taken.


   
Filipe reacted
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6909 kWhs
Joined: 2 years ago
Posts: 1391
Topic starter  

@william1066 - I am perfectly aware of the Unix epoch and similar date systems used for example in spreadsheets, but they are machine friendly, not human friendly. For example, now is '1682574579000'. But which epoch? Is that in seconds or milliseconds??? On the other hand 2023-04-27 07:52:00 is instantly recognisable as a date and time, and is just as importantly instantly understood to mean fifty two minutes past seven on 27th April 2023.

HA used to store date/times in a human readable format, which made browsing the data much easier. Yes I know I can write a sql query that will convert the timestamp a human readable form but it is all very tedious and boring and such a PITA - in other words typical time wasting HA sh!te.

  

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


   
ReplyQuote



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

Posted by: @william1066

When I am using software that is made freely available and something irritates me I typically take the approach of "seek first to understand, before trying to be understood".  I certainly don't feel it is morally right to slander something given away for free.  In most cases the people writing this free software are significantly smarter than I am with way more experience than I have.  There is almost always a very good reason for the approach that was taken.

We're going to have to agree to disagree here. I do not agree that something given away for free is somehow above criticism (slander is the wrong word here, my comments and opinions are written, not spoken, and in any event they are fair opinions that a reasonable person might hold and even more to the point any fact based statements I make are true, so you can stick you implied allegations of defamation somewhere where the sun don't shine). Tesco give away their Club Card for free, no doubt backed by software written by people significantly smarter than me, does that mean it is above criticism? When I, or you for that matter, give our opinions freely on an open forum, does that mean we are above criticism? I am sure I can guess why they have made the change, but that does not mean I can't have a critical opinion of the change.

When I seek to become a channel of the Lord's peace, I prefer to take my lessons from higher authorities.  

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


   
ReplyQuote
(@filipe)
Estimable Member Member
466 kWhs
Joined: 1 year ago
Posts: 62
 

Posted by: @cathoderay

Yes there is extra coding, of course there is, but it is uncomplicated and easy for beginners to understand. The instruction 'read.register(address, decimal places) is a lot easier to understand than eight lines of HA mumbo jumbo. Python has various timer options, not complicated and easy to implement, almost down to a couple of lines of code. The data is written (appended) to csv files, simple and robust and easily backed up, as well as being easy to manipulate. Things like the chart units and legends just happen, or need minimal editing to make them happen.

Please don't forget that the background to all this for me is the Beginner's Guide (to heat pump monitoring). If I am going to be stupid enough to try to put that guide together, I need something simple and robust and easily enough understood by beginners as the basis for the write up. For countless reasons retold too many times, I personally do not believe HA and its kling-ons, or whatever they are called, do not meet that requirement.

 

On the one hand I admire your persistence in doing it your way. I have to imagine that you had prior Linux experience to get as far as you have got. On the other hand I would guess that by understanding HA better before embarking on coding you might have had an easier journey. 

I don’t share your view of HA or it forum. I find people helpful and that following all the guidance to get it doing things leads to a successful outcome for each step. I can imagine that if you published your solution on GitHub it would be quite easy for a beginner to install it provided it was integrated as Midea_ac_lan is. That has limited ASHP functionality compared with what you are aiming for, but it does it without fuss once installed.

Still each to their own. 

Phil


   
ReplyQuote
(@william1066)
Reputable Member Member
1333 kWhs
Joined: 1 year ago
Posts: 206
 

Posted by: @cathoderay

I do not agree that something given away for free is somehow above criticism

I believe that carefully worded, actionable and constructive feedback is welcomed by all involved in providing free software. 

The language that you have been using throughout this thread does not suggest that you are prepared to take that approach.  All of the below comments come from your posts.  While I understand that it may be frustrating to try to navigate a complex and sophisticated product such as HA ..... as open minded as I like to think I am, I struggle to associate the language below with constructive and actionable criticism.  Probably worst of all is that the last of your comments in the list below is of course a comment that I could say was directed at me specifically.

  • Indeed. HACS is a Right Royal PITA, bloated and painful to use.
  • do not believe HA and its kling-ons, or whatever they are called
  • More Home Assistant sh!te - why you really need Home Assistant like you need a hole in the head.
  • or the convoluted HA voodoo needed to get a sensibly rounded result
  • HA, as it looked as if it might have a convenient way of running my scripts. But of course it doesn't, [it does, by the way]
  • courtesy of HA bizarre world view that neither the past nor the future exist.
  • On the minus side, we have unassailable jargon, pointless complexity, code and guides written by sadists, forum bullies, and probably the most minus point of all, HA's willingness to destroy its own data.
  • HA's instability. Software that routinely corrupts its own data is not worthy of the label software.
  • appears, as you put it so well, to have been written by sadists.
  • as long as the HA sadists stay away.
  • HA is by far the worst software I can remember ever having the misfortune to use
  • Written by arrogant idiots for, well arrogant idiots.

 

 

 


   
Filipe reacted
ReplyQuote
cathodeRay
(@cathoderay)
Famed Member Moderator
6909 kWhs
Joined: 2 years ago
Posts: 1391
Topic starter  

@filipe - the history has determined how I have got to where I am. I started out thinking no point in re-inventing the wheel if someone has done it before, and initially HA looked like a good candidate, all the more so when I came across midea_ac_lan. Because HA uses Linux (which I only have very limited experience of), I was bound to Linux as the OS. I then found that HA hadn't so much invented the wheel as a complex gearbox and all too soon there were ball bearings everywhere and nasty grinding noises coming out of the box. Midea_ac_lan also turned out to be seriously limited in what it can do, mainly because it is primarily aimed at AC units (the clue is in the name), but also because of the undocumented and obscure Midea LAN connection requirements that cannot be bypassed. Despite extensive experimentation, with @derek-m's excellent help, I effectively hit a brick wall and couldn't get past it. That's when I switched over to a modbus over wired connection. It was revelation: things that were either impossible or painfully complicated in HA were a doddle, and just as importantly there was so much more that I could do. Again, just as importantly, I could avoid HA's unreliable database altogether, and use csv files instead (the data doesn't need a relational database, it is basically one large table with date/time rows and parameter columns) which are simple and robust. The python minimalmodbus module also makes modbus connections and data reading and, as it turns out, writing a doddle. Highcharts JS does visually pleasing charts with only a few lines of code (tell it the csv data file and what columns you want charted, and some labels and away you go). It has things like chart zooming built in (OK you need to tell it to make the chart zoomable), you can set your own choice of colours or use the default ones and so on. All my code is either in simple python scripts or html files with some CSS and javascript. 

As a relatively new, but not totally naive, beginner, I have thus managed to get a working system based simple python and web page coding. In contrast, HA continues to frustrate and annoy me. The emphasis is on frustrate and annoy me, as you very rightly say, each to their own. But as I started this heat pump monitoring journey saying I would also use it to write a beginner's guide to heat pump monitoring, it cannot come as any surprise that any such guide written by me is going to stem directly from my experience. If my experience, as a relative beginner, is that HA is complex and frustrating, whereas minimalmodbus and Highcharts is simple and effective, I am not going to write a guide that says use HA, in fact, given my experience, I am going to write a guide that says don't use HA.

I agree that sometimes the HA forum does provide answers, but my experience is that usually it doesn't. The only 'solved' thread that I started got solved by me, albeit after extensive reading about the problem (and once again, one of the problems was the obtuse HA documentations). The forum is littered with zombie threads where the OP appears to have given up/shot themselves in frustration while waiting for a solution. Another problem with HA is it's propensity for breaking changes in updates, an unfortunate consequence of having a gearbox that is more complex than it needs to be. Add the bizarre jargon, and it is simply just not for me. But, as ever, each to their own, if it works for you, or anyone else, that's fine (honestly!), but equally don't ask me not to be honest about my experience with HA.

It goes without saying, but I am going to say it anyway, HA aficionados are of course entirely free to write up their own threads both to promote HA and on how to use HA. 

With the heating season all but over, despite the current weather, I am planning on using the summer to switch over to Windows based monitoring. Python and Highcharts JS are effectively OS agnostic, and may well work on Macs as well, but I am most familiar with Windows, and the mini PC came with Windows preinstalled (which I made an image of before overwriting it with the HA image) so it should all be fairly straight forward. Famous last words, no doubt… 

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


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

@william1066 - there's no need to take it personally and in any event the last line you quote wasn't aimed at you. I remember writing it after reading some HA forum exchanges and HA documentation, and it represents my views on them, not you. I try to avoid ad hominem attacks; the comments above, if you review them, are about HA characteristics and culture, not individuals.

The fundamental problem is HA and I have different world views. I can't write 'carefully worded, actionable and constructive feedback' because I know even before my fingers touch the keyboard that the HA 'community' will not consider my feedback actionable because, in short, it will amount to simplify, simplify, simplify. And then simplify again. I would probably have more luck giving carefully worded actionable and constructive feedback to the Moonies that they might want to consider erasing Sun Myung Moon from their collective memory.

Instead of trying to turn HA into something it will never be, I have taken the alternative path of setting up my own much simpler system. That is a constructive response, though not one that affects HA in any way.

I am perfectly happy for HA to exist the way it is if that is what it's users want it to be, and promote itself in what ever way it wants. It can even criticise my approach as being written by a simpleton for, well, simpletons (in which case I will know it is targeting me, because it is written by simpleton singular, and that can only be me). But equally, I can also express my view (in whatever way — 'If liberty means anything at all it means the right to tell people what they do not want to hear' (Orwell) — though I am not setting out to offend individuals, but rather express my views on HA in, shall we say, a lively manner) that HA is not in my opinion suitable for beginners. Others are perfectly entitled to opposing opinions, and of course the right to express those opinions, however they wish (even if it offends me).

Surely the take away from all this is very simple: horses for courses, or as @filipe said, each to their own. Those who want complexity (and all that comes with complexity) can choose HA, those who want simplicity (and all that comes with simplicity) can choose something along the lines of my approach.

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


   
ReplyQuote
(@cashback)
Trusted Member Member
187 kWhs
Joined: 1 year ago
Posts: 27
 

@cathodeRay Who are these beginners you're hoping to help on their path to heat pump monitoring enlightenment?

I'm not sure, but I think if you were to tell a beginner that you have some python modbus stuff that'll graph their heatpump's behaviour, they'll be more inclined to think you have some limbless reptilian public transport mechanic that tinkers with heat pumps on the side. I do not agree that your approach is simple, since it requires knowledge of getting up and running with Python (and do you really want the job of educating every beginner that asks what Python is and how to use what you've made?).

In my humble opinion, we'd do well to collaborate and make a proper client library in Python/whatever that can be used on its own (akin to what you currently have) as well in a Home Assistant integration and beyond, not least because n maintainers is better than 1, not to mention the benefits of peer review that comes with open source.

Edit: that's not to say I think Home Assistant is simple, but with a proper, well written zero-code integration, for this particular use-case, it could be.

This post was modified 1 year ago 2 times by cashback

   
LeiChat reacted
ReplyQuote



Page 14 / 18
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