# IRremoteESP8266: src/ir_Neoclima.h Source File

ir_Neoclima.h
Go to the documentation of this file.
// Copyright 2019 David Conran
// Supports:
// Brand: Neoclima, Model: NS-09AHTI A/C
// Brand: Neoclima, Model: ZH/TY-01 remote
// Brand: Soleus Air, Model: TTWM1-10-01 A/C
// Brand: Soleus Air, Model: ZCF/TL-05 remote
#ifndef IR_NEOCLIMA_H_
#define IR_NEOCLIMA_H_
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include "IRremoteESP8266.h"
#include "IRsend.h"
#ifdef UNIT_TEST
#include "IRsend_test.h"
#endif
// Constants
// state[1]
const uint8_t kNeoclima8CHeatOffset = 1;
const uint8_t kNeoclimaIonOffset = 2;
// state[3]
const uint8_t kNeoclimaLightOffset = 0;
const uint8_t kNeoclimaHoldOffset = 2;
const uint8_t kNeoclimaTurboOffset = 3;
const uint8_t kNeoclimaEconoOffset = 4;
const uint8_t kNeoclimaEyeOffset = 6;
// state[5]
const uint8_t kNeoclimaFreshOffset = 7;
const uint8_t kNeoclimaButtonOffset = 0;
const uint8_t kNeoclimaButtonSize = 5;
const uint8_t kNeoclimaButtonPower = 0x00;
const uint8_t kNeoclimaButtonMode = 0x01;
const uint8_t kNeoclimaButtonTempUp = 0x02;
const uint8_t kNeoclimaButtonTempDown = 0x03;
const uint8_t kNeoclimaButtonSwing = 0x04;
const uint8_t kNeoclimaButtonFanSpeed = 0x05;
const uint8_t kNeoclimaButtonAirFlow = 0x07;
const uint8_t kNeoclimaButtonHold = 0x08;
const uint8_t kNeoclimaButtonSleep = 0x09;
const uint8_t kNeoclimaButtonTurbo = 0x0A;
const uint8_t kNeoclimaButtonLight = 0x0B;
const uint8_t kNeoclimaButtonEcono = 0x0D;
const uint8_t kNeoclimaButtonEye = 0x0E;
const uint8_t kNeoclimaButtonFollow = 0x13;
const uint8_t kNeoclimaButtonIon = 0x14;
const uint8_t kNeoclimaButtonFresh = 0x15;
const uint8_t kNeoclimaButton8CHeat = 0x1D;
const uint8_t kNeoclimaButtonTempUnit = 0x1E;
// state[7]
const uint8_t kNeoclimaSleepOffset = 0; // Mask 0b0000000x
const uint8_t kNeoclimaPowerOffset = 1; // Mask 0b000000x0
const uint8_t kNeoclimaSwingVOffset = 2; // Mask 0b0000xx00
const uint8_t kNeoclimaSwingVSize = 2; // Bits
const uint8_t kNeoclimaSwingVOn = 0b01;
const uint8_t kNeoclimaSwingVOff = 0b10;
const uint8_t kNeoclimaSwingHOffset = 4; // Mask 0b000x0000
const uint8_t kNeoclimaFanOffest = 5; // Mask 0b0xx00000
const uint8_t kNeoclimaFanSize = 2; // Bits
const uint8_t kNeoclimaFanAuto = 0b00;
const uint8_t kNeoclimaFanHigh = 0b01;
const uint8_t kNeoclimaFanMed = 0b10;
const uint8_t kNeoclimaFanLow = 0b11;
const uint8_t kNeoclimaUseFahrenheitOffset = 7; // Mask 0bx0000000
// state[8]
const uint8_t kNeoclimaFollowMe = 0x5D; // Also 0x5F
// state[9]
const uint8_t kNeoclimaTempOffset = 0; // Mask 0b000xxxxx
const uint8_t kNeoclimaTempSize = 5; // Bits
const uint8_t kNeoclimaMinTempC = 16; // 16C
const uint8_t kNeoclimaMaxTempC = 32; // 32C
const uint8_t kNeoclimaMinTempF = 61; // 61F
const uint8_t kNeoclimaMaxTempF = 90; // 90F
const uint8_t kNeoclimaModeOffset = 5; // Mask 0bxxx00000
const uint8_t kNeoclimaAuto = 0b000;
const uint8_t kNeoclimaCool = 0b001;
const uint8_t kNeoclimaDry = 0b010;
const uint8_t kNeoclimaFan = 0b011;
const uint8_t kNeoclimaHeat = 0b100;
// Classes
class IRNeoclimaAc {
public:
explicit IRNeoclimaAc(const uint16_t pin, const bool inverted = false,
const bool use_modulation = true);
void stateReset(void);
#if SEND_NEOCLIMA
void send(const uint16_t repeat = kNeoclimaMinRepeat);
int8_t calibrate(void) { return _irsend.calibrate(); }
#endif // SEND_NEOCLIMA
void begin(void);
void setButton(const uint8_t button);
uint8_t getButton(void);
void on(void);
void off(void);
void setPower(const bool on);
bool getPower(void);
void setMode(const uint8_t mode);
uint8_t getMode(void);
void setTemp(const uint8_t temp, const bool celsius = true);
uint8_t getTemp(void);
void setFan(const uint8_t speed);
uint8_t getFan(void);
void setSwingV(const bool on);
bool getSwingV(void);
void setSwingH(const bool on);
bool getSwingH(void);
void setSleep(const bool on);
bool getSleep(void);
void setTurbo(const bool on);
bool getTurbo(void);
void setEcono(const bool on);
bool getEcono(void);
void setFresh(const bool on);
bool getFresh(void);
void setHold(const bool on);
bool getHold(void);
void setIon(const bool on);
bool getIon(void);
void setLight(const bool on);
bool getLight(void);
void set8CHeat(const bool on);
bool get8CHeat(void);
void setEye(const bool on);
bool getEye(void);
bool getTempUnits(void);
// DISABLED: See TODO in ir_Neoclima.cpp
// void setFollow(const bool on);
bool getFollow(void);
uint8_t* getRaw(void);
void setRaw(const uint8_t new_code[],
const uint16_t length = kNeoclimaStateLength);
static bool validChecksum(const uint8_t state[],
const uint16_t length = kNeoclimaStateLength);
static uint8_t calcChecksum(const uint8_t state[],
const uint16_t length = kNeoclimaStateLength);
String toString(void);
uint8_t convertMode(const stdAc::opmode_t mode);
uint8_t convertFan(const stdAc::fanspeed_t speed);
static stdAc::opmode_t toCommonMode(const uint8_t mode);
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
stdAc::state_t toCommon(void);
#ifndef UNIT_TEST
private:
IRsend _irsend;
#else // UNIT_TEST
IRsendTest _irsend;
#endif // UNIT_TEST
uint8_t remote_state[kNeoclimaStateLength];
void checksum(const uint16_t length = kNeoclimaStateLength);
};
#endif // IR_NEOCLIMA_H_
kNeoclimaFanHigh
const uint8_t kNeoclimaFanHigh
Definition: ir_Neoclima.h:72
kNeoclimaUseFahrenheitOffset
const uint8_t kNeoclimaUseFahrenheitOffset
Definition: ir_Neoclima.h:75
IRNeoclimaAc::toCommonFanSpeed
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition: ir_Neoclima.cpp:310
kNeoclimaMinTempC
const uint8_t kNeoclimaMinTempC
Definition: ir_Neoclima.h:81
kNeoclimaButtonFanSpeed
const uint8_t kNeoclimaButtonFanSpeed
Definition: ir_Neoclima.h:48
kNeoclimaButtonTurbo
const uint8_t kNeoclimaButtonTurbo
Definition: ir_Neoclima.h:52
kNeoclimaFollowMe
const uint8_t kNeoclimaFollowMe
Definition: ir_Neoclima.h:77
IRNeoclimaAc::getSleep
bool getSleep(void)
Get the Sleep setting of the A/C.
Definition: ir_Neoclima.cpp:328
kNeoclimaEyeOffset
const uint8_t kNeoclimaEyeOffset
Mask 0b0x000000.
Definition: ir_Neoclima.h:38
kNeoclimaTempOffset
const uint8_t kNeoclimaTempOffset
Definition: ir_Neoclima.h:79
IRNeoclimaAc::getEye
bool getEye(void)
Get the Eye (Sensor) setting of the A/C.
Definition: ir_Neoclima.cpp:464
IRNeoclimaAc::getFollow
bool getFollow(void)
Get the Follow Me setting of the A/C.
Definition: ir_Neoclima.cpp:487
kNeoclimaMaxTempC
const uint8_t kNeoclimaMaxTempC
Definition: ir_Neoclima.h:82
stdAc::fanspeed_t
fanspeed_t
Common A/C settings for Fan Speeds.
Definition: IRsend.h:58
kNeoclimaIonOffset
const uint8_t kNeoclimaIonOffset
Definition: ir_Neoclima.h:32
kNeoclimaDry
const uint8_t kNeoclimaDry
Definition: ir_Neoclima.h:88
IRNeoclimaAc::calcChecksum
static uint8_t calcChecksum(const uint8_t state[], const uint16_t length=kNeoclimaStateLength)
Calculate the checksum for a given state.
Definition: ir_Neoclima.cpp:85
IRNeoclimaAc::calibrate
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Neoclima.h:105
IRNeoclimaAc::set8CHeat
void set8CHeat(const bool on)
Set the 8°C Heat setting of the A/C.
Definition: ir_Neoclima.cpp:444
kNeoclimaButtonEye
const uint8_t kNeoclimaButtonEye
Definition: ir_Neoclima.h:55
kNeoclimaButtonPower
const uint8_t kNeoclimaButtonPower
Definition: ir_Neoclima.h:43
IRNeoclimaAc::setFan
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition: ir_Neoclima.cpp:267
kNeoclimaSwingVOn
const uint8_t kNeoclimaSwingVOn
Definition: ir_Neoclima.h:66
kNeoclimaButtonMode
const uint8_t kNeoclimaButtonMode
Definition: ir_Neoclima.h:44
kNeoclimaStateLength
const uint16_t kNeoclimaStateLength
Definition: IRremoteESP8266.h:1023
IRNeoclimaAc::setHold
void setHold(const bool on)
Set the Hold setting of the A/C.
Definition: ir_Neoclima.cpp:401
kNeoclimaSleepOffset
const uint8_t kNeoclimaSleepOffset
Definition: ir_Neoclima.h:62
IRNeoclimaAc::getMode
uint8_t getMode(void)
Get the operating mode setting of the A/C.
Definition: ir_Neoclima.cpp:208
IRNeoclimaAc::getPower
bool getPower(void)
Get the value of the current power setting.
Definition: ir_Neoclima.cpp:181
kNeoclimaMinTempF
const uint8_t kNeoclimaMinTempF
Definition: ir_Neoclima.h:83
IRNeoclimaAc::setRaw
void setRaw(const uint8_t new_code[], const uint16_t length=kNeoclimaStateLength)
Set the internal state from a valid code for this protocol.
Definition: ir_Neoclima.cpp:126
kNeoclimaButtonHold
const uint8_t kNeoclimaButtonHold
Definition: ir_Neoclima.h:50
IRNeoclimaAc::setEcono
void setEcono(const bool on)
Set the Economy (Energy Saver) setting of the A/C.
Definition: ir_Neoclima.cpp:375
IRNeoclimaAc::setTemp
void setTemp(const uint8_t temp, const bool celsius=true)
Set the temperature.
Definition: ir_Neoclima.cpp:241
IRsend.h
kNeoclimaSwingVSize
const uint8_t kNeoclimaSwingVSize
Definition: ir_Neoclima.h:65
kNeoclimaAuto
const uint8_t kNeoclimaAuto
Definition: ir_Neoclima.h:86
kNeoclimaMaxTempF
const uint8_t kNeoclimaMaxTempF
Definition: ir_Neoclima.h:84
IRNeoclimaAc::getFan
uint8_t getFan(void)
Get the current fan speed setting.
Definition: ir_Neoclima.cpp:289
IRNeoclimaAc::setLight
void setLight(const bool on)
Set the Light(LED display) setting of the A/C.
Definition: ir_Neoclima.cpp:427
kNeoclimaFan
const uint8_t kNeoclimaFan
Definition: ir_Neoclima.h:89
IRsend
Class for sending all basic IR protocols.
Definition: IRsend.h:182
IRNeoclimaAc::getRaw
uint8_t * getRaw(void)
Get a PTR to the internal state/code for this protocol.
Definition: ir_Neoclima.cpp:118
kNeoclimaFanAuto
const uint8_t kNeoclimaFanAuto
Definition: ir_Neoclima.h:71
IRsend::calibrate
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition: IRsend.cpp:207
kNeoclimaFreshOffset
const uint8_t kNeoclimaFreshOffset
Mask 0bx0000000.
Definition: ir_Neoclima.h:40
IRNeoclimaAc::getFresh
bool getFresh(void)
Get the Fresh (air) setting of the A/C.
Definition: ir_Neoclima.cpp:395
IRNeoclimaAc::getButton
uint8_t getButton(void)
Get the Button/Command setting of the A/C.
Definition: ir_Neoclima.cpp:162
String
std::string String
Definition: IRremoteESP8266.h:1178
IRNeoclimaAc::getSwingH
bool getSwingH(void)
Get the horizontal swing (Air Flow) setting of the A/C.
Definition: ir_Neoclima.cpp:356
kNeoclimaButtonFresh
const uint8_t kNeoclimaButtonFresh
Definition: ir_Neoclima.h:58
IRNeoclimaAc::getTurbo
bool getTurbo(void)
Get the Turbo setting of the A/C.
Definition: ir_Neoclima.cpp:369
kNeoclimaButtonEcono
const uint8_t kNeoclimaButtonEcono
Definition: ir_Neoclima.h:54
IRNeoclimaAc::getEcono
bool getEcono(void)
Get the Economy (Energy Saver) setting of the A/C.
Definition: ir_Neoclima.cpp:382
kNeoclimaButtonAirFlow
const uint8_t kNeoclimaButtonAirFlow
Definition: ir_Neoclima.h:49
IRremoteESP8266.h
IRNeoclimaAc::stateReset
void stateReset(void)
Reset the state of the remote to a known good state/sequence.
Definition: ir_Neoclima.cpp:72
IRNeoclimaAc::convertFan
uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Neoclima.cpp:296
kNeoclimaButtonOffset
const uint8_t kNeoclimaButtonOffset
Mask 0b000xxxxx.
Definition: ir_Neoclima.h:41
kNeoclimaButtonTempDown
const uint8_t kNeoclimaButtonTempDown
Definition: ir_Neoclima.h:46
IRNeoclimaAc::begin
void begin(void)
Set up hardware to be able to send a message.
Definition: ir_Neoclima.cpp:79
kNeoclima8CHeatOffset
const uint8_t kNeoclima8CHeatOffset
Definition: ir_Neoclima.h:31
kNeoclimaEconoOffset
const uint8_t kNeoclimaEconoOffset
Mask 0b000x0000.
Definition: ir_Neoclima.h:37
kNeoclimaSwingHOffset
const uint8_t kNeoclimaSwingHOffset
Definition: ir_Neoclima.h:68
kNeoclimaPowerOffset
const uint8_t kNeoclimaPowerOffset
Definition: ir_Neoclima.h:63
IRNeoclimaAc::getTemp
uint8_t getTemp(void)
Get the current temperature setting.
Definition: ir_Neoclima.cpp:258
kNeoclimaFanSize
const uint8_t kNeoclimaFanSize
Definition: ir_Neoclima.h:70
IRNeoclimaAc::getSwingV
bool getSwingV(void)
Get the vertical swing setting of the A/C.
Definition: ir_Neoclima.cpp:342
kNeoclimaButtonSize
const uint8_t kNeoclimaButtonSize
Mask 0b000xxxxx.
Definition: ir_Neoclima.h:42
kNeoclimaLightOffset
const uint8_t kNeoclimaLightOffset
Mask 0b0000000x.
Definition: ir_Neoclima.h:34
IRNeoclimaAc::remote_state
uint8_t remote_state[kNeoclimaStateLength]
State of the remote in code.
Definition: ir_Neoclima.h:168
kNeoclimaTempSize
const uint8_t kNeoclimaTempSize
Definition: ir_Neoclima.h:80
kNeoclimaButtonLight
const uint8_t kNeoclimaButtonLight
Definition: ir_Neoclima.h:53
IRNeoclimaAc::setIon
void setIon(const bool on)
Set the Ion (filter) setting of the A/C.
Definition: ir_Neoclima.cpp:414
kNeoclimaButtonSwing
const uint8_t kNeoclimaButtonSwing
Definition: ir_Neoclima.h:47
kNeoclimaButtonFollow
const uint8_t kNeoclimaButtonFollow
Definition: ir_Neoclima.h:56
IRNeoclimaAc::getHold
bool getHold(void)
Get the Hold setting of the A/C.
Definition: ir_Neoclima.cpp:408
IRNeoclimaAc::_irsend
IRsend _irsend
Instance of the IR send class.
Definition: ir_Neoclima.h:162
kNeoclimaSwingVOff
const uint8_t kNeoclimaSwingVOff
Definition: ir_Neoclima.h:67
IRNeoclimaAc::setSwingV
void setSwingV(const bool on)
Set the vertical swing setting of the A/C.
Definition: ir_Neoclima.cpp:334
IRNeoclimaAc::setEye
void setEye(const bool on)
Set the Eye (Sensor) setting of the A/C.
Definition: ir_Neoclima.cpp:457
IRNeoclimaAc::toCommonMode
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition: ir_Neoclima.cpp:228
kNeoclimaButtonSleep
const uint8_t kNeoclimaButtonSleep
Definition: ir_Neoclima.h:51
kNeoclimaTurboOffset
const uint8_t kNeoclimaTurboOffset
Mask 0b0000x000.
Definition: ir_Neoclima.h:36
IRNeoclimaAc::on
void on(void)
Set the requested power state of the A/C to on.
Definition: ir_Neoclima.cpp:167
kNeoclimaFanMed
const uint8_t kNeoclimaFanMed
Definition: ir_Neoclima.h:73
kNeoclimaButtonTempUnit
const uint8_t kNeoclimaButtonTempUnit
Definition: ir_Neoclima.h:60
IRNeoclimaAc::setFresh
void setFresh(const bool on)
Set the Fresh (air) setting of the A/C.
Definition: ir_Neoclima.cpp:388
IRNeoclimaAc::toCommon
stdAc::state_t toCommon(void)
Convert the current internal state into its stdAc::state_t equivalent.
Definition: ir_Neoclima.cpp:493
IRNeoclimaAc::setPower
void setPower(const bool on)
Change the power setting.
Definition: ir_Neoclima.cpp:174
kNeoclimaCool
const uint8_t kNeoclimaCool
Definition: ir_Neoclima.h:87
kNeoclimaHoldOffset
const uint8_t kNeoclimaHoldOffset
Mask 0b00000x00.
Definition: ir_Neoclima.h:35
kNeoclimaButton8CHeat
const uint8_t kNeoclimaButton8CHeat
Definition: ir_Neoclima.h:59
IRNeoclimaAc::getIon
bool getIon(void)
Get the Ion (filter) setting of the A/C.
Definition: ir_Neoclima.cpp:421
kNeoclimaSwingVOffset
const uint8_t kNeoclimaSwingVOffset
Definition: ir_Neoclima.h:64
IRNeoclimaAc::get8CHeat
bool get8CHeat(void)
Get the 8°C Heat setting of the A/C.
Definition: ir_Neoclima.cpp:451
kNeoclimaFanOffest
const uint8_t kNeoclimaFanOffest
Definition: ir_Neoclima.h:69
IRNeoclimaAc::convertMode
uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Neoclima.cpp:215
kNeoclimaHeat
const uint8_t kNeoclimaHeat
Definition: ir_Neoclima.h:90
IRNeoclimaAc::setButton
void setButton(const uint8_t button)
Set the Button/Command pressed setting of the A/C.
Definition: ir_Neoclima.cpp:132
kNeoclimaButtonIon
const uint8_t kNeoclimaButtonIon
Definition: ir_Neoclima.h:57
IRNeoclimaAc::toString
String toString(void)
Convert the current internal state into a human readable string.
Definition: ir_Neoclima.cpp:521
IRNeoclimaAc::setMode
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition: ir_Neoclima.cpp:187
kNeoclimaFanLow
const uint8_t kNeoclimaFanLow
Definition: ir_Neoclima.h:74
IRNeoclimaAc::setTurbo
void setTurbo(const bool on)
Set the Turbo setting of the A/C.
Definition: ir_Neoclima.cpp:362
IRNeoclimaAc::getTempUnits
bool getTempUnits(void)
Is the A/C unit using Fahrenheit or Celsius for temperature units.
Definition: ir_Neoclima.cpp:470
IRNeoclimaAc::checksum
void checksum(const uint16_t length=kNeoclimaStateLength)
Calculate & update the checksum for the internal state.
Definition: ir_Neoclima.cpp:103
kNeoclimaModeOffset
const uint8_t kNeoclimaModeOffset
Definition: ir_Neoclima.h:85
IRNeoclimaAc::setSwingH
void setSwingH(const bool on)
Set the horizontal swing setting of the A/C.
Definition: ir_Neoclima.cpp:349
IRNeoclimaAc::send
void send(const uint16_t repeat=kNeoclimaMinRepeat)
Send the current internal state as an IR message.
Definition: ir_Neoclima.cpp:111
IRNeoclimaAc::off
void off(void)
Set the requested power state of the A/C to off.
Definition: ir_Neoclima.cpp:170
stdAc::state_t
Structure to hold a common A/C state.
Definition: IRsend.h:97
kNeoclimaMinRepeat
const uint16_t kNeoclimaMinRepeat
Definition: IRremoteESP8266.h:1025
IRNeoclimaAc::IRNeoclimaAc
IRNeoclimaAc(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Neoclima.cpp:65
IRNeoclimaAc
Class for handling detailed Neoclima A/C messages.
Definition: ir_Neoclima.h:94
IRNeoclimaAc::getLight
bool getLight(void)
Get the Light (LED display) setting of the A/C.
Definition: ir_Neoclima.cpp:434
IRNeoclimaAc::setSleep
void setSleep(const bool on)
Set the Sleep setting of the A/C.
Definition: ir_Neoclima.cpp:321
IRNeoclimaAc::validChecksum
static bool validChecksum(const uint8_t state[], const uint16_t length=kNeoclimaStateLength)
Verify the checksum is valid for a given state.
Definition: ir_Neoclima.cpp:95
kNeoclimaButtonTempUp
const uint8_t kNeoclimaButtonTempUp
Definition: ir_Neoclima.h:45
stdAc::opmode_t
opmode_t
Common A/C settings for A/C operating modes.
Definition: IRsend.h:46