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

Support for Electrolux EACM EZ/N3 #2131

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
67 changes: 66 additions & 1 deletion src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "ir_Vestel.h"
#include "ir_Voltas.h"
#include "ir_Whirlpool.h"
#include "ir_Electrolux.h"

// On the ESP8266 platform we need to use a special version of string handling
// functions to handle the strings stored in the flash address space.
Expand Down Expand Up @@ -243,6 +244,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_ELECTRA_AC
case decode_type_t::ELECTRA_AC:
#endif
#if SEND_ELECTROLUX_AC
case decode_type_t::ELECTROLUX_AC:
#endif // SEND_ELECTROLUX_AC
#if SEND_FUJITSU_AC
case decode_type_t::FUJITSU_AC:
#endif
Expand Down Expand Up @@ -817,7 +821,7 @@ void IRac::corona(IRCoronaAc *ac,
// No Sleep setting available.
ac->send();
}
#endif // SEND_CARRIER_AC64
#endif // SEND_CORONA_AC

#if SEND_DAIKIN
/// Send a Daikin A/C message with the supplied settings.
Expand Down Expand Up @@ -2852,6 +2856,42 @@ void IRac::rhoss(IRRhossAc *ac,
}
#endif // SEND_RHOSS

#if SEND_ELECTROLUX_AC
/// Send a Samsung A/C message with the supplied settings.
/// @note Multiple IR messages may be generated & sent.
/// @param[in, out] ac A Ptr to an IRSamsungAc object to use.
/// @param[in] on The power setting.
/// @param[in] mode The operation mode setting.
/// @param[in] celsius The celsius temperature mode.
/// @param[in] degrees The temperature setting in degrees.
/// @param[in] fan The speed setting for the fan.
/// @param[in] quiet Run the device in quiet/silent mode.
void IRac::electrolux(IRElectroluxAc *ac,
const bool on, const stdAc::opmode_t mode,
const bool celsius, const float degrees,
const stdAc::fanspeed_t fan,
const bool quiet) {
ac->begin();
ac->stateReset();
ac->setPower(on);
ac->setMode(ac->convertMode(mode));
ac->setTempModeFahrenheit(!celsius);
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
ac->setQuiet(quiet);
ac->setMode(ac->convertMode(mode));
ac->send();
// No Swing setting available.
// No Light setting available.
// No Filter setting available.
// No Turbo setting available.
// No Economy setting available.
// No Clean setting available.
// No Beep setting available.
// No Sleep setting available.
}
#endif // SEND_ELECTROLUX_AC

/// Create a new state base on the provided state that has been suitably fixed.
/// @note This is for use with Home Assistant, which requires mode to be off if
/// the power is off.
Expand Down Expand Up @@ -3637,6 +3677,16 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_TRANSCOLD_AC
#if SEND_ELECTROLUX_AC
case ELECTROLUX_AC:
{
IRElectroluxAc ac(_pin, _inverted, _modulation);
electrolux(&ac, send.power, send.mode,
send.celsius, send.degrees,
send.fanspeed, send.quiet);
break;
}
#endif // SEND_ELECTROLUX_AC
default:
return false; // Fail, didn't match anything.
}
Expand Down Expand Up @@ -4516,6 +4566,13 @@ namespace IRAcUtils {
return ac.toString();
}
#endif // DECODE_YORK
#if DECODE_ELECTROLUX_AC
case decode_type_t::ELECTROLUX_AC: {
IRElectroluxAc ac(kGpioUnused);
ac.setRaw(result->value); // ELETROLUX_AC uses value instead of state.
return ac.toString();
}
#endif // DECODE_ELECTROLUX_AC
default:
return "";
}
Expand Down Expand Up @@ -5060,6 +5117,14 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_YORK
#if DECODE_ELECTROLUX_AC
case decode_type_t::ELECTROLUX_AC: {
IRCarrierAc64 ac(kGpioUnused);
ac.setRaw(decode->value); // Uses value instead of state.
*result = ac.toCommon();
break;
}
#endif // DECODE_CARRIER_AC64
default:
return false;
}
Expand Down
8 changes: 8 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "ir_Fujitsu.h"
#include "ir_Ecoclim.h"
#include "ir_Electra.h"
#include "ir_Electrolux.h"
#include "ir_Goodweather.h"
#include "ir_Gree.h"
#include "ir_Haier.h"
Expand Down Expand Up @@ -567,6 +568,13 @@ void electra(IRElectraAc *ac,
const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv, const stdAc::swingh_t swingh);
#endif // SEND_TRANSCOLD
#if SEND_ELECTROLUX_AC
void electrolux(IRElectroluxAc *ac,
const bool on, const stdAc::opmode_t mode,
const bool celsius, const float degrees,
const stdAc::fanspeed_t fan,
const bool quiet);
#endif // SEND_ELECTROLUX_AC
static stdAc::state_t cleanState(const stdAc::state_t state);
static stdAc::state_t handleToggles(const stdAc::state_t desired,
const stdAc::state_t *prev = NULL);
Expand Down
4 changes: 4 additions & 0 deletions src/IRrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
DPRINTLN("Attempting BluestarHeavy decode");
if (decodeBluestarHeavy(results, offset, kBluestarHeavyBits)) return true;
#endif // DECODE_BLUESTARHEAVY
#if DECODE_ELECTROLUX_AC
DPRINTLN("Attempting Electrolux AC decode");
if (decodeElectroluxAc(results, offset)) return true;
#endif // DECODE_ELECTROLUX_AC
// Typically new protocols are added above this line.
}
#if DECODE_HASH
Expand Down
6 changes: 6 additions & 0 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,12 @@ class IRrecv {
const uint16_t nbits = kBluestarHeavyBits,
const bool strict = true);
#endif // DECODE_BLUESTARHEAVY
#if DECODE_ELECTROLUX_AC
bool decodeElectroluxAc(decode_results *results,
uint16_t offset = kStartOffset,
const uint16_t nbits = kElectroluxAcBits,
const bool strict = true);
#endif // DECODE_ELECTROLUX_AC
};

#endif // IRRECV_H_
12 changes: 11 additions & 1 deletion src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,13 @@
#define SEND_ELECTRA_AC _IR_ENABLE_DEFAULT_
#endif // SEND_ELECTRA_AC

#ifndef DECODE_ELECTROLUX_AC
#define DECODE_ELECTROLUX_AC _IR_ENABLE_DEFAULT_
#endif // DECODE_ELECTROLUX_AC
#ifndef SEND_ELECTROLUX_AC
#define SEND_ELECTROLUX_AC _IR_ENABLE_DEFAULT_
#endif // SEND_ELECTROLUX_AC

#ifndef DECODE_PANASONIC_AC
#define DECODE_PANASONIC_AC _IR_ENABLE_DEFAULT_
#endif // DECODE_PANASONIC_AC
Expand Down Expand Up @@ -1145,8 +1152,9 @@ enum decode_type_t {
CARRIER_AC84, // 125
YORK,
BLUESTARHEAVY,
ELECTROLUX_AC,
// Add new entries before this one, and update it to point to the last entry.
kLastDecodeType = BLUESTARHEAVY,
kLastDecodeType = ELECTROLUX_AC,
};

// Message lengths & required repeat values
Expand Down Expand Up @@ -1244,6 +1252,8 @@ const uint16_t kEpsonMinRepeat = 2;
const uint16_t kElectraAcStateLength = 13;
const uint16_t kElectraAcBits = kElectraAcStateLength * 8;
const uint16_t kElectraAcMinRepeat = kNoRepeat;
const uint16_t kElectroluxAcBits = 32;
const uint16_t kElectroluxAcDefaultRepeat = kNoRepeat;
const uint16_t kEliteScreensBits = 32;
const uint16_t kEliteScreensDefaultRepeat = kSingleRepeat;
const uint16_t kFujitsuAcMinRepeat = kNoRepeat;
Expand Down
7 changes: 7 additions & 0 deletions src/IRsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ uint16_t IRsend::minRepeats(const decode_type_t protocol) {
case COOLIX:
case COOLIX48:
case ELITESCREENS:
case ELECTROLUX_AC:
case GICABLE:
case INAX:
case MIDEA24:
Expand Down Expand Up @@ -646,6 +647,7 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
case ARRIS:
case CARRIER_AC:
case ELITESCREENS:
case ELECTROLUX_AC:
case EPSON:
case NEC:
case NEC_LIKE:
Expand Down Expand Up @@ -915,6 +917,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data,
sendEpson(data, nbits, min_repeat);
break;
#endif
#if SEND_ELECTROLUX_AC
case ELECTROLUX_AC:
sendElectroluxAc(data, nbits, min_repeat);
break;
#endif
#if SEND_GICABLE
case GICABLE:
sendGICable(data, nbits, min_repeat);
Expand Down
5 changes: 5 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,11 @@ class IRsend {
const uint16_t nbytes = kElectraAcStateLength,
const uint16_t repeat = kNoRepeat);
#endif
#if SEND_ELECTROLUX_AC
void sendElectroluxAc(const uint64_t data,
const uint16_t nbytes = kElectroluxAcBits,
const uint16_t repeat = kElectroluxAcDefaultRepeat);
#endif
#if SEND_PANASONIC_AC
void sendPanasonicAC(const unsigned char data[],
const uint16_t nbytes = kPanasonicAcStateLength,
Expand Down
2 changes: 2 additions & 0 deletions src/IRtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
D_STR_YORK, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_BLUESTARHEAVY || SEND_BLUESTARHEAVY,
D_STR_BLUESTARHEAVY, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_ELECTROLUX_EACM || SEND_ELECTROLUX_EACM,
D_STR_ELECTROLUX_AC, D_STR_UNSUPPORTED) "\x0"
///< New protocol (macro) strings should be added just above this line.
"\x0" ///< This string requires double null termination.
};
Expand Down
Loading
Loading