diff --git a/GreeHeatpumpIR.cpp b/GreeHeatpumpIR.cpp index fc44a1a..15628d2 100644 --- a/GreeHeatpumpIR.cpp +++ b/GreeHeatpumpIR.cpp @@ -37,7 +37,7 @@ GreeYAAHeatpumpIR::GreeYAAHeatpumpIR() : GreeHeatpumpIR() } // Support for YAC1FBF remote -GreeYACHeatpumpIR::GreeYACHeatpumpIR() : GreeHeatpumpIR() +GreeYACHeatpumpIR::GreeYACHeatpumpIR() : GreeiFeelHeatpumpIR() { static const char model[] PROGMEM = "greeyac"; static const char info[] PROGMEM = "{\"mdl\":\"greeyac\",\"dn\":\"Gree YAC\",\"mT\":16,\"xT\":30,\"fs\":3}"; @@ -47,6 +47,17 @@ GreeYACHeatpumpIR::GreeYACHeatpumpIR() : GreeHeatpumpIR() greeModel = GREE_YAC; } +// Support for YT1F remote +GreeYTHeatpumpIR::GreeYTHeatpumpIR() : GreeiFeelHeatpumpIR() +{ + static const char model[] PROGMEM = "greeyt"; + static const char info[] PROGMEM = "{\"mdl\":\"greeyt\",\"dn\":\"Gree YT\",\"mT\":16,\"xT\":30,\"fs\":3}"; + + _model = model; + _info = info; + greeModel = GREE_YT; +} + void GreeHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd) { send(IR, powerModeCmd, operatingModeCmd, fanSpeedCmd, temperatureCmd, swingVCmd, swingHCmd, false); @@ -143,7 +154,7 @@ void GreeHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingM } } - if (greeModel == GREE_YAA || greeModel == GREE_YAC) + if (greeModel == GREE_YAA || greeModel == GREE_YAC || greeModel == GREE_YT) { switch (swingVCmd) { @@ -211,11 +222,15 @@ void GreeHeatpumpIR::sendGree(IRSender& IR, uint8_t powerMode, uint8_t operating { (void)swingH; - uint8_t GreeTemplate[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 }; + uint8_t GreeTemplate[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // 0 1 2 3 4 5 6 7 uint8_t i; + if (greeModel != GREE_YT) { + GreeTemplate[5] = 0x20; + } + // Set the Fan speed, operating mode and power state GreeTemplate[0] = fanSpeed | operatingMode | powerMode; // Set the temperature @@ -230,26 +245,42 @@ void GreeHeatpumpIR::sendGree(IRSender& IR, uint8_t powerMode, uint8_t operating } if (greeModel == GREE_YAC) { - GreeTemplate[4] |= (swingH << 4); + GreeTemplate[4] |= (swingH << 4); // GREE_YT will ignore packets where this is set + } + if (greeModel == GREE_YAC || greeModel == GREE_YT) + { if (iFeelMode) { - GreeTemplate[5] |= (1 << 3); + GreeTemplate[5] |= GREE_IFEEL_BIT; + } + } + if (greeModel == GREE_YT) { + GreeTemplate[2] = GREE_LIGHT_BIT | GREE_HEALTH_BIT; // HEALTH is always on for GREE_YT + GreeTemplate[3] = 0x50; // bits 4..7 always 0101 + + if (turboMode) + { + GreeTemplate[2] |= GREE_TURBO_BIT; + } + if (swingV == GREE_VDIR_SWING) + { + GreeTemplate[0] |= GREE_VSWING; // Enable swing by setting bit 6 + GreeTemplate[4] = swingV; } } if (greeModel == GREE_YAA || greeModel == GREE_YAC) { -// GreeTemplate[2] = 0xE0; // bits 0..3 always 0000, bits 4..7 TURBO,LIGHT,HEALTH,X-FAN - GreeTemplate[2] = 0x20; // bits 0..3 always 0000, bits 4..7 TURBO,LIGHT,HEALTH,X-FAN + GreeTemplate[2] = GREE_LIGHT_BIT; // bits 0..3 always 0000, bits 4..7 TURBO,LIGHT,HEALTH,X-FAN GreeTemplate[3] = 0x50; // bits 4..7 always 0101 GreeTemplate[6] = 0x20; // YAA1FB, FAA1FB1, YB1F2 bits 4..7 always 0010 if (turboMode) { - GreeTemplate[2] |= (1 << 4); // Set bit 4 (TURBO) + GreeTemplate[2] |= GREE_TURBO_BIT; } if (swingV == GREE_VDIR_SWING) { - GreeTemplate[0] |= (1 << 6); // Enable swing by setting bit 6 + GreeTemplate[0] |= GREE_VSWING; // Enable swing by setting bit 6 } else if (swingV != GREE_VDIR_AUTO) { @@ -312,7 +343,7 @@ void GreeHeatpumpIR::sendGree(IRSender& IR, uint8_t powerMode, uint8_t operating } // Sends current sensed temperatures, YAC remotes/supporting units only -void GreeYACHeatpumpIR::send(IRSender& IR, uint8_t currentTemperature) +void GreeiFeelHeatpumpIR::send(IRSender& IR, uint8_t currentTemperature) { uint8_t GreeTemplate[] = { 0x00, 0x00 }; diff --git a/GreeHeatpumpIR.h b/GreeHeatpumpIR.h index ceec6a3..f50b8cd 100644 --- a/GreeHeatpumpIR.h +++ b/GreeHeatpumpIR.h @@ -38,7 +38,7 @@ #define GREE_AIRCON1_FAN3 0x30 // * high #define GREE_AIRCON1_TURBO 0x80 // * turbo mode on YAN -// Only available on YAN +// Only available on YAN and YT // Vertical air directions. Note that these cannot be set on all heat pumps #define GREE_VDIR_AUTO 0x00 #define GREE_VDIR_MANUAL 0x00 @@ -60,11 +60,25 @@ #define GREE_HDIR_MRIGHT 0x05 #define GREE_HDIR_RIGHT 0x06 +#define GREE_IFEEL_BIT 0x08 + +// Only available on YAA, YAC, and YT +// byte 0 +#define GREE_VSWING (1 << 6) +// byte 2 +#define GREE_TURBO_BIT (1 << 4) +#define GREE_LIGHT_BIT (1 << 5) +#define GREE_HEALTH_BIT (1 << 6) +#define GREE_XFAN_BIT (1 << 7) // aka BLOW on some remotes + + + // Gree model codes #define GREE_GENERIC 0 #define GREE_YAN 1 #define GREE_YAA 2 #define GREE_YAC 3 +#define GREE_YT 4 class GreeHeatpumpIR : public HeatpumpIR @@ -112,11 +126,8 @@ class GreeYAAHeatpumpIR : public GreeHeatpumpIR } }; -class GreeYACHeatpumpIR : public GreeHeatpumpIR +class GreeiFeelHeatpumpIR : public GreeHeatpumpIR { - public: - GreeYACHeatpumpIR(); - public: void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd, bool turboMode, bool iFeelMode) { @@ -125,4 +136,16 @@ class GreeYACHeatpumpIR : public GreeHeatpumpIR void send(IRSender& IR, uint8_t currentTemperature); }; +class GreeYACHeatpumpIR : public GreeiFeelHeatpumpIR +{ + public: + GreeYACHeatpumpIR(); +}; + +class GreeYTHeatpumpIR : public GreeiFeelHeatpumpIR +{ + public: + GreeYTHeatpumpIR(); +}; + #endif diff --git a/README.md b/README.md index 0649987..83cb031 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ An Arduino library to control pump/split unit air conditioner. Currently support * AQV12MSAN, Remote Control ARH-1362 * Samsung FJM (RJ040F2HXEA / 2XMH026FNEA), Remote Control P/N ARH-465 * Sharp AY-ZP40KR (remote control P/N CRMC-A788JBEZ), possibly also IVT +* Sharp AY-X09LCJ (Remote control P/N YT1F) * Toshiba Daiseikai (Toshiba remote control P/N WH-TA01EE). * Fully compatible with CarrierNQV functions instead of Daiseikai functions. * Tested with: RAS-10G2KVP-E RAS-10G2AVP-E and RAS-13G2KVP-E RAS-13G2AVP-E