# IRremoteESP8266: src/ir_Technibel.h Source File

ir_Technibel.h
Go to the documentation of this file.
// Copyright 2020 Quentin Briollant
#ifndef IR_TECHNIBEL_H_
#define IR_TECHNIBEL_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
// Supports:
// Brand: Technibel, Model: IRO PLUS
/* State bit map:
+--+--+--+--+--+--+--+--+--+------------+-----------+----------+--+--+--+--+
| FIXED HEADER |ON|TIMER CHANGE|TEMP CHANGE|FAN CHANGE| MODE |
+--+--+--+--+--+--+--+--+--+------------+-----------+----------+--+--+--+--+
55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
+-----+------+-----+-----+---+--+--+--+---+--+--+--+--+--+--+--+
|TIMER|C OR F|SWING|SLEEP| 0 | FAN | 0 | TEMPERATURE |
+-----+------+-----+-----+---+--+--+--+---+--+--+--+--+--+--+--+
39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24
+---+---+---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| 0 | 0 | 0 | ON TIME HOUR | FOOTER | CHECKSUM |
+---+---+---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
*/
// Constants
const uint8_t kTechnibelAcChecksumOffset = 0;
const uint8_t kTechnibelAcChecksumSize = 8;
const uint8_t kTechnibelAcFooterOffset = kTechnibelAcChecksumOffset +
kTechnibelAcChecksumSize;
const uint8_t kTechnibelAcFooterSize = 8;
const uint8_t kTechnibelAcTimerHoursOffset = kTechnibelAcFooterOffset +
kTechnibelAcFooterSize;
const uint8_t kTechnibelAcHoursSize = 8; // Max 24 hrs
const uint8_t kTechnibelAcTimerMax = 24;
const uint8_t kTechnibelAcTempOffset = kTechnibelAcTimerHoursOffset +
kTechnibelAcHoursSize;
const uint8_t kTechnibelAcTempSize = 8;
const uint8_t kTechnibelAcTempMinC = 16; // Deg C
const uint8_t kTechnibelAcTempMaxC = 31; // Deg C
const uint8_t kTechnibelAcTempMinF = 61; // Deg F
const uint8_t kTechnibelAcTempMaxF = 88; // Deg F
const uint8_t kTechnibelAcFanOffset = kTechnibelAcTempOffset
+ kTechnibelAcTempSize;
const uint8_t kTechnibelAcFanSize = 4;
const uint8_t kTechnibelAcFanLow = 0b0001;
const uint8_t kTechnibelAcFanMedium = 0b0010;
const uint8_t kTechnibelAcFanHigh = 0b0100;
const uint8_t kTechnibelAcSleepBit = kTechnibelAcFanOffset +
kTechnibelAcFanSize;
const uint8_t kTechnibelAcSwingBit = kTechnibelAcSleepBit + 1;
// (0 = Celsius, 1 = Fahrenheit)
const uint8_t kTechnibelAcTempUnitBit = kTechnibelAcSwingBit + 1;
const uint8_t kTechnibelAcTimerEnableBit = kTechnibelAcTempUnitBit + 1;
const uint8_t kTechnibelAcModeOffset = kTechnibelAcTimerEnableBit + 1;
const uint8_t kTechnibelAcModeSize = 4;
const uint8_t kTechnibelAcCool = 0b0001;
const uint8_t kTechnibelAcDry = 0b0010;
const uint8_t kTechnibelAcFan = 0b0100;
const uint8_t kTechnibelAcHeat = 0b1000;
const uint8_t kTechnibelAcFanChangeBit = kTechnibelAcModeOffset +
kTechnibelAcModeSize;
const uint8_t kTechnibelAcTempChangeBit = kTechnibelAcFanChangeBit + 1;
const uint8_t kTechnibelAcTimerChangeBit = kTechnibelAcTempChangeBit + 1;
const uint8_t kTechnibelAcPowerBit = kTechnibelAcTimerChangeBit + 1;
const uint8_t kTechnibelAcHeaderOffset = kTechnibelAcPowerBit + 1;
const uint8_t kTechnibelAcHeaderSize = 8;
const uint8_t kTechnibelAcHeader = 0b00011000;
const uint64_t kTechnibelAcResetState = 0x180101140000EA;
// Classes
class IRTechnibelAc {
public:
explicit IRTechnibelAc(const uint16_t pin, const bool inverted = false,
const bool use_modulation = true);
void stateReset();
#if SEND_TECHNIBEL_AC
void send(const uint16_t repeat = kTechnibelAcDefaultRepeat);
int8_t calibrate(void) { return _irsend.calibrate(); }
#endif // SEND_TECHNIBEL_AC
void begin();
static uint8_t calcChecksum(const uint64_t state);
static bool validChecksum(const uint64_t state);
void setPower(const bool on);
bool getPower();
void on();
void off();
void setTempUnit(const bool celsius);
bool getTempUnit(void);
void setTemp(const uint8_t temp, const bool fahrenheit = false);
uint8_t getTemp();
void setFan(const uint8_t speed);
uint8_t getFan();
void setMode(const uint8_t mode);
uint8_t getMode();
void setSwing(const bool on);
bool getSwing();
bool convertSwing(const stdAc::swingv_t swing);
stdAc::swingv_t toCommonSwing(const bool swing);
void setSleep(const bool on);
bool getSleep();
void setTimerEnabled(const bool on);
bool getTimerEnabled(void);
void setTimer(const uint16_t nr_of_mins);
uint16_t getTimer(void);
uint64_t getRaw();
void setRaw(const uint64_t state);
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);
String toString();
#ifndef UNIT_TEST
private:
IRsend _irsend;
#else
IRsendTest _irsend;
#endif
uint64_t remote_state; // The state of the IR remote.
uint8_t _saved_temp; // The previously user requested temp value.
uint8_t _saved_temp_units; // The previously user requested temp units.
void checksum(void);
};
#endif // IR_TECHNIBEL_H_
IRTechnibelAc::_irsend
IRsendTest _irsend
Definition: ir_Technibel.h:159
IRTechnibelAc::toString
String toString()
Convert the current internal state into a human readable string.
Definition: ir_Technibel.cpp:399
IRTechnibelAc::calcChecksum
static uint8_t calcChecksum(const uint64_t state)
Compute the checksum of the supplied state.
Definition: ir_Technibel.cpp:109
IRTechnibelAc::getTempUnit
bool getTempUnit(void)
Get the temperature unit setting.
Definition: ir_Technibel.cpp:180
IRTechnibelAc::setMode
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition: ir_Technibel.cpp:260
IRTechnibelAc::getTemp
uint8_t getTemp()
Get the current temperature setting.
Definition: ir_Technibel.cpp:198
IRTechnibelAc::getTimer
uint16_t getTimer(void)
Get the timer time for when the A/C unit will switch power state.
Definition: ir_Technibel.cpp:365
IRTechnibelAc::stateReset
void stateReset()
Reset the internal state of the emulation.
Definition: ir_Technibel.cpp:134
kTechnibelAcFooterSize
const uint8_t kTechnibelAcFooterSize
Definition: ir_Technibel.h:50
kTechnibelAcTempMinF
const uint8_t kTechnibelAcTempMinF
Definition: ir_Technibel.h:62
IRTechnibelAc::begin
void begin()
Set up hardware to be able to send a message.
Definition: ir_Technibel.cpp:96
stdAc::swingv_t
swingv_t
Common A/C settings for Vertical Swing.
Definition: IRsend.h:70
kTechnibelAcFanLow
const uint8_t kTechnibelAcFanLow
Definition: ir_Technibel.h:68
stdAc::fanspeed_t
fanspeed_t
Common A/C settings for Fan Speeds.
Definition: IRsend.h:58
kTechnibelAcFanSize
const uint8_t kTechnibelAcFanSize
Definition: ir_Technibel.h:67
IRTechnibelAc::toCommonMode
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition: ir_Technibel.cpp:292
IRTechnibelAc::setRaw
void setRaw(const uint64_t state)
Set the internal state from a valid code for this protocol.
Definition: ir_Technibel.cpp:149
IRTechnibelAc::IRTechnibelAc
IRTechnibelAc(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Technibel.cpp:91
IRTechnibelAc::setTempUnit
void setTempUnit(const bool celsius)
Set the temperature unit setting.
Definition: ir_Technibel.cpp:173
IRsend.h
IRTechnibelAc::setTimer
void setTimer(const uint16_t nr_of_mins)
Set the timer for when the A/C unit will switch off.
Definition: ir_Technibel.cpp:355
IRTechnibelAc::checksum
void checksum(void)
Set the checksum of the internal state.
Definition: ir_Technibel.cpp:127
IRTechnibelAc::validChecksum
static bool validChecksum(const uint64_t state)
Confirm the checksum of the supplied state is valid.
Definition: ir_Technibel.cpp:121
IRsend
Class for sending all basic IR protocols.
Definition: IRsend.h:182
kTechnibelAcChecksumOffset
const uint8_t kTechnibelAcChecksumOffset
Definition: ir_Technibel.h:45
kTechnibelAcTimerEnableBit
const uint8_t kTechnibelAcTimerEnableBit
Definition: ir_Technibel.h:80
IRsend::calibrate
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition: IRsend.cpp:207
IRTechnibelAc::getPower
bool getPower()
Get the value of the current power setting.
Definition: ir_Technibel.cpp:167
IRTechnibelAc::setTemp
void setTemp(const uint8_t temp, const bool fahrenheit=false)
Set the temperature.
Definition: ir_Technibel.cpp:187
IRTechnibelAc::remote_state
uint64_t remote_state
Definition: ir_Technibel.h:161
IRTechnibelAc::getRaw
uint64_t getRaw()
Get a copy of the internal state/code for this protocol.
Definition: ir_Technibel.cpp:142
String
std::string String
Definition: IRremoteESP8266.h:1178
kTechnibelAcTempMaxC
const uint8_t kTechnibelAcTempMaxC
Definition: ir_Technibel.h:61
kTechnibelAcTempOffset
const uint8_t kTechnibelAcTempOffset
Definition: ir_Technibel.h:57
kTechnibelAcSleepBit
const uint8_t kTechnibelAcSleepBit
Definition: ir_Technibel.h:72
IRremoteESP8266.h
IRTechnibelAc::toCommonSwing
stdAc::swingv_t toCommonSwing(const bool swing)
Convert a native swing into its stdAc equivalent.
Definition: ir_Technibel.cpp:323
kTechnibelAcFanOffset
const uint8_t kTechnibelAcFanOffset
Definition: ir_Technibel.h:65
kTechnibelAcFanHigh
const uint8_t kTechnibelAcFanHigh
Definition: ir_Technibel.h:70
kTechnibelAcTimerMax
const uint8_t kTechnibelAcTimerMax
Definition: ir_Technibel.h:55
IRTechnibelAc::send
void send(const uint16_t repeat=kTechnibelAcDefaultRepeat)
Send the current internal state as an IR message.
Definition: ir_Technibel.cpp:101
IRTechnibelAc::off
void off()
Set the requested power state of the A/C to off.
Definition: ir_Technibel.cpp:157
kTechnibelAcCool
const uint8_t kTechnibelAcCool
Definition: ir_Technibel.h:84
kTechnibelAcTimerChangeBit
const uint8_t kTechnibelAcTimerChangeBit
Definition: ir_Technibel.h:94
kTechnibelAcFan
const uint8_t kTechnibelAcFan
Definition: ir_Technibel.h:86
kTechnibelAcHeader
const uint8_t kTechnibelAcHeader
Definition: ir_Technibel.h:100
IRTechnibelAc::getTimerEnabled
bool getTimerEnabled(void)
Is the timer function enabled?
Definition: ir_Technibel.cpp:347
IRTechnibelAc::getSleep
bool getSleep()
Get the Sleep setting of the A/C.
Definition: ir_Technibel.cpp:335
kTechnibelAcHeat
const uint8_t kTechnibelAcHeat
Definition: ir_Technibel.h:87
kTechnibelAcFanChangeBit
const uint8_t kTechnibelAcFanChangeBit
Definition: ir_Technibel.h:89
kTechnibelAcHeaderSize
const uint8_t kTechnibelAcHeaderSize
Definition: ir_Technibel.h:99
IRTechnibelAc
Class for handling detailed Technibel A/C messages.
Definition: ir_Technibel.h:108
IRTechnibelAc::toCommon
stdAc::state_t toCommon(void)
Convert the current internal state into its stdAc::state_t equivalent.
Definition: ir_Technibel.cpp:373
kTechnibelAcPowerBit
const uint8_t kTechnibelAcPowerBit
Definition: ir_Technibel.h:96
IRTechnibelAc::convertFan
uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Technibel.cpp:230
kTechnibelAcSwingBit
const uint8_t kTechnibelAcSwingBit
Definition: ir_Technibel.h:75
IRTechnibelAc::_saved_temp
uint8_t _saved_temp
Definition: ir_Technibel.h:162
kTechnibelAcTempUnitBit
const uint8_t kTechnibelAcTempUnitBit
Definition: ir_Technibel.h:78
kTechnibelAcModeOffset
const uint8_t kTechnibelAcModeOffset
Definition: ir_Technibel.h:82
kTechnibelAcHeaderOffset
const uint8_t kTechnibelAcHeaderOffset
Definition: ir_Technibel.h:98
kTechnibelAcHoursSize
const uint8_t kTechnibelAcHoursSize
Definition: ir_Technibel.h:54
IRTechnibelAc::getSwing
bool getSwing()
Get the (vertical) swing setting of the A/C.
Definition: ir_Technibel.cpp:309
kTechnibelAcTempMinC
const uint8_t kTechnibelAcTempMinC
Definition: ir_Technibel.h:60
kTechnibelAcTempSize
const uint8_t kTechnibelAcTempSize
Definition: ir_Technibel.h:59
kTechnibelAcTimerHoursOffset
const uint8_t kTechnibelAcTimerHoursOffset
Definition: ir_Technibel.h:52
IRTechnibelAc::_saved_temp_units
uint8_t _saved_temp_units
Definition: ir_Technibel.h:163
IRTechnibelAc::getFan
uint8_t getFan()
Get the current fan speed setting.
Definition: ir_Technibel.cpp:223
kTechnibelAcResetState
const uint64_t kTechnibelAcResetState
Mode:Cool, Power:Off, fan:Low, temp:20, swing:Off, sleep:Off.
Definition: ir_Technibel.h:102
IRTechnibelAc::setTimerEnabled
void setTimerEnabled(const bool on)
Set the enable timer setting.
Definition: ir_Technibel.cpp:341
kTechnibelAcDefaultRepeat
const uint16_t kTechnibelAcDefaultRepeat
Definition: IRremoteESP8266.h:929
IRTechnibelAc::setSwing
void setSwing(const bool on)
Set the (vertical) swing setting of the A/C.
Definition: ir_Technibel.cpp:303
IRTechnibelAc::getMode
uint8_t getMode()
Get the operating mode setting of the A/C.
Definition: ir_Technibel.cpp:254
IRTechnibelAc::calibrate
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Technibel.h:119
IRTechnibelAc::toCommonFanSpeed
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition: ir_Technibel.cpp:244
kTechnibelAcFanMedium
const uint8_t kTechnibelAcFanMedium
Definition: ir_Technibel.h:69
kTechnibelAcFooterOffset
const uint8_t kTechnibelAcFooterOffset
Definition: ir_Technibel.h:48
IRTechnibelAc::on
void on()
Set the requested power state of the A/C to on.
Definition: ir_Technibel.cpp:154
stdAc::state_t
Structure to hold a common A/C state.
Definition: IRsend.h:97
IRTechnibelAc::convertSwing
bool convertSwing(const stdAc::swingv_t swing)
Convert a stdAc::swingv_t enum into it's native swing.
Definition: ir_Technibel.cpp:316
IRTechnibelAc::convertMode
uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Technibel.cpp:280
kTechnibelAcDry
const uint8_t kTechnibelAcDry
Definition: ir_Technibel.h:85
kTechnibelAcModeSize
const uint8_t kTechnibelAcModeSize
Definition: ir_Technibel.h:83
kTechnibelAcChecksumSize
const uint8_t kTechnibelAcChecksumSize
Definition: ir_Technibel.h:46
kTechnibelAcTempMaxF
const uint8_t kTechnibelAcTempMaxF
Definition: ir_Technibel.h:63
IRTechnibelAc::_irsend
IRsend _irsend
Definition: ir_Technibel.h:157
IRTechnibelAc::setPower
void setPower(const bool on)
Change the power setting.
Definition: ir_Technibel.cpp:161
IRTechnibelAc::setSleep
void setSleep(const bool on)
Set the Sleep setting of the A/C.
Definition: ir_Technibel.cpp:329
IRTechnibelAc::setFan
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition: ir_Technibel.cpp:204
kTechnibelAcTempChangeBit
const uint8_t kTechnibelAcTempChangeBit
Definition: ir_Technibel.h:92
stdAc::opmode_t
opmode_t
Common A/C settings for A/C operating modes.
Definition: IRsend.h:46