This commit is contained in:
proddy
2019-01-03 19:42:58 +01:00
parent ec3d10cb3d
commit b999dd3395
7 changed files with 20 additions and 15 deletions

View File

@@ -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/), 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). 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 ## [1.2.3] 2019-01-03
### Fixed ### Fixed

View File

@@ -193,7 +193,7 @@ void MyESP::mqttUnsubscribe(const char * topic) {
// MQTT Publish // MQTT Publish
void MyESP::mqttPublish(const char * topic, const char * payload) { 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); 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); // myDebug_P(PSTR("[MQTT] Sending pubish to %s with payload %s"), s, payload);
mqttClient.publish(s, MQTT_QOS, false, payload); mqttClient.publish(s, MQTT_QOS, false, payload);

View File

@@ -42,6 +42,7 @@
#define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection #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_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_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 // Internal MQTT events
#define MQTT_CONNECT_EVENT 0 #define MQTT_CONNECT_EVENT 0
#define MQTT_DISCONNECT_EVENT 1 #define MQTT_DISCONNECT_EVENT 1

View File

@@ -100,7 +100,7 @@ command_t PROGMEM project_cmds[] = {
{"h", "list supported EMS telegram type IDs"}, {"h", "list supported EMS telegram type IDs"},
{"M", "publish to MQTT"}, {"M", "publish to MQTT"},
{"Q", "print Tx Queue"}, {"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"}, {"P", "toggle EMS Poll response on/off"},
{"X", "toggle EMS Tx transmission on/off"}, {"X", "toggle EMS Tx transmission on/off"},
{"S", "toggle Shower timer 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 // 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 // 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) { void publishValues(bool force) {
char s[20] = {0}; // for formatting strings char s[20] = {0}; // for formatting strings
// Boiler values as one JSON object
StaticJsonBuffer<512> jsonBuffer; StaticJsonBuffer<512> jsonBuffer;
char data[512]; char data[MQTT_MAX_SIZE] = {0};
JsonObject & rootBoiler = jsonBuffer.createObject(); JsonObject & rootBoiler = jsonBuffer.createObject();
size_t rlen; size_t rlen;
CRC32 crc; CRC32 crc;
uint32_t fchecksum; uint32_t fchecksum;
@@ -481,6 +479,7 @@ void publishValues(bool force) {
rootThermostat[THERMOSTAT_CURRTEMP] = _float_to_char(s, EMS_Thermostat.curr_roomTemp); rootThermostat[THERMOSTAT_CURRTEMP] = _float_to_char(s, EMS_Thermostat.curr_roomTemp);
rootThermostat[THERMOSTAT_SELTEMP] = _float_to_char(s, EMS_Thermostat.setpoint_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_getThermostatModel() == EMS_MODEL_RC20) {
if (EMS_Thermostat.mode == 0) { if (EMS_Thermostat.mode == 0) {
rootThermostat[THERMOSTAT_MODE] = "low"; 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 rootThermostat.printTo(data, rlen + 1); // form the json string
// calculate new CRC // calculate new CRC
@@ -619,7 +619,7 @@ void myDebugCallback() {
systemCheckTimer.detach(); systemCheckTimer.detach();
regularUpdatesTimer.detach(); regularUpdatesTimer.detach();
scanThermostat_count = (uint8_t)strtol(&cmd[2], 0, 16); 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); scanThermostat.attach(SCANTHERMOSTAT_TIME, do_scanThermostat);
break; break;
default: default:

View File

@@ -993,9 +993,7 @@ void _process_RC30StatusMessage(uint8_t * data, uint8_t length) {
*/ */
void _process_RC35StatusMessage(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; EMS_Thermostat.setpoint_roomTemp = ((float)data[EMS_TYPE_RC35StatusMessage_setpoint]) / (float)2;
EMS_Thermostat.curr_roomTemp = _toFloat(EMS_TYPE_RC35StatusMessage_curr, data);
// There is no current room temperature sensor in this telegram
EMS_Thermostat.curr_roomTemp = EMS_VALUE_FLOAT_NOTSET;
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back to Home Assistant via MQTT 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 we don't have a thermostat set, use this one
if (!ems_getThermostatEnabled()) { if (!ems_getThermostatEnabled()) {
myDebug("Setting the Thermostat to this one.");
// set its capabilities // set its capabilities
EMS_Thermostat.model_id = Model_Types[i].model_id; EMS_Thermostat.model_id = Model_Types[i].model_id;
EMS_Thermostat.type_id = Model_Types[i].type_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()) { if (!ems_getBoilerEnabled()) {
myDebug("Setting the Boiler to this one.");
EMS_Boiler.type_id = Model_Types[i].type_id; EMS_Boiler.type_id = Model_Types[i].type_id;
EMS_Boiler.model_id = Model_Types[i].model_id; EMS_Boiler.model_id = Model_Types[i].model_id;
strlcpy(EMS_Boiler.version, version, sizeof(EMS_Boiler.version)); strlcpy(EMS_Boiler.version, version, sizeof(EMS_Boiler.version));

View File

@@ -76,6 +76,7 @@
// RC35 specific // RC35 specific
#define EMS_TYPE_RC35StatusMessage 0x3E // is an automatic thermostat broadcast giving us temps #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_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_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_mode 7 // position of thermostat mode
#define EMS_OFFSET_RC35Set_temp_day 2 // position of thermostat setpoint temperature for day time #define EMS_OFFSET_RC35Set_temp_day 2 // position of thermostat setpoint temperature for day time

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#define APP_NAME "EMS-ESP-Boiler" #define APP_NAME "EMS-ESP-Boiler"
#define APP_VERSION "1.2.3" #define APP_VERSION "1.2.4"
#define APP_HOSTNAME "boiler" #define APP_HOSTNAME "boiler"