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

Mitsubishi Heavy Industry Air Conditioner Code from ToniA add please #660

Closed
tonyfitzs opened this issue Apr 1, 2019 · 21 comments
Closed
Assignees

Comments

@tonyfitzs
Copy link

Version/revison of the library used

_Typically located in the library.json & src/IRremoteESP8266.h files in the root directory of the library.
version": "2.5.5"

Example code used

I love what you're trying to do with you IRremoteESP8266 project, I have a Mitsubishi Heavy Industry Air Conditioner that I would like to control with my home automation using your library. I have found another library that is able to read my remote and report back the correct codes, this library can be found on github here https://github.com/ToniA/arduino-heatpumpir, unfortunately, this library is designed to work on an Arduino Mega and I prefer to use an ESP or even a Sonoff running tasmota to control my AC
I have read on your wiki that if we are looking to have a protocol implemented and we find a project that already exists that we should tell you. so with that in mind I would like to ask you how I might go about getting your library to work with the code set that is attached as this is the library that works with my AC.

Other useful information

I'm happy to do some of the work but I'm not a Profesional programmer and I have already spent several hours trying to work out how to use the code created by ToniA to work with your code. If you can point me in the right direction I would be most grateful.

@crankyoldgit
Copy link
Owner

I'll try to take a look at it soon. In the mean time, can you please capture a few Raw signals from IRrecvDumpV2 and include them here, and please add what modes are set on the remote. That will help me verify what code I port across is working etc.

I assume this (https://github.com/ToniA/arduino-heatpumpir/blob/master/MitsubishiHeavyHeatpumpIR.cpp) is the code you're referring to. Correct?
If so, what make/model number is your specific unit? e.g. What's on the label of the head unit, and what does that other code detect it as?

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 7, 2019 via email

@crankyoldgit
Copy link
Owner

Thanks for all of that. I'll see what I can do shortly.

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 7, 2019 via email

crankyoldgit added a commit that referenced this issue Apr 8, 2019
- Full support (send/receive/decode/class) for 152 bit (ZMS) protocol.
- Limited support (send/receive) for 88 bit (ZJS) protocol.
- Unit test coverage for all added code.
  * Can accept and fully decode supplied real examples.
- Updated example code to handle new A/C types.

For #660
@crankyoldgit
Copy link
Owner

@tonyfitzs I've just created a branch which should support your A/Cs. If you care to try the mitsub-heavy branch (https://github.com/markszabo/IRremoteESP8266/tree/mitsub-heavy) it may work. At the least you can provide me with feedback on what does or doesn't work.

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 8, 2019 via email

crankyoldgit added a commit that referenced this issue Apr 9, 2019
- Add IRMitsubishiHeavy88Ac class.
- Unit tests for the class.
- Minor tweaks to existing IRMitsubishiHeavy152Ac class.
- Update IRrecvDumpV2.

For #660
@crankyoldgit crankyoldgit self-assigned this Apr 9, 2019
@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 10, 2019 via email

@crankyoldgit
Copy link
Owner

Thanks for all your efforts so far, I have spent several hours trying to get this to work, but for some stupid reason I am not able to load the library, I keep getting the error ir_MitsubishiHeavy.h: No such file or directory I'm not sure why.

That probably is the result of how you've downloaded (and where you've put) the code from that branch.
ir_MitsubishiHeavy.h currently only exists in the branch: https://github.com/markszabo/IRremoteESP8266/tree/mitsub-heavy

It's been a while since I used a custom branch with the Arduino IDE (assuming that's what you are using) but I think you need to download the ZIP file from that link, and remove the old "normal" files from and put them in place of them. It should then be able to find it.

I have attached the Arduino code I have been testing with. Also are you able to tell me how I work out how to set the different modes? I am using the TurnOnMitsubishiAC example as a base to get this working, and I can't seem to figure out how to define the different modes, not that it matters much at the moment as I can't even get the thing to load on my ESP.

No code attached that I could see.
But here is roughly how you change modes etc:
https://github.com/markszabo/IRremoteESP8266/blob/mitsub-heavy/test/ir_MitsubishiHeavy_test.cpp#L301

@crankyoldgit
Copy link
Owner

@sheppy99 may be better at explaining how to download and use custom branches, as he does it frequently.

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 10, 2019 via email

@crankyoldgit
Copy link
Owner

My guess is there is a release version of the library the Arduino IDE is still finding or using.

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 11, 2019 via email

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 11, 2019 via email

@crankyoldgit
Copy link
Owner

Try the following should work:

/* Copyright 2019 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
*     https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
*   * Don't just connect the IR LED directly to the pin, it won't
*     have enough current to drive the IR LED effectively.
*   * Make sure you have the IR LED polarity correct.
*     See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
*   * Typical digital camera/phones can be used to see if the IR LED is flashed.
*     Replace the IR LED with a normal LED if you don't have a digital camera
*     when debugging.
*   * Avoid using the following pins unless you really know what you are doing:
*     * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
*     * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
*     * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
*   * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
*     for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_MitsubishiHeavy.h>

const uint16_t kIrLed = 4;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRMitsubishiHeavy152Ac ac(kIrLed);  // Set the GPIO used for sending messages.

void printState() {
  // Display the settings.
  Serial.println("Mitsubishi Heavy A/C remote is in the following state:");
  Serial.printf("  %s\n", ac.toString().c_str());
  // Display the encoded IR sequence.
  unsigned char* ir_code = ac.getRaw();
  Serial.print("IR Code: 0x");
  for (uint8_t i = 0; i < kMitsubishiHeavy152StateLength; i++)
    Serial.printf("%02X", ir_code[i]);
  Serial.println();
}

void setup() {
  ac.begin();
  Serial.begin(115200);
  delay(200);

  // Set up what we want to send. See ir_MitsubishiHeavy.(cpp|h) for all the
  // options.
  Serial.println("Default state of the remote.");
  printState();
  Serial.println("Setting desired state for A/C.");
  ac.setPower(true);  // Turn it on.
  ac.setFan(kMitsubishiHeavy152FanMed);  // Medium Fan
  ac.setMode(kMitsubishiHeavyCool);  // Cool mode
  ac.setTemp(26);  // Celsius
  ac.setSwingVertical(kMitsubishiHeavy152SwingVAuto);  // Swing vertically
  ac.setSwingHorizontal(kMitsubishiHeavy152SwingHMiddle);  // Swing Horizontally
}

void loop() {
  // Now send the IR signal.
  Serial.println("Sending IR command to A/C ...");
  ac.send();
  printState();
  delay(5000);
}

@crankyoldgit
Copy link
Owner

@tonyfitzs I've added that example code to the branch we've been using. So, if you re-download the branch, it should appear for you as an example. I've compiled it, so I know it work at least that much. ;-)

If you use a different method other than Arduino to compile code to an Arduino then I'm happy to try it.

I personally use PlatformIO & Atom (& git) on Linux. They meet my developer needs more than the Arduino IDE does, but it should work just as well with this library. I'm just not as familiar with day-to-day operation of the Arduino IDE as typically only use it when someone reports a problem specific to it.

TL;DR: My setup is quite advanced and more complicated because I need to juggle multiple versions of the library at once and have a lot of automation for testing and building etc. It's far from a typical arduino user's env.

crankyoldgit added a commit that referenced this issue Apr 12, 2019
- Full support (send/receive/decode/class) for 152 bit (ZMS) protocol.
- Limited support (send/receive) for 88 bit (ZJS) protocol.
- Unit test coverage for all added code.
  * Can accept and fully decode supplied real examples.
- Updated example code to handle new A/C types.

For #660
crankyoldgit added a commit that referenced this issue Apr 12, 2019
- Add IRMitsubishiHeavy88Ac class.
- Unit tests for the class.
- Minor tweaks to existing IRMitsubishiHeavy152Ac class.
- Update IRrecvDumpV2.

For #660
crankyoldgit added a commit that referenced this issue Apr 12, 2019
crankyoldgit added a commit that referenced this issue Apr 12, 2019
crankyoldgit added a commit that referenced this issue Apr 13, 2019
- Full support (send/receive/decode/class) for 152 bit (ZMS) protocol.
- Limited support (send/receive) for 88 bit (ZJS) protocol.
- Unit test coverage for all added code.
  * Can accept and fully decode supplied real examples.
- Updated example code to handle new A/C types.

For #660
crankyoldgit added a commit that referenced this issue Apr 13, 2019
- Add IRMitsubishiHeavy88Ac class.
- Unit tests for the class.
- Minor tweaks to existing IRMitsubishiHeavy152Ac class.
- Update IRrecvDumpV2.

For #660
@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 14, 2019 via email

@crankyoldgit
Copy link
Owner

Can you check if "IRremoteESP8266.h" exists and contains kMitsubishiHeavy152StateLength. It should, or again, for some reason you are still trying to compile against a release version of the library, or it's still finding a release copy. Maybe you need to remove the Library via Library Manager?

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 14, 2019 via email

@tonyfitzs
Copy link
Author

tonyfitzs commented Apr 14, 2019 via email

@crankyoldgit
Copy link
Owner

I'm sure it's frustrating dealing with people who make stupid errors.

Haha. I'm not going to lie. ;-)

Glad it's working for you (so far).

crankyoldgit added a commit that referenced this issue Apr 30, 2019
_v2.6.0 (20190430)_

**[Bug Fixes]**
- Fixed problem where LG protocol used wrong duty cycle for repeat. (#687)
- Fix checksum calculation for Daikin protocols. (#678)
- Fix the byte array version of sendGree() (#684, #685)
- Fix artificial vs. real state creation on HaierAC. (#668, #671)
- Fix issues caused by having `MQTT_ENABLE` set to false. (#677)
- Fix compile problem when DEBUG is defined. (#673, #674)
- Fix Minor bug with MQTT_ENABLE False condition (#654)

**[Features]**
- Experimental support for DAIKIN216 (ARC433B69) (#690)
- Experimental support for Mitsubishi Heavy Industries A/Cs. (#660, #665, #667)
- Support more features of TCL A/C (#656)
- Add LEGO(TM) Power Functions IR protocol. (#655)
- Add Panasonic AC RKR model & Example (#649)
- DAIKIN/IRDaikinESP overhaul and add Comfort mode support. (#678)
  **WARNING**: Previous `sendDaikin()` calls may not work.
               Please recapture codes or use `kDaikinStateLengthShort` for
               `nbytes` in those calls.
- IRMQTTServer: Move MQTT server and other parameters to WifiManager. (#680)
  **WARNING**: Previous users may need to fully wipe/reset the
               SPIFFS/WifiManager settings by visiting
               `http://<your_esp8266's_ip_address>/reset` prior to or
               after update.
- Add Wifi filtering options to IRMQTTServer. (#679)
- Add advanced aircon/climate functionality to IRMQTTServer (#677)
- Initial prototype of a common interface for all A/Cs. (#664)
- Improve MQTT topic usage for feedback messages. (#663)
- Add multiple independent GPIO sending support via MQTT. (#661)

**[Misc]**
- Adjust kGreeHdrSpace to 4500 (#684, #686)
- Add Home Assistant mqtt climate instructions. (#682)
- Implement htmlEscape() to prevent XSS etc. (#681)
- Add F() Macros (#670)
- Update Daikin2's Cool mode min temp to 18C (#658)
- Change per byte bit-order in Electra protocol. (#648)
- Improve Daikin2 power on/off. (#647)
crankyoldgit added a commit that referenced this issue Apr 30, 2019
_v2.6.0 (20190430)_

**[Bug Fixes]**
- Fixed problem where LG protocol used wrong duty cycle for repeat. (#687)
- Fix checksum calculation for Daikin protocols. (#678)
- Fix the byte array version of sendGree() (#684, #685)
- Fix artificial vs. real state creation on HaierAC. (#668, #671)
- Fix issues caused by having `MQTT_ENABLE` set to false. (#677)
- Fix compile problem when DEBUG is defined. (#673, #674)
- Fix Minor bug with MQTT_ENABLE False condition (#654)

**[Features]**
- Experimental support for DAIKIN216 (ARC433B69) (#690)
- Experimental support for Mitsubishi Heavy Industries A/Cs. (#660, #665, #667)
- Support more features of TCL A/C (#656)
- Add LEGO(TM) Power Functions IR protocol. (#655)
- Add Panasonic AC RKR model & Example (#649)
- DAIKIN/IRDaikinESP overhaul and add Comfort mode support. (#678)
  **WARNING**: Previous `sendDaikin()` calls may not work.
               Please recapture codes or use `kDaikinStateLengthShort` for
               `nbytes` in those calls.
- IRMQTTServer: Move MQTT server and other parameters to WifiManager. (#680)
  **WARNING**: Previous users may need to fully wipe/reset the
               SPIFFS/WifiManager settings by visiting
               `http://<your_esp8266's_ip_address>/reset` prior to or
               after update.
- Add Wifi filtering options to IRMQTTServer. (#679)
- Add advanced aircon/climate functionality to IRMQTTServer (#677)
- Initial prototype of a common interface for all A/Cs. (#664)
- Improve MQTT topic usage for feedback messages. (#663)
- Add multiple independent GPIO sending support via MQTT. (#661)

**[Misc]**
- Adjust kGreeHdrSpace to 4500 (#684, #686)
- Add Home Assistant mqtt climate instructions. (#682)
- Implement htmlEscape() to prevent XSS etc. (#681)
- Add F() Macros (#670)
- Update Daikin2's Cool mode min temp to 18C (#658)
- Change per byte bit-order in Electra protocol. (#648)
- Improve Daikin2 power on/off. (#647)
@crankyoldgit
Copy link
Owner

FYI, this has been included in the newly released v2.6.0 of the library.

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

No branches or pull requests

2 participants