Skip to content

Commit

Permalink
Add support for Rhoss Idrowall MPCV 20-30-35-40 A/C protocol (#1630)
Browse files Browse the repository at this point in the history
- Add send and decode routines
- Add support for:
  - Power
  - Temp (Celsius)
  - Swing
  - Mode
  - Fan Speed
  - Checksums
- Add Unit tests

Co-authored-by: Tom Rosenback <[email protected]>
  • Loading branch information
tomrosenback and Tom Rosenback authored Oct 8, 2021
1 parent 1beea0c commit 2e16e38
Show file tree
Hide file tree
Showing 15 changed files with 1,009 additions and 6 deletions.
56 changes: 56 additions & 0 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "ir_MitsubishiHeavy.h"
#include "ir_Neoclima.h"
#include "ir_Panasonic.h"
#include "ir_Rhoss.h"
#include "ir_Samsung.h"
#include "ir_Sanyo.h"
#include "ir_Sharp.h"
Expand Down Expand Up @@ -270,6 +271,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_PANASONIC_AC32
case decode_type_t::PANASONIC_AC32:
#endif
#if SEND_RHOSS
case decode_type_t::RHOSS:
#endif
#if SEND_SAMSUNG_AC
case decode_type_t::SAMSUNG_AC:
#endif
Expand Down Expand Up @@ -2362,6 +2366,35 @@ void IRac::transcold(IRTranscoldAc *ac,
}
#endif // SEND_TRANSCOLD

#if SEND_RHOSS
/// Send an Rhoss A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRRhossAc object to use.
/// @param[in] on The power setting.
/// @param[in] mode The operation mode setting.
/// @param[in] degrees The temperature setting in degrees.
/// @param[in] fan The speed setting for the fan.
/// @param[in] swing The swing setting.
void IRac::rhoss(IRRhossAc *ac,
const bool on, const stdAc::opmode_t mode, const float degrees,
const stdAc::fanspeed_t fan, const stdAc::swingv_t swing) {
ac->begin();
ac->setPower(on);
ac->setMode(ac->convertMode(mode));
ac->setSwing(swing != stdAc::swingv_t::kOff);
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
// No Quiet 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.
ac->send();
}
#endif // SEND_RHOSS

/// 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 @@ -2887,6 +2920,14 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_PANASONIC_AC32
#if SEND_RHOSS
case RHOSS:
{
IRRhossAc ac(_pin, _inverted, _modulation);
rhoss(&ac, send.power, send.mode, degC, send.fanspeed, send.swingv);
break;
}
#endif // SEND_RHOSS
#if SEND_SAMSUNG_AC
case SAMSUNG_AC:
{
Expand Down Expand Up @@ -3789,6 +3830,13 @@ namespace IRAcUtils {
return ac.toString();
}
#endif // DECODE_TRANSCOLD
#if DECODE_RHOSS
case decode_type_t::RHOSS: {
IRRhossAc ac(kGpioUnused);
ac.setRaw(result->state);
return ac.toString();
}
#endif // DECODE_RHOSS
default:
return "";
}
Expand Down Expand Up @@ -4254,6 +4302,14 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_TRANSCOLD
#if DECODE_RHOSS
case decode_type_t::RHOSS: {
IRRhossAc ac(kGpioUnused);
ac.setRaw(decode->state);
*result = ac.toCommon();
break;
}
#endif // DECODE_RHOSS
default:
return false;
}
Expand Down
6 changes: 6 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "ir_Vestel.h"
#include "ir_Voltas.h"
#include "ir_Whirlpool.h"
#include "ir_Rhoss.h"

// Constants
const int8_t kGpioUnused = -1; ///< A placeholder for not using an actual GPIO.
Expand Down Expand Up @@ -489,6 +490,11 @@ void electra(IRElectraAc *ac,
const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv, const stdAc::swingh_t swingh);
#endif // SEND_TRANSCOLD
#if SEND_RHOSS
void rhoss(IRRhossAc *ac,
const bool on, const stdAc::opmode_t mode, const float degrees,
const stdAc::fanspeed_t fan, const stdAc::swingv_t swing);
#endif // SEND_RHOSS
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 @@ -1040,6 +1040,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
DPRINTLN("Attempting Arris decode");
if (decodeArris(results, offset)) return true;
#endif // DECODE_ARRIS
#if DECODE_RHOSS
DPRINTLN("Attempting Rhoss decode");
if (decodeRhoss(results, offset)) return true;
#endif // DECODE_RHOSS
// Typically new protocols are added above this line.
}
#if DECODE_HASH
Expand Down
4 changes: 4 additions & 0 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,10 @@ class IRrecv {
bool decodeBose(decode_results *results, uint16_t offset = kStartOffset,
const uint16_t nbits = kBoseBits, const bool strict = true);
#endif // DECODE_BOSE
#if DECODE_RHOSS
bool decodeRhoss(decode_results *results, uint16_t offset = kStartOffset,
const uint16_t nbits = kRhossBits, const bool strict = true);
#endif // DECODE_RHOSS
};

#endif // IRRECV_H_
15 changes: 13 additions & 2 deletions src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,13 @@
#define SEND_ARRIS _IR_ENABLE_DEFAULT_
#endif // SEND_ARRIS

#ifndef DECODE_RHOSS
#define DECODE_RHOSS _IR_ENABLE_DEFAULT_
#endif // DECODE_RHOSS
#ifndef SEND_RHOSS
#define SEND_RHOSS _IR_ENABLE_DEFAULT_
#endif // SEND_RHOSS

#if (DECODE_ARGO || DECODE_DAIKIN || DECODE_FUJITSU_AC || DECODE_GREE || \
DECODE_KELVINATOR || DECODE_MITSUBISHI_AC || DECODE_TOSHIBA_AC || \
DECODE_TROTEC || DECODE_HAIER_AC || DECODE_HITACHI_AC || \
Expand All @@ -811,7 +818,7 @@
DECODE_HITACHI_AC344 || DECODE_CORONA_AC || DECODE_SANYO_AC || \
DECODE_VOLTAS || DECODE_MIRAGE || DECODE_HAIER_AC176 || \
DECODE_TEKNOPOINT || DECODE_KELON || DECODE_TROTEC_3550 || \
DECODE_SANYO_AC88 || \
DECODE_SANYO_AC88 || DECODE_RHOSS || \
false)
// Add any DECODE to the above if it uses result->state (see kStateSizeMax)
// you might also want to add the protocol to hasACState function
Expand Down Expand Up @@ -959,8 +966,9 @@ enum decode_type_t {
SANYO_AC88, // 105
BOSE,
ARRIS,
RHOSS,
// Add new entries before this one, and update it to point to the last entry.
kLastDecodeType = ARRIS,
kLastDecodeType = RHOSS,
};

// Message lengths & required repeat values
Expand Down Expand Up @@ -1204,6 +1212,9 @@ const uint16_t kMilesTag2ShotBits = 14;
const uint16_t kMilesTag2MsgBits = 24;
const uint16_t kMilesMinRepeat = 0;
const uint16_t kBoseBits = 16;
const uint16_t kRhossStateLength = 12;
const uint16_t kRhossBits = kRhossStateLength * 8;
const uint16_t kRhossDefaultRepeat = 0;


// Legacy defines. (Deprecated)
Expand Down
7 changes: 7 additions & 0 deletions src/IRsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
return kNeoclimaBits;
case PANASONIC_AC:
return kPanasonicAcBits;
case RHOSS:
return kRhossBits;
case SAMSUNG_AC:
return kSamsungAcBits;
case SANYO_AC:
Expand Down Expand Up @@ -1253,6 +1255,11 @@ bool IRsend::send(const decode_type_t type, const uint8_t *state,
sendPanasonicAC(state, nbytes);
break;
#endif // SEND_PANASONIC_AC
#if SEND_RHOSS
case RHOSS:
sendRhoss(state, nbytes);
break;
#endif // SEND_RHOSS
#if SEND_SAMSUNG_AC
case SAMSUNG_AC:
sendSamsungAC(state, nbytes);
Expand Down
5 changes: 5 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@ class IRsend {
static uint32_t toggleArrisRelease(const uint32_t data);
static uint32_t encodeArris(const uint32_t command, const bool release);
#endif // SEND_ARRIS
#if SEND_RHOSS
void sendRhoss(const unsigned char data[],
const uint16_t nbytes = kRhossStateLength,
const uint16_t repeat = kRhossDefaultRepeat);
#endif // SEND_RHOSS

protected:
#ifdef UNIT_TEST
Expand Down
1 change: 1 addition & 0 deletions src/IRtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
D_STR_SANYO_AC88 "\x0"
D_STR_BOSE "\x0"
D_STR_ARRIS "\x0"
D_STR_RHOSS "\x0"
///< New protocol strings should be added just above this line.
"\x0" ///< This string requires double null termination.
};
Expand Down
1 change: 1 addition & 0 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ bool hasACState(const decode_type_t protocol) {
case MWM:
case NEOCLIMA:
case PANASONIC_AC:
case RHOSS:
case SAMSUNG_AC:
case SANYO_AC:
case SANYO_AC88:
Expand Down
Loading

0 comments on commit 2e16e38

Please sign in to comment.