-
Notifications
You must be signed in to change notification settings - Fork 839
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
AC IR Code Addition? #354
Comments
OK, as a follow up, I've been successful in sending the new protocol type by altering the sendCOOLIX function in ir_Coolix.cpp. I still haven't been able to figure out the decode portion yet. This is what I'm using... `#if SEND_COOLIX // Set IR carrier frequency for (uint16_t r = 0; r <= repeat; r++) {
} |
Thanks. That's an awesome start. I'll clean it up and try to write a decoder for it in the next few days. Can you please indicate what exact make/models work for each protocols. You mentioned a checksum. Have you worked out how its value is calculated? If so, I can add that in as well. |
OK, so here's the thing...both of these protocols control both of the mini splits I own. I can interchange the wall panels and remotes and the systems both respond to each. The problem is that I only have one of each. Just for clarity, the difference between these two protocols is the temperature measurement used.....C° vs F°. The Coolix protocol uses C° as its temperature measurement control of choice with the remote and wall panel converting that to F° on the display. When increasing or decreasing the setpoint, if jumps by two F° which means that the setpoint displayed is not exactly the setpoint you're gonna get since the conversion isn't quite the same....but it's close enough. The new protocol uses F° and when changing the setpoint, it will increase by one F° up or down meaning increased accuracy for Farenheit, but the downside is there is a larger possible code count. The sendCOOLIX() and decode COOLIX works for these models for sure...I know I mentioned Midea in my original post, but my research indicates that these are simply rebranded Mideas being sold here in the US. Pioneer System Model RYBO12GMFILCAD (12K BTU) Sorry, I don't have model numbers for the remotes....I can't find anything on them anywhere. I have two of these wall controllers and one uses the old protocol and the other uses the new one. This remote uses the new protocol. I'm gonna go out on a limb though and say that both of these protocols would work with any Pioneer (rebranded Midea) that are manufactured. The 2017 catalog for these units is located here. The checksum is calculated by reversing the bits (e.g. 10010110 -> 01101001) of the first five bytes, summing them, subtracting them from 2^8, then modulo 2^8, then reversing the bits of the resultant byte. |
On a brief reading of your reply, I gotta say I'm confused.
This sounds like, to me at least, that you're saying that the existing Are you saying your units accept both commands? |
That is correct. Both units I own respond to each protocol. I guess the next logical question is if that's the case why do I need to send or decode the new protocol. The reason is that one wall panel controller I own controls using the Coolix protocol and the other uses this new one. My ultimate goal is the have the ability to control either system using its dedicated controller AND the home automation software I'm using AND having it update appropriately whether a control was initiated via one or the other. I've successfully accomplished this with one of my units who's controller uses the Coolix protocol....and now I'd like to do the same for the other one using this new protocol. All told...it's so that I can maintain a high wife acceptance factor for my home automation endeavors. |
Okay. That seems weird, but hey, I don't care. I'll just name it |
@bwze I've made an attempt to add a Any chance you can test it out? I've only got the single capture you provided in the initial report. If you have more captures, I'd be interested in adding them to the test data. The one you supplied is kind-of poor. It has a lot of variance in it's values. I had to turn up the tolerance (error margins) from 25% to 50% to get it to match. We can try to add setting temp/fan/modes etc in a later commit. |
Yep...that worked. I'll grab some more captures here this morning and post them a little later. |
The send routine? The decode (i.e. dumpV2 etc)? or both? |
I also note that your spreadsheet doesn't have any data for when the power is Off. i.e. We should fine which bits/byte to toggle to turn the power on and off etc. |
Sorry....too early. Yeah, the send routine (MQTT Serever) and decode routine (dumpV2) worked. Funny you should ask....the below output is for off. I also know what bits/bytes do the toggling... `⸮Encoding : MIDEA
|
I'm also noting that the 1st, 4th, & 5th byte also seemed fixed. e.g. 0xA1, 0xFF, & 0xFF respectively. Are their any other functions on the remote/unit etc? Or can we assume those bits are unused effectively, thus we could eliminate them from the bit-size, and bring it down from 48 to 24 bits of 'real' data. I also note that the capture in your initial report (which we match as 0xA10278FFFFF8) doesn't agree with your spreadsheet (ie. mode auto, fan auto, 65F = 0xA18263FFFF6E in the spreadsheet) |
I've updated the Google Sheet with notes above each of the Bytes to represent what the bits reference. Not sure on the original capture. This is what I get now when using the latest branch with the same settings of mode auto, fan auto, 65F... Encoding : MIDEA
|
Oh cool. It had me worried for a second. |
Oddball question. Does the remote/panel/whatever have a Celsius mode? and if so, does it change the transmit data, and how? |
The two wall controllers I have look exactly the same...but one uses the Coolix protocol and transmits in Celsius and the other uses this newer protocol and transmits in Farenheit. I see no way to switch them from one to the other....no dip switches or jumpers whatsoever. Another odd thing about these controllers is that they're really just wall mounted IR transmitters that are powered by the unit. If you follow the cable from the wall panel back to the unit, it terminates in a plastic case that when opened reveals a IR LED transmitter and a receiver. So when you press a button on the wall controller, it's the exact same thing as if you'd use the hand held remote....which seems weird to me, but hey....it works. Additionally, I've updated the Google Sheet with off payloads for 62-68.... Would additional dumpV2 captures be helpful? |
I think we have enough captures now. You've already done the bulk of the work decoding what the bits mean etc. I'm done for the night. :-) |
Too late :-) ....I just went ahead a did captures for 62 - 86, mode-auto, fan-auto. They're here in case anyone is interested. Starting from the top of the document....first capture is 62 on, then 62 off, and so forth to the end of the document with 86 on, 86 off. Also, just curious, what does it mean when I get the snippets of unknown captures after the main decoding sometimes. I'm assuming it's overflow? Timing slightly off? @crankyoldgit, thanks so much for your help....if there's anything else you need, please let me know. |
Those small 'unknown' messages are most likely IR noise that is being picked up. FYI, support for your device will be standard when 2.3.0 is released too. |
So I've got the automation software sending everything over in HEX ....minus the checksum. I felt like it would be way too difficult using the scheme I have in place in the automation software to calculate it there so I just focused on doing it in the ESP8266. Well......my eyes feel like they're bleeding after all the research I've done today on that topic. I'm calling it quits for a few days as my head is killing me. Apparently I have a looooong way to go before I understand bit manipulation in C++.... :) |
I know how you feel. I've got most of the basics working for setting the common options (power, temp, mode, fan) and checksum calcs etc. With some simple changes you could update/fix the checksum for the hex value on the ESP end. |
@bwze BTW, are you sure of the fan values? As it seems odd that the MED setting is larger than the HI setting. Just curious. (I'm reading from the byte notes) |
@crankyoldgit Mistake on my part.....MED is 010, not 101....sorry, I've corrected the comments on the Google Sheet. It's 2 am here....I think maybe I should go to bed. |
@bwze I've just uploaded my effort for the day in 6cf32e2 to the same branch Care to test it/try it out? |
@crankyoldgit I haven't forgot about testing this...it's just that I'm having to teach myself how to work with libraries in ways that are completely new to me. I've just been hacking code together for the last year or so and never properly learned all foundational stuff that I should have. That usually means I try this and it doesn't work....so I try something else and it doesn't work. Fast forward to a day later and I get lucky and it finally works...sort of. :) You'd probably laugh your ass off at some of the stuff I've got stitched together. Anyway, I can say for sure that the send and decode are working flawlessly....but I really want to try the set/get functions you put together....still wrapping my head around how to get those tested. Stay tuned....and thanks again... |
@bwze haha. I'm just like a duck, it all appears smooth on the surface, but underneath it's all chaos. ;-) So, that reminds me I didn't do example code for this one. Basically, grab one of the other AC examples and use that. That'll show you how to use it. |
* Initial check-in of Midea A/C support. Per Issue #354 * Midea protocol improvements. * Add IRMideaAC class to enable message construction for Midea A/C * Support basic settings (power, fan, standard temp, mode, sleep) * Unit tests for the class. * Add checksum verification to decode. * Update real example to a cleaner one. Re-tune tolerance lower.
Works like a charm....you sir are my hero. :-) |
\o/ |
Let me rephrase that....the set functions are working. I'm not sure if I'm using the get function correctly. I assume that the get function is looking for a command from the remote and captures and displays the state, fan speed, temp, and mode? Is that correct? |
FYI, this code is now merged in to the 2.3.0-dev branch. I'm going to mark this issue closed. If you find anything wrong, please report it in a new issue. |
@bwze In order to use them on a (incoming) capture etc, you'd need to put the e.g.
Or take a look at some of the unit tests. e.g. https://github.com/markszabo/IRremoteESP8266/blob/v2.3.0-dev/test/ir_Midea_test.cpp#L336 or different example in the toshiba unit tests: However, it uses the |
@crankyoldgit , just checking back in. I've successfully used the getBlah() functions to retrieve IR commands sent to the AC and have them publising via MQTT perfectly. What I have been unable to do is figure out how to use your checksum calculator for the hex values I'm sending over from my home automation software. I've can successfully send over the first five bytes (e.g. for power-on, mode-heat, fan-high, temp-72 --> a19b6affff)... but I'm not seeing how to use those values with calcChecksum to get the desired end result of a19b6affff72. I can't seem to find a function in irMidea.cpp that will allow me to accomplish this....I'm sure I'm just overlooking it....but still.... Could you point me in the direction of an example that might pull the wool from over my eyes? |
Excellent, thanks for the confirmation. As for your checksum issue, Longer answer: Basically you want to use any of the following code to learn what to do:
or
or
ObNote: calcChecksum() is a private method of the IRMideaAC object, so direct calls to it probably won't work unless you change that or copy the code etc. The last example should work as it uses only public methods/functions etc. |
Thanks @crankyoldgit for the point in the right direction... I got where I wanted to be with the following... uint64_t new_code = (code_from_software << 8); Also, I noticed that the timing was slightly off such that AnalysisIR wasn't picking up the protocol type like it would with the actual remote. I made the following changes to the timing and it seems to work flawlessly....it's the same timing as the Coolix protocol... #define MIDEA_TICK 560U |
@bwze advised different timings in #354 (comment) Using the same final result as suggested, but with a smaller common factor for the tick to aid the automatic timing corrections. Ref #354
Unless you use the value of I've adjusted the final timings accordingly, just using a smaller common tick factor. Let me know how it goes. |
@bwze advised different timings in #354 (comment) Using the same final result as suggested, but with a smaller common factor for the tick to aid the automatic timing corrections. Ref #354
* Progress commit, working but with debug and incomplete * Timers not working * Working Daikin decode, updated send & timer support * Remove set overflow * Dev branch for the 2.3.0 release. * Update README information * For v2.3 * General cleanup. * More instructions and links. * Add support for decoding Kelvinator A/C messages. (#332) * Add support for decoding Kelvinator A/C messages. * Add a decodeKelvinator() method. * Tweak Kelvinator timings to use a large-ish common tick size. * Unit test(s) for decodeKelvinator(). * Use a union for state to use less memory. * Add support for Kelvinator A/C decoding to the dump example code. * Initial support for sending Toshiba A/C messages. (#333) * Initial support for sending Toshiba A/C messages. * Add known-working A/C unit model info. * Add support for all A/C units in MQTT example code. * Update the AirCon HTML form to send all complex A/C types. * Correct missing Fujitsu A/C functionality. * Cleanups and move header1 to flash * Don't include Arduion.h in tests * Use new State data when decoding * Initial support for sending Toshiba A/C messages. (#333) * Initial support for sending Toshiba A/C messages. * Add known-working A/C unit model info. * Progress commit, working but with debug and incomplete * Timers not working * Working Daikin decode, updated send & timer support * Cleanups and move header1 to flash * Don't include Arduion.h in tests * Clean up a bunch of cpplint.py issues. * More linter/style issues fixed. * Fix a number of compiler warnings and allow unit tests to compile. - Unit tests don't pass yet. * Minor enhancements and working example * Move a bunch of #define's to the header file. Fix a few linter/style issues as reported by cpplint.py * Rework checkheader() & readbits(). Add unit tests for decoding. * Refactor checkheader() & readbits() to use a pointer for offset. This cleans up the code quite a lot & makes it more readable IMHO. * Add some unit tests for decodeDaikin() using real and synthetic data. This allowed the refactoring above to happen without causing issues. Note: Not all (old) unit tests are passing at this point. * Clean up some #define usage to make it more presentable and useful. * General code clean up (lint and style etc) * Fix setting econo, quiet, & powerful modes. Unit tests were failing because econo, quiet, & powerful modes were not mutually exclusive. Previous code did this. The manual confirms this is correct. i.e. setting one of these modes cancels the other conflicting modes. The relevant unit tests now pass again. * Update unit tests for getFan() & setFan(). - Update test cases to reflect new usage etc. - Minor code cleanup. * Powerful & Quiet, and Powerful & Econo are incompatible. Not Quiet & Econo. @sillyfrog correctly pointed out Econo mode & Quiet mode are not mutually exclusive. Created unit tests for those cases, as well as created unit tests for Econo mode. * Update old unit test output to new daikin message protocol. * Replace old formatted unit test data with data based on current sendDaikin() * The unit test routines need more capacity to handle larger outputs. e.g. sendDaikin() with repeats has more than 1000 entries. Bumped to 10k. * Fix Time/Timer methods. * Assigning 16bit values on to a char array caused issues on some architectures. * Cleaned up time(r) methods and correctly cleared/masked bits. * Unit Tests added for the time/timer related methods. * Turned off the DAIKIN_DEBUG flag. * Minor code quality cleanups. * Zero entire state on reset. - We were missing zero'ing of daikin[3]. * Add unit test coverage for Sensor, Mold, & Eye modes. * Set TIMEOUT to something more appropriate for A/C decoding. This reverts/alters an earlier change. * Initial support for decoding Toshiba A/C remote messages. (#340) * Initial support for decoding Toshiba A/C remote messages. For #339 * Update Toshiba timings based on user feedback. * Toshiba A/C always has at least one repeat according to @mwildbolz * Add outputing the state to a human readable format. * Typo: Fix an indent issue. * Update Daikin to similar spec as Toshiba A/C. (#349) * Add toString() & validChecksum() methods. * Refactor the code for calculating state checksums. * Add checksum verification in decodeDaikin() * Unit test coverage for all of the above plus setRaw(). * Change the debug code to be platform neutral and use toString(). * Fix a typo. * Make the example code more verbose. * Update tools. (#343) * Update tools. * Add RawToGlobalCache.sh bash script to convert rawData into Global Cache * Update gc_decode to handle air conditioners. * Fix a typo * Allow changing of the threshold of reported UNKNOWN messages. (#347) * Value is now easily set at compile-time and/or run-time. * Allow decodeHash() a.k.a. UNKNOWN message decoding to be completely removed. Ref: Issue #341 * Unit tests for Toshiba A/C based on captures from a remote. (#346) * Unit tests for Toshiba based on captures from a remote. Data provided by @mwildbolz * Update unit test for a 'real' power off example. * Update working status and known-working models etc. * Update Toshiba compatiablity list. @mwildbolz reported it works these particular models. * Update Kelvinator to similar spec as Toshiba A/C. (#348) * Add setRaw(), toString(), & validChecksum() methods. * Refactor the code for calculating state checksums. * Add checksum verification in decodeKelvinator() * Unit test coverage for all of the above. * BugFix: Formatting error when rawData values > UINT16_MAX. (#355) * Add new AutoAnalyseRawData tool (#345) * New AutoAnalyseRawData tool A bash script that attempts to automatically analyse raw data to find key values and details needed to aid writing appropriate sendXYZ() and decodeXYZ() routines. Very ALPHA code, only supports common space encoded message formats. * Improve AutoAnalyseRawData.sh * Provide more detail output and values in hex/dec/bin and MSB/LSB order * Remove some unused code. * Use 'bc' to do the base conversion, rather than my hacky attempt. * Add generation of suggested code to AutoAnalyseRawData * More improvements to AutoAnalyseRawData * Warn on > 64bit values * Duplicate/repeate detection. * Handle protocols without HDRs. e.g. Sharp. * Initial check-in of Midea A/C support. (#359) * Initial check-in of Midea A/C support. Per Issue #354 * Midea protocol improvements. * Add IRMideaAC class to enable message construction for Midea A/C * Support basic settings (power, fan, standard temp, mode, sleep) * Unit tests for the class. * Add checksum verification to decode. * Update real example to a cleaner one. Re-tune tolerance lower. * Update Sharp compatablity list based on feedback. (#357) * bugfix: Panasonic-based protocols have incorrect message gap. (#358) See issue #356 for more details. We were short by approx. 33.7mSecs. * Update release notes for next (2.3.0) release. * [PR] Magiquest Wands (#365) Send and decode support for MagiQuest wands. * Upgrade IRrecvDumpV2 to v0.3 (#363) * Simplify & improve IRrecvDumpV2 example code. * Bump version to v0.3 * Display human-readable out of compatible A/C messages. * Move display code to IRutils.cpp * Add unit tests for parts moved to IRutils. * Fix a number of minor display issues. * Layout of code in dumpV2 improved. * Set the UNKNOWN minimum threashold to 12 to reduce noise. * General housekeeping * Tidy up the parameter section and add more comments/help text. * [Bug] Fix an underlying off-by-one error in unit test helper code. This lead to correcting some off-by-one errors in other protocols. * Ensure IRsendTest::reset() does a better job of reseting. (#368) The unit test `reset()` function could allow data from previous unit tests to leak through. So, don't use a short-cut, do a full zero of the arrays. This also exposed situations where a `decode()` would still work after a `reset()`, hence a need to re-order some of the unit tests as `IRsendTest::outputStr()` does an `implicit reset()`. * Tweak Midea A/C timings based on user feedback. (#369) @bwze advised different timings in #354 (comment) Using the same final result as suggested, but with a smaller common factor for the tick to aid the automatic timing corrections. Ref #354 * Improve Fujitsu A/C support (#367) * Improve Fujitsu A/C support * Fujitsu AR-DB1 support. * add decodeFujitsuAC(). * Improve code quality. * More unit tests. * Add a lot of the 2.3.0 features for A/Cs to Fujitsu. * Update IRMQTTServer.ino to support the new state sizes. * Update IRrecvDumpV2.ino for Fujitsu A/C decoding. * Update IRutils.ino for Fujitsu decoding. * Add appropriate #ifdef's for A/C decoding to example code.
(Please use this template for reporting issues. You can delete what ever is not relevant. Giving us this information will help us help you faster. Please also read the FAQ & Troubleshooting Guide. Your problem may already have an answer there.)
Version/revison of the library used
v2.1.1
Expected behavior
Not really a problem with the expected behavior as much as a request for a new AC decoder...
Actual behavior
As far as I can tell, it worked exactly as it should have...
Output of raw data from IRrecvDumpV2.ino (if applicable)
Represents, Power: ON, Mode: AUTO, Fan: AUTO, Setpoint: 65°F
Encoding : UNKNOWN
Code : E656F582 (100 bits)
Timing[199]:
uint16_t rawData[199] = {4278, 4584, 488, 1668, 436, 588, 514, 1642, 564, 538, 488, 618, 438, 690, 360, 662, 410, 1718, 442, 610, 488, 666, 356, 640, 462, 666, 694, 356, 466, 616, 460, 1708, 448, 642, 412, 662, 518, 1582, 522, 1666, 440, 1690, 490, 1692, 464, 636, 442, 558, 540, 618, 410, 1662, 466, 1746, 462, 1666, 490, 1748, 544, 1528, 490, 1666, 562, 1644, 468, 1642, 406, 1744, 486, 1710, 448, 1746, 414, 1586, 548, 1708, 464, 1736, 494, 1616, 544, 1586, 466, 1742, 416, 1662, 518, 1662, 508, 1644, 692, 1464, 516, 666, 528, 472, 492, 584, 462, 5264, 4296, 4566, 466, 614, 468, 1738, 436, 588, 494, 1642, 508, 1672, 460, 1694, 490, 1664, 538, 486, 490, 1690, 518, 1690, 464, 1662, 490, 1692, 414, 1770, 410, 1662, 518, 590, 512, 1586, 516, 1722, 388, 638, 514, 536, 632, 516, 516, 516, 492, 1672, 500, 1694, 464, 1666, 518, 534, 468, 636, 380, 712, 478, 528, 598, 534, 466, 638, 458, 592, 410, 668, 462, 642, 404, 644, 490, 612, 412, 612, 542, 562, 466, 614, 460, 584, 468, 638, 466, 588, 488, 638, 384, 618, 512, 564, 490, 612, 542, 1638, 488, 1668, 438, 1740, 492}; // UNKNOWN E656F582
Steps to reproduce the behavior
Not sure you can if you don't have my particular AC, but I'm willing to work with you however possible...
Example code used
No code for this yet.....
Circuit diagram and hardware used (if applicable)
I'm using the scenario as decribed in IRrecvDumpV2.ino which is working perfectly...
I have followed the steps in the [Troubleshooting Guide]
Yes
Other useful information
So, here goes.....I have two Midea mini splits ACs that I'm attempting to control with the help of your library and an open source home automation software (Home Assistant).
I have successfully used the Coolix decode/send commands included in your library with a slightly altered version of your MQTT server example to successfully emulate total control of one of my mini split ACs from the software with no issues whatsoever. This, I guess confirms that the Coolix protocol is the same as the one used by Midea.
My problem, however, is that the other AC's remote uses a different protocol and I don't have enough experience to change ir_Coolix..cpp to allow it work.
The included Coolix (A.K.A. Midea) protocol normally sends six bytes of data as such....
Header
Spacer
Byte 0
Byte 0 (Inverse)
Byte 1
Byte 1 (Inverse)
Byte 2
Byte 2 (Inverse)
Long Gap
Header
Spacer
Byte 0
Byte 0 (Inverse)
Byte 1
Byte 1 (Inverse)
Byte 2
Byte 2 (Inverse)
This other remote sends six bytes of data too, but slightly differently...
Header
Spacer
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5 (Checksum)
Long Gap
Header
Spacer
Inverse - Byte 0
Inverse - Byte 1
Inverse - Byte 2
Inverse - Byte 3
Inverse - Byte 4
Inverse - Byte 5 (Checksum)
All of the timing seems to be the same as the included Coolix protocol (i.e. the headers, spacers, ones, zeros, bit mark, gap spacing, and carrier frequency look the same).
I have successfully, with research via the Internet and using Analysis IR software, decoded the other remotes byte structure....and it's somewhat similar to the Coolix protocol.
So, all of this to ask....would someone be willing to take a look at my IR captures and see if there is a way to add the ability to decode and send this other protocol via HEX?
IR Captures
The text was updated successfully, but these errors were encountered: