mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
added temp and mode to thermostat_cmd MQTT topic
This commit is contained in:
@@ -1611,7 +1611,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
|
||||
uint8_t hc;
|
||||
// thermostat temp changes
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_TEMP, topic);
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_TEMP_HA, topic);
|
||||
if (hc) {
|
||||
float f = strtof((char *)message, 0);
|
||||
ems_setThermostatTemp(f, hc);
|
||||
@@ -1620,7 +1620,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
}
|
||||
|
||||
// thermostat mode changes
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_MODE, topic);
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_MODE_HA, topic);
|
||||
if (hc) {
|
||||
if (strncmp(message, "auto", 4) == 0) {
|
||||
ems_setThermostatMode(2, hc);
|
||||
@@ -1643,6 +1643,29 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
}
|
||||
const char * command = doc["cmd"];
|
||||
|
||||
// thermostat temp changes
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_TEMP, command);
|
||||
if (hc) {
|
||||
float f = doc["data"];
|
||||
ems_setThermostatTemp(f, hc);
|
||||
publishValues(true); // publish back immediately
|
||||
return;
|
||||
}
|
||||
|
||||
// thermostat mode changes
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_MODE, command);
|
||||
if (hc) {
|
||||
const char * data_cmd = doc["data"];
|
||||
if (strncmp(data_cmd, "auto", 4) == 0) {
|
||||
ems_setThermostatMode(2, hc);
|
||||
} else if ((strncmp(data_cmd, "day", 4) == 0) || (strncmp(data_cmd, "manual", 6) == 0) || (strncmp(data_cmd, "heat", 4) == 0)) {
|
||||
ems_setThermostatMode(1, hc);
|
||||
} else if ((strncmp(data_cmd, "night", 5) == 0) || (strncmp(data_cmd, "off", 3) == 0)) {
|
||||
ems_setThermostatMode(0, hc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// set night temp value
|
||||
hc = _hasHCspecified(TOPIC_THERMOSTAT_CMD_NIGHTTEMP, command);
|
||||
if (hc) {
|
||||
|
||||
@@ -18,12 +18,14 @@
|
||||
// these topics can be suffixed with a Heating Circuit number, e.g. thermostat_cmd_temp1 and thermostat_data1
|
||||
#define TOPIC_THERMOSTAT_DATA "thermostat_data" // for sending thermostat values to MQTT
|
||||
|
||||
#define TOPIC_THERMOSTAT_CMD "thermostat_cmd" // for receiving thermostat commands via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_TEMP "thermostat_cmd_temp" // temp changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_MODE "thermostat_cmd_mode" // mode changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_DAYTEMP "daytemp" // day temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD_NIGHTTEMP "nighttemp" // night temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD_HOLIDAYTEMP "holidayttemp" // holiday temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD "thermostat_cmd" // for receiving thermostat commands via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_TEMP_HA "thermostat_cmd_temp" // temp changes via MQTT, for HA climate component
|
||||
#define TOPIC_THERMOSTAT_CMD_MODE_HA "thermostat_cmd_mode" // mode changes via MQTT, for HA climate component
|
||||
#define TOPIC_THERMOSTAT_CMD_TEMP "temp" // temp changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_MODE "mode" // mode changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_DAYTEMP "daytemp" // day temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD_NIGHTTEMP "nighttemp" // night temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD_HOLIDAYTEMP "holidayttemp" // holiday temp (RC35 specific)
|
||||
|
||||
#define THERMOSTAT_CURRTEMP "currtemp" // current temperature
|
||||
#define THERMOSTAT_SELTEMP "seltemp" // selected temperature
|
||||
|
||||
Reference in New Issue
Block a user