From b999dd339578396b7c1e9738fbe7da53d7eec3ea Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 3 Jan 2019 19:42:58 +0100 Subject: [PATCH] 1.2.4 --- CHANGELOG.md | 7 +++++++ lib/myESP/MyESP.cpp | 2 +- lib/myESP/MyESP.h | 1 + src/boiler.ino | 16 ++++++++-------- src/ems.cpp | 6 +----- src/ems.h | 1 + src/version.h | 2 +- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a5210749..2e3a90d07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.4] 2019-01-03 + +### Fixed + +- RC35 fetching current temp +- MQTT data max set to 600 and resolved a memory issue + ## [1.2.3] 2019-01-03 ### Fixed diff --git a/lib/myESP/MyESP.cpp b/lib/myESP/MyESP.cpp index aa529ca8e..21db9d06c 100644 --- a/lib/myESP/MyESP.cpp +++ b/lib/myESP/MyESP.cpp @@ -193,7 +193,7 @@ void MyESP::mqttUnsubscribe(const char * topic) { // MQTT Publish void MyESP::mqttPublish(const char * topic, const char * payload) { - char s[600]; + char s[MQTT_MAX_SIZE]; snprintf(s, sizeof(s), "%s%s/%s", MQTT_BASE, _app_hostname, topic); // myDebug_P(PSTR("[MQTT] Sending pubish to %s with payload %s"), s, payload); mqttClient.publish(s, MQTT_QOS, false, payload); diff --git a/lib/myESP/MyESP.h b/lib/myESP/MyESP.h index 1935b4993..dfb7657e2 100644 --- a/lib/myESP/MyESP.h +++ b/lib/myESP/MyESP.h @@ -42,6 +42,7 @@ #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most +#define MQTT_MAX_SIZE 600 // max length of MQTT message // Internal MQTT events #define MQTT_CONNECT_EVENT 0 #define MQTT_DISCONNECT_EVENT 1 diff --git a/src/boiler.ino b/src/boiler.ino index 90a00c4ac..1cf88f858 100644 --- a/src/boiler.ino +++ b/src/boiler.ino @@ -100,7 +100,7 @@ command_t PROGMEM project_cmds[] = { {"h", "list supported EMS telegram type IDs"}, {"M", "publish to MQTT"}, {"Q", "print Tx Queue"}, - {"U [n]", "do a deep scan of all thermostat messages types, start at n"}, + {"U [n]", "do a deep scan of all thermostat message types, starting at n"}, {"P", "toggle EMS Poll response on/off"}, {"X", "toggle EMS Tx transmission on/off"}, {"S", "toggle Shower timer on/off"}, @@ -410,12 +410,10 @@ void showInfo() { // a json object is created for the boiler and one for the thermostat // CRC check is done to see if there are changes in the values since the last send to avoid too much wifi traffic void publishValues(bool force) { - char s[20] = {0}; // for formatting strings - - // Boiler values as one JSON object + char s[20] = {0}; // for formatting strings StaticJsonBuffer<512> jsonBuffer; - char data[512]; - JsonObject & rootBoiler = jsonBuffer.createObject(); + char data[MQTT_MAX_SIZE] = {0}; + JsonObject & rootBoiler = jsonBuffer.createObject(); size_t rlen; CRC32 crc; uint32_t fchecksum; @@ -481,6 +479,7 @@ void publishValues(bool force) { rootThermostat[THERMOSTAT_CURRTEMP] = _float_to_char(s, EMS_Thermostat.curr_roomTemp); rootThermostat[THERMOSTAT_SELTEMP] = _float_to_char(s, EMS_Thermostat.setpoint_roomTemp); + // RC20 has different mode settings if (ems_getThermostatModel() == EMS_MODEL_RC20) { if (EMS_Thermostat.mode == 0) { rootThermostat[THERMOSTAT_MODE] = "low"; @@ -499,7 +498,8 @@ void publishValues(bool force) { } } - rlen = rootThermostat.measureLength(); + data[0] = '\0'; // reset data for next package + rlen = rootThermostat.measureLength(); rootThermostat.printTo(data, rlen + 1); // form the json string // calculate new CRC @@ -619,7 +619,7 @@ void myDebugCallback() { systemCheckTimer.detach(); regularUpdatesTimer.detach(); scanThermostat_count = (uint8_t)strtol(&cmd[2], 0, 16); - myDebug("Doing a deep scan on all message types to the thermometer start at 0x%02. Reboot ESP when finished.", scanThermostat_count); + myDebug("Starting a deep message scan on thermometer"); scanThermostat.attach(SCANTHERMOSTAT_TIME, do_scanThermostat); break; default: diff --git a/src/ems.cpp b/src/ems.cpp index 7f0550a6d..de1550a47 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -993,9 +993,7 @@ void _process_RC30StatusMessage(uint8_t * data, uint8_t length) { */ void _process_RC35StatusMessage(uint8_t * data, uint8_t length) { EMS_Thermostat.setpoint_roomTemp = ((float)data[EMS_TYPE_RC35StatusMessage_setpoint]) / (float)2; - - // There is no current room temperature sensor in this telegram - EMS_Thermostat.curr_roomTemp = EMS_VALUE_FLOAT_NOTSET; + EMS_Thermostat.curr_roomTemp = _toFloat(EMS_TYPE_RC35StatusMessage_curr, data); EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back to Home Assistant via MQTT } @@ -1097,7 +1095,6 @@ void _process_Version(uint8_t * data, uint8_t length) { // if we don't have a thermostat set, use this one if (!ems_getThermostatEnabled()) { - myDebug("Setting the Thermostat to this one."); // set its capabilities EMS_Thermostat.model_id = Model_Types[i].model_id; EMS_Thermostat.type_id = Model_Types[i].type_id; @@ -1118,7 +1115,6 @@ void _process_Version(uint8_t * data, uint8_t length) { } if (!ems_getBoilerEnabled()) { - myDebug("Setting the Boiler to this one."); EMS_Boiler.type_id = Model_Types[i].type_id; EMS_Boiler.model_id = Model_Types[i].model_id; strlcpy(EMS_Boiler.version, version, sizeof(EMS_Boiler.version)); diff --git a/src/ems.h b/src/ems.h index 6d18f2374..7a6fe9b2c 100644 --- a/src/ems.h +++ b/src/ems.h @@ -76,6 +76,7 @@ // RC35 specific #define EMS_TYPE_RC35StatusMessage 0x3E // is an automatic thermostat broadcast giving us temps #define EMS_TYPE_RC35StatusMessage_setpoint 2 // desired temp +#define EMS_TYPE_RC35StatusMessage_curr 3 // current temp #define EMS_TYPE_RC35Set 0x3D // for setting values like temp and mode (Working mode HC1) #define EMS_OFFSET_RC35Set_mode 7 // position of thermostat mode #define EMS_OFFSET_RC35Set_temp_day 2 // position of thermostat setpoint temperature for day time diff --git a/src/version.h b/src/version.h index 7330b1583..843c93862 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,5 @@ #pragma once #define APP_NAME "EMS-ESP-Boiler" -#define APP_VERSION "1.2.3" +#define APP_VERSION "1.2.4" #define APP_HOSTNAME "boiler"