mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-13 11:19:52 +03:00
Test new tx_mode 2, small changes to MM100, SM100 and RC300, see #397
This commit is contained in:
@@ -62,23 +62,72 @@ void System::mqtt_commands(const char * message) {
|
||||
LOG_DEBUG(F("MQTT error: payload %s, error %s"), message, error.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// restart EMS-ESP
|
||||
if (strcmp(message, "restart") == 0) {
|
||||
LOG_INFO(F("Restart command received"));
|
||||
restart();
|
||||
}
|
||||
|
||||
if (doc["send"] != nullptr) {
|
||||
const char * data = doc["send"];
|
||||
EMSESP::send_raw_telegram(data);
|
||||
LOG_INFO(F("Sending raw: %s"),data);
|
||||
|
||||
}
|
||||
|
||||
#if defined(ESP8266)
|
||||
const uint8_t d0_ = 16;
|
||||
const uint8_t d1_ = 5;
|
||||
const uint8_t d2_ = 4;
|
||||
const uint8_t d3_ = 0;
|
||||
#elif defined(ESP32)
|
||||
const uint8_t d0_ = 26;
|
||||
const uint8_t d1_ = 22;
|
||||
const uint8_t d2_ = 21;
|
||||
const uint8_t d3_ = 17;
|
||||
#endif
|
||||
if(doc["D0"] != nullptr) {
|
||||
const int8_t set = doc["D0"];
|
||||
pinMode(d0_, OUTPUT);
|
||||
if (set == 1) digitalWrite(d0_, HIGH);
|
||||
else if (set == 0) digitalWrite(d0_, LOW);
|
||||
LOG_INFO(F("Port D0 set to %d"),set);
|
||||
}
|
||||
if(doc["D1"] != nullptr) {
|
||||
const int8_t set = doc["D1"];
|
||||
pinMode(d1_, OUTPUT);
|
||||
if (set == 1) digitalWrite(d1_, HIGH);
|
||||
else if (set == 0) digitalWrite(d1_, LOW);
|
||||
LOG_INFO(F("Port D1 set to %d"),set);
|
||||
}
|
||||
if(doc["D2"] != nullptr) {
|
||||
const int8_t set = doc["D2"];
|
||||
pinMode(d2_, OUTPUT);
|
||||
if (set == 1) digitalWrite(d2_, HIGH);
|
||||
else if (set == 0) digitalWrite(d2_, LOW);
|
||||
LOG_INFO(F("Port D2 set to %d"),set);
|
||||
}
|
||||
if(doc["D3"] != nullptr) {
|
||||
const int8_t set = doc["D3"];
|
||||
pinMode(d3_, OUTPUT);
|
||||
if (set == 1) digitalWrite(d3_, HIGH);
|
||||
else if (set == 0) digitalWrite(d3_, LOW);
|
||||
LOG_INFO(F("Port D3 set to %d"),set);
|
||||
}
|
||||
|
||||
const char * command = doc["cmd"];
|
||||
if (command == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// restart EMS-ESP
|
||||
if (strcmp(message, "restart") == 0) {
|
||||
restart();
|
||||
}
|
||||
|
||||
// boiler ww comfort setting
|
||||
// send raw command
|
||||
if (strcmp(command, "send") == 0) {
|
||||
const char * data = doc["data"];
|
||||
if (data == nullptr) {
|
||||
return;
|
||||
}
|
||||
EMSESP::send_raw_telegram(data);
|
||||
LOG_INFO(F("Sending raw: %s"),data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user