From b33886224f606adbb75a22706d6280438b02240f Mon Sep 17 00:00:00 2001
From: Stephan Hadinger
53NGK009/012 Inverter
619EGX0090E0 A/C
619EGX0120E0 A/C
619EGX0180E0 A/C
619EGX0220E0 A/C | | - |
| [Coolix](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.cpp) | **[Beko](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.h)** | BINR 070/071 split-type A/C
BINR 070/071 split-type A/C
RG57K7(B)/BGEF Remote
RG57K7(B)/BGEF Remote | | Yes |
| [Coolix](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.cpp) | **[Midea](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.h)** | MS12FU-10HRDN1-QRD0GW(B) A/C
MS12FU-10HRDN1-QRD0GW(B) A/C
MSABAU-07HRFN1-QRD0GW A/C (circa 2016)
MSABAU-07HRFN1-QRD0GW A/C (circa 2016)
RG52D/BGE Remote
RG52D/BGE Remote | | Yes |
+| [Coolix](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.cpp) | **[Tokio](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.h)** | AATOEMF17-12CHR1SW split-type RG51|50/BGE Remote
AATOEMF17-12CHR1SW split-type RG51|50/BGE Remote | | Yes |
| [Daikin](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Daikin.cpp) | **[Daikin](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Daikin.h)** | 17 Series A/C (DAIKIN128)
ARC423A5 remote
ARC433** remote
ARC433B69 remote
ARC477A1 remote
ARC480A5 remote (DAIKIN152)
BRC4C153 remote
BRC52B63 remote (DAIKIN128)
FTE12HV2S A/C
FTXB09AXVJU A/C (DAIKIN128)
FTXB12AXVJU A/C (DAIKIN128)
FTXZ25NV1B A/C
FTXZ35NV1B A/C
FTXZ50NV1B A/C | | Yes |
| [Denon](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Denon.cpp) | **Unknown** | | | - |
| [Dish](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Dish.cpp) | **DISH NETWORK** | echostar 301 | | - |
| [Electra](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Electra.cpp) | **[AUX](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Electra.h)** | KFR-35GW/BpNFW=3 A/C
YKR-T/011 remote | | Yes |
-| [Fujitsu](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.cpp) | **[Fujitsu](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.h)** | AR-DB1 remote
AR-RAE1E remote
AR-RAH2E remote
AR-REB1E remote
AST9RSGCW A/C
ASYG30LFCA A/C
ASYG7LMCA A/C | ARDB1
ARJW2
ARRAH2E
ARREB1E | Yes |
-| [Fujitsu](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.cpp) | **[Fujitsu General](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.h)** | AR-JW2 remote | ARDB1
ARJW2
ARRAH2E
ARREB1E | Yes |
+| [Fujitsu](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.cpp) | **[Fujitsu](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.h)** | AGTV14LAC A/C
AR-DB1 remote
AR-DL10 remote
AR-RAC1E remote
AR-RAE1E remote
AR-RAH2E remote
AR-REB1E remote
AR-RY4 remote
AST9RSGCW A/C
ASTB09LBC A/C
ASU30C1 A/C
ASYG30LFCA A/C
ASYG7LMCA A/C | | Yes |
+| [Fujitsu](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.cpp) | **[Fujitsu General](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Fujitsu.h)** | AR-JW2 remote | | Yes |
| [GICable](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_GICable.cpp) | **Unknown** | | | - |
| [GlobalCache](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_GlobalCache.cpp) | **Unknown** | | | - |
| [Goodweather](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Goodweather.cpp) | **[Goodweather](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Goodweather.h)** | ZH/JT-03 remote | | Yes |
-| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[EKOKAI](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | A/C | YAW1F
YBOFB | Yes |
-| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Green](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | YBOFB remote
YBOFB2 remote | YAW1F
YBOFB | Yes |
-| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[RusClimate](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | EACS/I-09HAR_X/N3 A/C
YAW1F remote | YAW1F
YBOFB | Yes |
-| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Ultimate](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | Heat Pump | YAW1F
YBOFB | Yes |
+| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[EKOKAI](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | A/C | | Yes |
+| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Green](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | YBOFB remote
YBOFB2 remote | | Yes |
+| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[RusClimate](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | EACS/I-09HAR_X/N3 A/C
YAW1F remote | | Yes |
+| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Ultimate](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | Heat Pump | | Yes |
| [Haier](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Haier.cpp) | **[Haier](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Haier.h)** | HSU-09HMC203 A/C
HSU07-HEA03 remote
YR-W02 remote | | Yes |
-| [Hitachi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Hitachi.cpp) | **[Hitachi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Hitachi.h)** | LT0541-HTA remote
RAS-35THA6 remote
Series VI A/C (Circa 2007) | | Yes |
+| [Hitachi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Hitachi.cpp) | **[Hitachi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Hitachi.h)** | LT0541-HTA remote
RAR-8P2 remote
RAS-35THA6 remote
RAS-AJ25H A/C
Series VI A/C (Circa 2007) | | Yes |
| [Inax](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Inax.cpp) | **Lixil** | Inax DT-BA283 Toilet | | - |
| [JVC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_JVC.cpp) | **Unknown** | | | - |
| [Kelvinator](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Kelvinator.cpp) | **[Green](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Kelvinator.h)** | YAPOF3 remote | | Yes |
@@ -39,12 +40,13 @@
| [Midea](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Midea.cpp) | **[Comfee](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Midea.h)** | MPD1-12CRN7 A/C | | Yes |
| [Midea](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Midea.cpp) | **[Keystone](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Midea.h)** | RG57H4(B)BGEF remote | | Yes |
| [Midea](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Midea.cpp) | **[Pioneer System](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Midea.h)** | RUBO18GMFILCAD A/C (18K BTU)
RYBO12GMFILCAD A/C (12K BTU) | | Yes |
-| [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | HC3000 Projector
TV | | Yes |
+| [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | HC3000 Projector
KM14A 0179213 remote
MS-GK24VA A/C
TV | | Yes |
+| [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi Electric](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | 001CP T7WE10714 remote
KPOA remote
MSH-A24WV / MUH-A24WV A/C
PEAD-RP71JAA Ducted A/C | | Yes |
| [MitsubishiHeavy](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_MitsubishiHeavy.cpp) | **[Mitsubishi Heavy Industries](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_MitsubishiHeavy.h)** | RKX502A001C remote
RLA502A700B remote
SRKxxZJ-S A/C
SRKxxZM-S A/C
SRKxxZMXA-S A/C | | Yes |
| [NEC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.cpp) | **[Yamaha](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.h)** | RAV561 remote
RXV585B A/V Receiver | | Yes |
| [Neoclima](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Neoclima.cpp) | **[Neoclima](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Neoclima.h)** | NS-09AHTI A/C
NS-09AHTI A/C
ZH/TY-01 remote
ZH/TY-01 remote | | Yes |
| [Nikai](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Nikai.cpp) | **Unknown** | | | - |
-| [Panasonic](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Panasonic.cpp) | **[Panasonic](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Panasonic.h)** | A75C2311 remote (CKP)
A75C3704 remote
A75C3747 remote
A75C3747 remote
A75C3747 remote
A75C3747 remote
CKP series A/C
CS-ME10CKPG A/C
CS-ME12CKPG A/C
CS-ME14CKPG A/C
CS-YW9MKD A/C
CS-Z9RKR A/C
DKE series A/C
JKE series A/C
NKE series A/C
RKR series A/C
TV | CKP
DKE
JKE
LKE
NKE
RKR | Yes |
+| [Panasonic](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Panasonic.cpp) | **[Panasonic](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Panasonic.h)** | A75C2311 remote (CKP)
A75C3704 remote
A75C3747 remote
A75C3747 remote
A75C3747 remote
A75C3747 remote
CKP series A/C
CS-ME10CKPG A/C
CS-ME12CKPG A/C
CS-ME14CKPG A/C
CS-YW9MKD A/C
CS-Z9RKR A/C
DKE series A/C
JKE series A/C
NKE series A/C
RKR series A/C
TV | | Yes |
| [Pioneer](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Pioneer.cpp) | **Unknown** | | | - |
| [Pronto](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Pronto.cpp) | **Unknown** | | | - |
| [RC5_RC6](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_RC5_RC6.cpp) | **Unknown** | | | - |
@@ -59,16 +61,18 @@
| [Toshiba](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Toshiba.cpp) | **[Toshiba](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Toshiba.h)** | Akita EVO II
RAS 18SKP-ES
RAS-B13N3KV2
RAS-B13N3KVP-E
WC-L03SE
WH-TA04NE | | Yes |
| [Trotec](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Trotec.cpp) | **[Unknown](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Trotec.h)** | | | Yes |
| [Vestel](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Vestel.cpp) | **[Vestel](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Vestel.h)** | BIOX CXP-9 A/C (9K BTU) | | Yes |
-| [Whirlpool](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Whirlpool.cpp) | **[Whirlpool](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Whirlpool.h)** | DG11J1-04 remote
DG11J1-3A remote
DG11J1-91 remote
SPIS409L A/C
SPIS412L A/C
SPIW409L A/C
SPIW412L A/C
SPIW418L A/C | DG11J13A
DG11J191 | Yes |
+| [Whirlpool](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Whirlpool.cpp) | **[Whirlpool](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Whirlpool.h)** | DG11J1-04 remote
DG11J1-3A remote
DG11J1-91 remote
SPIS409L A/C
SPIS412L A/C
SPIW409L A/C
SPIW412L A/C
SPIW418L A/C | | Yes |
| [Whynter](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Whynter.cpp) | **Whynter** | ARC-110WD A/C | | - |
## Send only protocols:
- GLOBALCACHE
+- MITSUBISHI112
- PRONTO
- RAW
- SHERWOOD
+- TCL112AC
## Send & decodable protocols:
@@ -97,6 +101,7 @@
- HITACHI_AC
- HITACHI_AC1
- HITACHI_AC2
+- HITACHI_AC424
- INAX
- JVC
- KELVINATOR
@@ -108,6 +113,7 @@
- MAGIQUEST
- MIDEA
- MITSUBISHI
+- MITSUBISHI136
- MITSUBISHI2
- MITSUBISHI_AC
- MITSUBISHI_HEAVY_152
@@ -132,10 +138,10 @@
- SHARP
- SHARP_AC
- SONY
-- TCL112AC
- TECO
- TOSHIBA_AC
- TROTEC
- VESTEL_AC
- WHIRLPOOL_AC
- WHYNTER
+- typeguess
diff --git a/lib/IRremoteESP8266-2.7.0/examples/CommonAcControl/CommonAcControl.ino b/lib/IRremoteESP8266-2.7.0/examples/CommonAcControl/CommonAcControl.ino
new file mode 100644
index 000000000..4e11e631d
--- /dev/null
+++ b/lib/IRremoteESP8266-2.7.0/examples/CommonAcControl/CommonAcControl.ino
@@ -0,0 +1,72 @@
+/* Copyright 2019 David Conran
+*
+* This example code demonstrates how to use the "Common" IRac class to control
+* various air conditions. The IRac class does not support all the features
+* for every protocol. Some have more detailed support that what the "Common"
+* interface offers, and some only have a limited subset of the "Common" options.
+*
+* This example code will:
+* o Try to turn on, then off every fully supported A/C protocol we know of.
+* o It will try to put the A/C unit into Cooling mode at 25C, with a medium
+* fan speed, and no fan swinging.
+* Note: Some protocols support multiple models, only the first model is tried.
+*
+*/
+#include
";
+const char* kMqttTopics[] = {
+ KEY_PROTOCOL, KEY_MODEL, KEY_POWER, KEY_MODE, KEY_TEMP, KEY_FANSPEED,
+ KEY_SWINGV, KEY_SWINGH, KEY_QUIET, KEY_TURBO, KEY_LIGHT, KEY_BEEP,
+ KEY_ECONO, KEY_SLEEP, KEY_FILTER, KEY_CLEAN, KEY_CELSIUS, KEY_RESEND,
+ KEY_JSON}; // KEY_JSON needs to be the last one.
+
void mqttCallback(char* topic, byte* payload, unsigned int length);
String listOfCommandTopics(void);
@@ -303,12 +329,13 @@ void receivingMQTT(String const topic_name, String const callback_str);
void callback(char* topic, byte* payload, unsigned int length);
void sendMQTTDiscovery(const char *topic);
void doBroadcast(TimerMs *timer, const uint32_t interval,
- const stdAc::state_t state, const bool retain,
+ IRac *climates[], const bool retain,
const bool force);
#if MQTT_CLIMATE_JSON
-stdAc::state_t jsonToState(const stdAc::state_t current, const String str);
+stdAc::state_t jsonToState(const stdAc::state_t current, const char *str);
void sendJsonState(const stdAc::state_t state, const String topic,
- const bool retain = false, const bool ha_mode = true);
+ const bool retain = false,
+ const bool ha_mode = MQTT_CLIMATE_HA_MODE);
#endif // MQTT_CLIMATE_JSON
#endif // MQTT_ENABLE
#if REPORT_VCC
@@ -327,6 +354,7 @@ String gpioToString(const int16_t gpio);
uint8_t getDefaultIrSendIdx(void);
IRsend* getDefaultIrSendPtr(void);
int8_t getDefaultTxGpio(void);
+String genStatTopic(const uint16_t channel = 0);
String listOfTxGpios(void);
bool hasUnsafeHTMLChars(String input);
String htmlHeader(const String title, const String h1_text = "");
@@ -382,12 +410,11 @@ bool sendInt(const String topic, const int32_t num, const bool retain);
bool sendBool(const String topic, const bool on, const bool retain);
bool sendString(const String topic, const String str, const bool retain);
bool sendFloat(const String topic, const float_t temp, const bool retain);
-stdAc::state_t updateClimate(stdAc::state_t current, const String str,
- const String prefix, const String payload);
+void updateClimate(stdAc::state_t *current, const String str,
+ const String prefix, const String payload);
bool cmpClimate(const stdAc::state_t a, const stdAc::state_t b);
-bool sendClimate(const stdAc::state_t prev, const stdAc::state_t next,
- const String topic_prefix, const bool retain,
+bool sendClimate(const String topic_prefix, const bool retain,
const bool forceMQTT, const bool forceIR,
- const bool enableIR = true);
+ const bool enableIR = true, IRac *ac = NULL);
bool decodeCommonAc(const decode_results *decode);
#endif // EXAMPLES_IRMQTTSERVER_IRMQTTSERVER_H_
diff --git a/lib/IRremoteESP8266-2.6.5/examples/IRMQTTServer/IRMQTTServer.ino b/lib/IRremoteESP8266-2.7.0/examples/IRMQTTServer/IRMQTTServer.ino
old mode 100755
new mode 100644
similarity index 84%
rename from lib/IRremoteESP8266-2.6.5/examples/IRMQTTServer/IRMQTTServer.ino
rename to lib/IRremoteESP8266-2.7.0/examples/IRMQTTServer/IRMQTTServer.ino
index 730a8965f..6373181a0
--- a/lib/IRremoteESP8266-2.6.5/examples/IRMQTTServer/IRMQTTServer.ino
+++ b/lib/IRremoteESP8266-2.7.0/examples/IRMQTTServer/IRMQTTServer.ino
@@ -31,7 +31,7 @@
*
* - Arduino IDE:
* o Install the following libraries via Library Manager
- * - ArduinoJson (https://arduinojson.org/) (Version >= 5.0 and < 6.0)
+ * - ArduinoJson (https://arduinojson.org/) (Version >= 6.0)
* - PubSubClient (https://pubsubclient.knolleary.net/)
* - WiFiManager (https://github.com/tzapu/WiFiManager)
* (ESP8266: Version >= 0.14, ESP32: 'development' branch.)
@@ -72,10 +72,14 @@
* http://
Device restarting. Try connecting in a few seconds.
" + + addJsReloadUrl(kUrlRoot, 10, true) + + htmlEnd()); + // Do the clearing. + mqttLog("Clearing all saved settings from MQTT."); + clearMqttSavedStates(MqttClimate); + doRestart("Rebooting..."); +} +#endif // MQTT_ENABLE && MQTT_CLEAR_ENABLE + // Reset web page void handleReset(void) { #if HTML_PASSWORD_ENABLE @@ -1278,6 +1425,10 @@ void handleReset(void) { htmlEnd()); // Do the reset. #if MQTT_ENABLE +#if MQTT_CLEAR_ENABLE + mqttLog("Clearing all saved climate settings from MQTT."); + clearMqttSavedStates(MqttClimate); +#endif // MQTT_CLEAR_ENABLE mqttLog("Wiping all saved config settings."); #endif // MQTT_ENABLE if (mountSpiffs()) { @@ -1648,6 +1799,7 @@ void handleIr(void) { decode_type_t ir_type = decode_type_t::NEC; // Default to NEC codes. uint16_t nbits = 0; uint16_t repeat = 0; + int16_t channel = -1; for (uint16_t i = 0; i < server.args(); i++) { if (server.argName(i).equals(KEY_TYPE) || @@ -1660,11 +1812,16 @@ void handleIr(void) { nbits = server.arg(i).toInt(); } else if (server.argName(i).equals(KEY_REPEAT)) { repeat = server.arg(i).toInt(); + } else if (server.argName(i).equals(KEY_CHANNEL)) { + channel = server.arg(i).toInt(); } } debug("New code received via HTTP"); - lastSendSucceeded = sendIRCode(getDefaultIrSendPtr(), ir_type, data, - data_str.c_str(), nbits, repeat); + IRsend *tx_ptr = getDefaultIrSendPtr(); + if (channel >= 0 && channel < kNrOfIrTxGpios && IrSendTable[channel] != NULL) + tx_ptr = IrSendTable[channel]; + lastSendSucceeded = sendIRCode(tx_ptr, ir_type, data, data_str.c_str(), nbits, + repeat); String html = htmlHeader(F("IR command sent!")); html += addJsReloadUrl(kUrlRoot, kQuickDisplayTime, true); html += htmlEnd(); @@ -1831,7 +1988,7 @@ void setup_wifi(void) { #if MIN_SIGNAL_STRENGTH wifiManager.setMinimumSignalQuality(MIN_SIGNAL_STRENGTH); #endif // MIN_SIGNAL_STRENGTH - wifiManager.setRemoveDuplicateAPs(HIDE_DUPLIATE_NETWORKS); + wifiManager.setRemoveDuplicateAPs(HIDE_DUPLICATE_NETWORKS); if (!wifiManager.autoConnect()) // Reboot. A.k.a. "Have you tried turning it Off and On again?" @@ -1873,7 +2030,6 @@ void init_vars(void) { // Sub-topic for the climate command topics. MqttClimateCmnd = MqttClimate + '/' + MQTT_CLIMATE_CMND + '/'; // Sub-topic for the climate stat topics. - MqttClimateStat = MqttClimate + '/' + MQTT_CLIMATE_STAT + '/'; #if MQTT_DISCOVERY_ENABLE MqttDiscovery = "homeassistant/climate/" + String(Hostname) + "/config"; #endif // MQTT_DISCOVERY_ENABLE @@ -1884,28 +2040,6 @@ void init_vars(void) { } void setup(void) { - // Set the default climate settings. - climate.protocol = decode_type_t::UNKNOWN; - climate.model = -1; // Unknown. - climate.power = false; - climate.mode = stdAc::opmode_t::kAuto; - climate.celsius = true; - climate.degrees = 25; // 25C - climate.fanspeed = stdAc::fanspeed_t::kAuto; - climate.swingv = stdAc::swingv_t::kAuto; - climate.swingh = stdAc::swingh_t::kAuto; - climate.quiet = false; - climate.turbo = false; - climate.econo = false; - climate.light = false; - climate.filter = false; - climate.clean = false; - climate.beep = false; - climate.sleep = -1; // Off - climate.clock = -1; // Don't set. - climate_prev = climate; - lastClimateSource = F("None"); - #if DEBUG if (!isSerialGpioUsedByIr()) { #if defined(ESP8266) @@ -1928,17 +2062,29 @@ void setup(void) { if (isSerialGpioUsedByIr()) Serial.end(); #endif // DEBUG + channel_re.reserve(kNrOfIrTxGpios * 3); // Initialise all the IR transmitters. for (uint8_t i = 0; i < kNrOfIrTxGpios; i++) { if (txGpioTable[i] == kGpioUnused) { IrSendTable[i] = NULL; + climate[i] = NULL; } else { IrSendTable[i] = new IRsend(txGpioTable[i], kInvertTxOutput); - if (IrSendTable[i] == NULL) break; - IrSendTable[i]->begin(); - offset = IrSendTable[i]->calibrate(); + if (IrSendTable[i] != NULL) { + IrSendTable[i]->begin(); + offset = IrSendTable[i]->calibrate(); + } + climate[i] = new IRac(txGpioTable[i], kInvertTxOutput); + if (climate[i] != NULL && i > 0) channel_re += '_' + String(i) + '|'; } } + lastClimateSource = F("None"); + if (channel_re.length() == 1) { + channel_re = ""; + } else { + channel_re.remove(channel_re.length() - 1, 1); // Remove the last char. + channel_re += F(")?"); + } #if IR_RX if (rx_gpio != kGpioUnused) irrecv = new IRrecv(rx_gpio, kCaptureBufferSize, kCaptureTimeout, true); @@ -1950,8 +2096,6 @@ void setup(void) { irrecv->enableIRIn(IR_RX_PULLUP); // Start the receiver } #endif // IR_RX - commonAc = new IRac(txGpioTable[0], kInvertTxOutput); - // Wait a bit for things to settle. delay(500); @@ -1992,6 +2136,10 @@ void setup(void) { // Parse and update the new gpios. server.on(kUrlGpioSet, handleGpioSetting); #if MQTT_ENABLE +#if MQTT_CLEAR_ENABLE + // Clear settings saved to MQTT as retained messages. + server.on(kUrlClearMqtt, handleClearMqtt); +#endif // MQTT_CLEAR_ENABLE #if MQTT_DISCOVERY_ENABLE // MQTT Discovery url server.on(kUrlSendDiscovery, handleSendMqttDiscovery); @@ -2070,6 +2218,13 @@ void setup(void) { } #if MQTT_ENABLE +String genStatTopic(const uint16_t channel) { + if (channel) // Never use the '*_0' state channel. + return MqttClimate + "_" + String(channel) + '/' + MQTT_CLIMATE_STAT + '/'; + else + return MqttClimate + '/' + MQTT_CLIMATE_STAT + '/'; +} + // MQTT subscribing to topic void subscribing(const String topic_name) { // subscription to topic for receiving data with QoS. @@ -2125,12 +2280,18 @@ bool reconnect(void) { mqttSentCounter++; // Subscribing to topic(s) - subscribing(MqttSend); - for (uint8_t i = 0; i < kNrOfIrTxGpios; i++) { - subscribing(MqttSend + '_' + String(static_cast