Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue with Capabilities Detect request parsing #8

Open
codewise-nicolas opened this issue Jun 28, 2023 · 12 comments
Open

Possible issue with Capabilities Detect request parsing #8

codewise-nicolas opened this issue Jun 28, 2023 · 12 comments

Comments

@codewise-nicolas
Copy link

I have a senville mini-split which is rebranded Midea. (https://senville.ca/9000-btu-mini-split-air-conditioner-senl-09cd/)
After following a long thread with the Esphome component I built the dongle and its working great.
However Power usage is reported as 0 (my unit may not have power sensor). Its also mis-detecting the fan swing as horizontal+vertical but my unit only has vertical. There is also a few other mis-detections I think.

I stumbled across this post https://community.home-assistant.io/t/midea-branded-ac-s-with-esphome-without-cloud/265236/789 which mentions on some devices the power usage may be in a different location.
the code is here

float StatusData::getPowerUsage() const {

Which eventually led me to https://github.com/reneklootwijk/midea-uart/blob/main/src/B5_parser.cpp
I think on my unit the B5 results may not be lining up with the code in this repo.

Here is the B5 request and response

[0;36m[D][ApplianceBase:162]: TX: AA 0E AC A2 00 00 00 00 00 03 B5 01 11 8E 4C 
[0;36m[D][ApplianceBase:063]: RX: AA 29 AC 00 00 00 00 00 03 03 B5 07   12 02 01 01   13 02 01 01   14 02 01 01   15 02 01 01    16 02 01 01   17 02 01 00   1A 02 01 01    DE DB 

Ive put spaces where i think the different capability ID's are split up.

Has anyone come across this ?
Any idea what I can try to see if this is the issue on my unit?

Thanks

@ramsaymike
Copy link

I have a Senville SENA/12 HF with the smartlight.me dongle. Works great but no Power or Humidity data returned. As indicated on the remote Inquiry section, it has this capability as well as lots of others that are displayed on the unit. Interestingly, it does get Outside Temperature (T4) and the .yaml text is similar for power and humidity? I am really looking for T3 - the outside coil temperature. I won't pretend to understand what you have written above but was wondering if you discovered anything! Thanks

@codewise-nicolas
Copy link
Author

Im sorry I did not do any further exploration of the code. I gave up on trying to get any of the other data from the unit.
It has been running great for what I need (controlling heat, ac, speed, etc) so I never touched it since.

You may very well have a similar situation as mine where the data from the unit is not being interpreted right.
The first step would probably be to access the log when the esp boots up and grab a copy of the request/responses, post them here or in another issue and try to interpret the T4 but it would require some knowledge and time to dig thru the log to match up where the data is and where the code expects it.

Outdoor temp parsing is on line 37 here

float StatusData::getOutdoorTemp() const { return getTemp(this->m_getValue(12), this->m_getValue(15, 15, 4), this->isFahrenheits()); }

I dont immediatly see any mention of "Coil" in that file, maybe its not a value the code is looking for ?

@ramsaymike
Copy link

ramsaymike commented Jan 5, 2024

Thanks for the reply. I'll probably just live with it... It really all started when I tried to understand the defrost logic the unit is using. I believe it is very crude and defrosting too often. It uses the outside coil temperature (T3) to assess frost buildup thus my interest in this parameter. The difference between outside temperature (T4) and T3 will increase as the heat transfer (due to frost) decreases. Unfortunately, it does not adjust for changing T4 so while it may work great at 0C it does not work well at -10. My old York heat pump uses a similar approach but adjusts for outside temperature.

I just looked at you B5 request and response. My TX is much longer and my RX is mainly 00 so something is very difference - I think...

@ramsaymike
Copy link

ramsaymike commented Jan 6, 2024

I just checked the log after booting as you suggested and see 2 sets of capabilities - CAPABILITIES REPORT and ClimateTraits (Midea) both of which are very similar. Maybe I'm looking at the wrong version???

... and am long retired at home for the winter in Bobcaygeon with lots of time on my hands....

@codewise-nicolas
Copy link
Author

In my situation, I think its mis-identifying the capabilities using the auto-detect mechanism due to my B5 being aligned differently than what the B5 parser is expecting. This was no big deal as I simply forced set what my device can do via the settings and disabled the auto-detect.

However, I did not see the word "coil" in the source code, so like i mentioned before, its possible that the code has not even been written to "read" the coil temperature - even if your device provides it.
https://github.com/dudanov/MideaUART/blob/main/src/Appliance/AirConditioner/StatusData.cpp
Screen Shot 2024-01-07 at 12 58 47 AM

If you can code a bit, maybe you can add that functionality to the project.
Once you identify where the data is, adding it should be pretty easy in that statusdata.cpp file.
Most likely T3 will be near where T4 is in the data stream as they are related.

For example

float StatusData::getIndoorTemp() const { return getTemp(this->m_getValue(11), this->m_getValue(15, 15), this->isFahrenheits()); }
float StatusData::getOutdoorTemp() const { return getTemp(this->m_getValue(12), this->m_getValue(15, 15, 4), this->isFahrenheits()); }

Indoor Temp is located in position 11, and outdoor temp is position 12. (Yes there is some more processing and whatnot because of C vs F but you get the idea)

@ramsaymike
Copy link

ramsaymike commented Jan 7, 2024

Appreciate the feedback. I'm still wondering about the version.. In https://github.com/dudanov/MideaUART there is no mention of the B5Parser at least none that I can find. I would think that the Midea protocol would be documented somewhere. Isn't the program just sending a request and interpreting the response? It seems overly complex trying to include everything Midea makes from fans to minisplits. I could - maybe - handle a little C but this C++ is way beyond me. I find it hard to even read.

I would greatly appreciate it if you could help me understand this line:

float StatusData::getOutdoorTemp() const { return getTemp(this->m_getValue(12), this->m_getValue(15, 15, 4), this->isFahrenheits()); }

my RX:AA 28 AC 00 00 00 00 00 03 03 C0 01 88 3C 7F 7F 00 00 00 00 00 65 24 0C 00 09 00 00 00 00 00 00 00 00 00 00 00 00 05 A8 58

I can get getTemp but do not understand m_getValue at all. Can you explain it? Sometimes 1 parameter, sometimes 3?
uint8_t m_getValue(uint8_t idx, uint8_t mask = 255, uint8_t shift = 0) const;

In in my RX, idx 12 - outdoor temp 0x01? or maybe 0x88 (starting at 0) How would you decode this? (Esphome reports -7C)

Appreciate any help you can provide...

MIke

@codewise-nicolas
Copy link
Author

Your right about B5 thing. That code is from another repo which was link too in the Thanks by this one (but not included as source).
The equivilent parsing is found

for (; cap.isValid(); cap.advance()) {

Its called from https://github.com/dudanov/MideaUART/blob/5f58f2e8e4d660593879d94f19a7f7b1ee3d0315/src/Appliance/AirConditioner/AirConditioner.cpp#L147C22-L147C39

The m_getValue call is a way to get data from the packet. For simiplicity of understanding the code just know that in that file there is a data packet its processing. To access the values in it, you call the ->m_getValue() function. passing it the index of what index you want.
I dont remmeber right now if its based from the 0th byte, of its from the data portion that the index starts counting.

So when it has m_getValue(12) for outdoor temp, its getting the value at index 12 of the packet and working with that value. Its also working with the value at position 15, and doing some things with C and F.

Are you sure your RX line is from a get status?
According to

void AirConditioner::m_getStatus() {
the get status should be 0x41, but i dont see a 0x41 in your line. I could be wrong but thats my understanding of the protocol.

Lastly, I think you should open up a new issue for this Coil Temp request and we can keep discussing it there.

@ramsaymike
Copy link

Well it looks like I just lost my long post...I have made some progress. Figured out that the Indoor and Outdoor temperatures are not where they should be but are there. Figured the basic calculation ((hex to decimal) - 50 )/2 which works.
If you can just confirm what software is loaded on you dongle - I am new to esphome. I will consider opening a new issue when I figure out what it is??? Thanks for all your help

@ramsaymike
Copy link

Now I am confused, The vendor (smartlight.me) says:

you can find esphome source for this component here https://github.com/esphome/esphome/blob/dev/esphome/components/midea/air_conditioner.cpp

Any idea what this means?

@codewise-nicolas
Copy link
Author

That URL is for the ESPHome code that is probably on your dongle.
Its specifically the interface between ESPHome and the dudanov/MideaUART library.

ESPHome is software that runs on ESP8266/ESP32 devices that when configured lets you control/interface a multitude of devices; one being the Midea line of heatpumps.
It uses 3rd party libraries, like the MideaUART one to communicate with those devices.

If you want to make changes to code and try it out on your dongle, you will need to get ESPHome and configure it for your needs, for Midea it should be more or less straight forward copy the sample from the ESPHome wesbite - or ask the vendor for the configuration file they used. Once configured you can try editing the library code MideaUART and re-compile and program the dongle. The ESP's with ESPHOME can support over the air updates, so as long as you dont break the code you can develop "remotely" (code, send the new FW to the dongle, wait for it to reboot, and see the results on your computer's log pretty quickly). Make sure you are setup to re-flash it via an uart however in case the code changes do break the code and you need a low level way to re-program the dongle.

@ramsaymike
Copy link

ramsaymike commented Jan 9, 2024 via email

@codewise-nicolas
Copy link
Author

Its been a pleasure trying to help. Feel free to reach out via email if you want to keep discussing this or need help with getting esphome working. I love tinkering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants