Skip to content

Commit

Permalink
Experimental detailed support for LG a/c. (#1009)
Browse files Browse the repository at this point in the history
* Initial detailed support for LG a/c.
* Support LG2 in IRLgAc class.
* Add different model support to handle LG & LG2 protocols.
* Power, Mode, Temp, & Fan speed control.
* Common a/c support.
* Unit tests coverage.
* Update supported devices list.
* Add unit test to check raw LG2 messages work.
* Ensure the Off command is always 0x88C0051

Fixes #1008
  • Loading branch information
crankyoldgit authored Jan 5, 2020
1 parent c5bc792 commit ad399c5
Show file tree
Hide file tree
Showing 13 changed files with 891 additions and 21 deletions.
6 changes: 4 additions & 2 deletions SupportedProtocols.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--- WARNING: Do NOT edit this file directly.
It is generated by './tools/scrape_supported_devices.py'.
Last generated: Mon Dec 16 10:23:29 2019 --->
Last generated: Sun Jan 5 15:53:26 2020 --->
# IR Protocols supported by this library

| Protocol | Brand | Model | A/C Model | Detailed A/C Support |
Expand Down Expand Up @@ -31,7 +31,8 @@
| [JVC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_JVC.cpp) | **Unknown** | | | - |
| [Kelvinator](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Kelvinator.cpp) | **[Green](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Kelvinator.h)** | YAPOF3 remote | | Yes |
| [Kelvinator](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Kelvinator.cpp) | **[Kelvinator](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Kelvinator.h)** | KSV26CRC A/C<BR>KSV26HRC A/C<BR>KSV35CRC A/C<BR>KSV35HRC A/C<BR>KSV53HRC A/C<BR>KSV62HRC A/C<BR>KSV70CRC A/C<BR>KSV70HRC A/C<BR>KSV80HRC A/C<BR>YALIF Remote | | Yes |
| [LG](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_LG.cpp) | **[LG](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_LG.h)** | 6711A20083V remote<BR>6711A20083V remote<BR>AKB74395308 remote<BR>AKB74395308 remote | | - |
| [LG](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_LG.cpp) | **[General Electric](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_LG.h)** | 6711AR2853M A/C Remote<BR>AG1BH09AW101 Split A/C | | Yes |
| [LG](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_LG.cpp) | **[LG](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_LG.h)** | 6711A20083V remote<BR>6711A20083V remote<BR>AKB74395308 remote<BR>AKB74395308 remote<BR>AKB75215403 remote (LG2)<BR>S4-W12JA3AA A/C (LG2) | | Yes |
| [Lasertag](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Lasertag.cpp) | **Unknown** | | | - |
| [Lego](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Lego.cpp) | **LEGO Power Functions** | IR Receiver | | - |
| [Lutron](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Lutron.cpp) | **Unknown** | | | - |
Expand All @@ -43,6 +44,7 @@
| [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | HC3000 Projector<BR>KM14A 0179213 remote<BR>MS-GK24VA A/C<BR>TV | | Yes |
| [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi Electric](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | 001CP T7WE10714 remote<BR>KPOA remote<BR>MSH-A24WV / MUH-A24WV A/C<BR>PEAD-RP71JAA Ducted A/C | | Yes |
| [MitsubishiHeavy](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_MitsubishiHeavy.cpp) | **[Mitsubishi Heavy Industries](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_MitsubishiHeavy.h)** | RKX502A001C remote<BR>RLA502A700B remote<BR>SRKxxZJ-S A/C<BR>SRKxxZM-S A/C<BR>SRKxxZMXA-S A/C | | Yes |
| [NEC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.cpp) | **[Aloka](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.h)** | SleepyLights LED Lamp | | - |
| [NEC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.cpp) | **[Yamaha](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.h)** | RAV561 remote<BR>RXV585B A/V Receiver | | - |
| [Neoclima](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Neoclima.cpp) | **[Neoclima](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Neoclima.h)** | NS-09AHTI A/C<BR>NS-09AHTI A/C<BR>ZH/TY-01 remote<BR>ZH/TY-01 remote | | Yes |
| [Nikai](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Nikai.cpp) | **Unknown** | | | - |
Expand Down
71 changes: 71 additions & 0 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ir_Haier.h"
#include "ir_Hitachi.h"
#include "ir_Kelvinator.h"
#include "ir_LG.h"
#include "ir_Midea.h"
#include "ir_Mitsubishi.h"
#include "ir_MitsubishiHeavy.h"
Expand Down Expand Up @@ -149,6 +150,10 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_KELVINATOR
case decode_type_t::KELVINATOR:
#endif
#if SEND_LG
case decode_type_t::LG:
case decode_type_t::LG2:
#endif
#if SEND_MIDEA
case decode_type_t::MIDEA:
#endif
Expand Down Expand Up @@ -719,6 +724,30 @@ void IRac::kelvinator(IRKelvinatorAC *ac,
}
#endif // SEND_KELVINATOR

#if SEND_LG
void IRac::lg(IRLgAc *ac, const lg_ac_remote_model_t model,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan) {
ac->begin();
ac->setModel(model);
ac->setPower(on);
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
// No Vertical swing setting available.
// No Horizontal swing setting available.
// No Quiet setting available.
// No Turbo setting available.
// No Light setting available.
// No Filter setting available.
// No Clean setting available.
// No Beep setting available.
// No Sleep setting available.
// No Clock setting available.
ac->send();
}
#endif // SEND_LG

#if SEND_MIDEA
void IRac::midea(IRMideaAC *ac,
const bool on, const stdAc::opmode_t mode, const bool celsius,
Expand Down Expand Up @@ -1439,6 +1468,16 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_KELVINATOR
#if SEND_LG
case LG:
case LG2:
{
IRLgAc ac(_pin, _inverted, _modulation);
lg(&ac, (lg_ac_remote_model_t)send.model, send.power, send.mode,
send.degrees, send.fanspeed);
break;
}
#endif // SEND_LG
#if SEND_MIDEA
case MIDEA:
{
Expand Down Expand Up @@ -2139,6 +2178,21 @@ namespace IRAcUtils {
return ac.toString();
}
#endif // DECODE_TCL112AC
#if DECODE_LG
case decode_type_t::LG:
case decode_type_t::LG2: {
IRLgAc ac(0);
ac.setRaw(result->value); // Like Coolix, use value instead of state.
switch (result->decode_type) {
case decode_type_t::LG2:
ac.setModel(lg_ac_remote_model_t::AKB75215403);
break;
default:
ac.setModel(lg_ac_remote_model_t::GE6711AR2853M);
}
return ac.isValidLgAc() ? ac.toString() : "";
}
#endif // DECODE_LG
default:
return "";
}
Expand Down Expand Up @@ -2309,6 +2363,23 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_KELVINATOR
#if DECODE_LG
case decode_type_t::LG:
case decode_type_t::LG2: {
IRLgAc ac(kGpioUnused);
ac.setRaw(decode->value); // Uses value instead of state.
if (!ac.isValidLgAc()) return false;
switch (decode->decode_type) {
case decode_type_t::LG2:
ac.setModel(lg_ac_remote_model_t::AKB75215403);
break;
default:
ac.setModel(lg_ac_remote_model_t::GE6711AR2853M);
}
*result = ac.toCommon();
break;
}
#endif // DECODE_LG
#if DECODE_MIDEA
case decode_type_t::MIDEA: {
IRMideaAC ac(kGpioUnused);
Expand Down
22 changes: 14 additions & 8 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ir_Haier.h"
#include "ir_Hitachi.h"
#include "ir_Kelvinator.h"
#include "ir_LG.h"
#include "ir_Midea.h"
#include "ir_Mitsubishi.h"
#include "ir_MitsubishiHeavy.h"
Expand Down Expand Up @@ -136,16 +137,16 @@ class IRac {
const bool quiet, const bool turbo, const bool econo);
#endif // SEND_DAIKIN152
#if SEND_DAIKIN160
void daikin160(IRDaikin160 *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv);
void daikin160(IRDaikin160 *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv);
#endif // SEND_DAIKIN160
#if SEND_DAIKIN176
void daikin176(IRDaikin176 *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingh_t swingh);
void daikin176(IRDaikin176 *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingh_t swingh);
#endif // SEND_DAIKIN176
#if SEND_DAIKIN2
void daikin2(IRDaikin2 *ac,
Expand Down Expand Up @@ -230,6 +231,11 @@ void electra(IRElectraAc *ac,
const bool quiet, const bool turbo, const bool light,
const bool filter, const bool clean);
#endif // SEND_KELVINATOR
#if SEND_LG
void lg(IRLgAc *ac, const lg_ac_remote_model_t model,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan);
#endif // SEND_LG
#if SEND_MIDEA
void midea(IRMideaAC *ac,
const bool on, const stdAc::opmode_t mode, const bool celsius,
Expand Down
1 change: 1 addition & 0 deletions src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ const uint16_t kLegoPfBits = 16;
const uint16_t kLegoPfMinRepeat = kNoRepeat;
const uint16_t kLgBits = 28;
const uint16_t kLg32Bits = 32;
const uint16_t kLgDefaultRepeat = kNoRepeat;
const uint16_t kLutronBits = 35;
const uint16_t kMagiquestBits = 56;
const uint16_t kMideaBits = 48;
Expand Down
5 changes: 5 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ enum whirlpool_ac_remote_model_t {
DG11J191,
};

enum lg_ac_remote_model_t {
GE6711AR2853M = 1, // (1) LG 28-bit Protocol (default)
AKB75215403, // (2) LG2 28-bit Protocol
};


// Classes
class IRsend {
Expand Down
20 changes: 14 additions & 6 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,20 +824,28 @@ namespace irutils {

String modelToStr(const decode_type_t protocol, const int16_t model) {
switch (protocol) {
case decode_type_t::FUJITSU_AC:
switch (model) {
case fujitsu_ac_remote_model_t::ARRAH2E: return F("ARRAH2E");
case fujitsu_ac_remote_model_t::ARDB1: return F("ARDB1");
case fujitsu_ac_remote_model_t::ARREB1E: return F("ARREB1E");
case fujitsu_ac_remote_model_t::ARJW2: return F("ARJW2");
case fujitsu_ac_remote_model_t::ARRY4: return F("ARRY4");
default: return kUnknownStr;
}
break;
case decode_type_t::GREE:
switch (model) {
case gree_ac_remote_model_t::YAW1F: return F("YAW1F");
case gree_ac_remote_model_t::YBOFB: return F("YBOFB");
default: return kUnknownStr;
}
break;
case decode_type_t::FUJITSU_AC:
case decode_type_t::LG:
case decode_type_t::LG2:
switch (model) {
case fujitsu_ac_remote_model_t::ARRAH2E: return F("ARRAH2E");
case fujitsu_ac_remote_model_t::ARDB1: return F("ARDB1");
case fujitsu_ac_remote_model_t::ARREB1E: return F("ARREB1E");
case fujitsu_ac_remote_model_t::ARJW2: return F("ARJW2");
case fujitsu_ac_remote_model_t::ARRY4: return F("ARRY4");
case lg_ac_remote_model_t::GE6711AR2853M: return F("GE6711AR2853M");
case lg_ac_remote_model_t::AKB75215403: return F("AKB75215403");
default: return kUnknownStr;
}
break;
Expand Down
Loading

0 comments on commit ad399c5

Please sign in to comment.