added MQTT "home/ems-esp/boiler_cmd_flowtemp"

This commit is contained in:
Paul
2019-07-27 09:45:38 +02:00
parent 33bd95c078
commit 6baa16667e
3 changed files with 23 additions and 15 deletions

View File

@@ -257,7 +257,7 @@ void _renderShortValue(const char * prefix, const char * postfix, int16_t value,
strlcat(buffer, _short_to_char(s, value, decimals), sizeof(buffer));
if (postfix != NULL) {
if (postfix != nullptr) {
strlcat(buffer, " ", sizeof(buffer));
strlcat(buffer, postfix, sizeof(buffer));
}
@@ -276,7 +276,7 @@ void _renderUShortValue(const char * prefix, const char * postfix, uint16_t valu
strlcat(buffer, _ushort_to_char(s, value, decimals), sizeof(buffer));
if (postfix != NULL) {
if (postfix != nullptr) {
strlcat(buffer, " ", sizeof(buffer));
strlcat(buffer, postfix, sizeof(buffer));
}
@@ -328,7 +328,7 @@ void _renderIntValue(const char * prefix, const char * postfix, uint8_t value, u
strlcat(buffer, _int_to_char(s, value, div), sizeof(buffer));
if (postfix != NULL) {
if (postfix != nullptr) {
strlcat(buffer, " ", sizeof(buffer));
strlcat(buffer, postfix, sizeof(buffer));
}
@@ -350,7 +350,7 @@ void _renderLongValue(const char * prefix, const char * postfix, uint32_t value)
strlcat(buffer, ltoa(value, s, 10), sizeof(buffer));
}
if (postfix != NULL) {
if (postfix != nullptr) {
strlcat(buffer, " ", sizeof(buffer));
strlcat(buffer, postfix, sizeof(buffer));
}
@@ -960,7 +960,7 @@ void set_showerAlert() {
// used to read the next string from an input buffer and convert to an 8 bit int
uint8_t _readIntNumber() {
char * numTextPtr = strtok(NULL, ", \n");
char * numTextPtr = strtok(nullptr, ", \n");
if (numTextPtr == nullptr) {
return 0;
}
@@ -969,7 +969,7 @@ uint8_t _readIntNumber() {
// used to read the next string from an input buffer and convert to a double
float _readFloatNumber() {
char * numTextPtr = strtok(NULL, ", \n");
char * numTextPtr = strtok(nullptr, ", \n");
if (numTextPtr == nullptr) {
return 0;
}
@@ -978,7 +978,7 @@ float _readFloatNumber() {
// used to read the next string from an input buffer as a hex value and convert to a 16 bit int
uint16_t _readHexNumber() {
char * numTextPtr = strtok(NULL, ", \n");
char * numTextPtr = strtok(nullptr, ", \n");
if (numTextPtr == nullptr) {
return 0;
}
@@ -987,7 +987,7 @@ uint16_t _readHexNumber() {
// used to read the next string from an input buffer
char * _readWord() {
char * word = strtok(NULL, ", \n");
char * word = strtok(nullptr, ", \n");
return word;
}
@@ -1563,6 +1563,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
myESP.mqttSubscribe(TOPIC_BOILER_WWACTIVATED);
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWTEMP);
myESP.mqttSubscribe(TOPIC_BOILER_CMD_COMFORT);
myESP.mqttSubscribe(TOPIC_BOILER_CMD_FLOWTEMP);
myESP.mqttSubscribe(TOPIC_SHOWER_TIMER);
myESP.mqttSubscribe(TOPIC_SHOWER_ALERT);
myESP.mqttSubscribe(TOPIC_SHOWER_COLDSHOT);
@@ -1662,6 +1663,13 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
}
}
// boiler flowtemp setting
if (strcmp(topic, TOPIC_BOILER_CMD_FLOWTEMP) == 0) {
uint8_t t = atoi((char *)message);
myDebug_P(PSTR("MQTT topic: boiler flowtemp value %d"), t);
ems_setFlowTemp(t);
}
// shower timer
if (strcmp(topic, TOPIC_SHOWER_TIMER) == 0) {
if (message[0] == '1') {

View File

@@ -183,7 +183,6 @@ const _SolarModule_Type SolarModule_Types[] = {
};
// Other EMS devices which are not considered boilers, thermostats or solar modules
// format is PRODUCT ID, DEVICE ID, DESCRIPTION
const _Other_Type Other_Types[] = {

View File

@@ -47,6 +47,7 @@
#define TOPIC_BOILER_WWACTIVATED "wwactivated" // for receiving MQTT message to change water on/off
#define TOPIC_BOILER_CMD_WWTEMP "boiler_cmd_wwtemp" // for received boiler wwtemp changes via MQTT
#define TOPIC_BOILER_CMD_COMFORT "boiler_cmd_comfort" // for received boiler ww comfort setting via MQTT
#define TOPIC_BOILER_CMD_FLOWTEMP "boiler_cmd_flowtemp" // for received boiler flowtemp value via MQTT
// MQTT for SM10/SM100 Solar Module
#define TOPIC_SM_DATA "sm_data" // topic name