This commit is contained in:
MichaelDvP
2020-01-20 15:16:53 +01:00
8 changed files with 53 additions and 46 deletions

View File

@@ -15,7 +15,7 @@ EMS-ESP is a open-source system built for the Espressif ESP8266 microcontroller
## Features ## Features
* Supporting more than [50 EMS devices](https://proddy.github.io/EMS-ESP/#/Supported-EMS-Devices) (EMS 1.0, 2.0 and Heatronics). * Supporting more than [50 EMS devices](https://emsesp.github.io/docs/#/Supported-EMS-Devices) (EMS 1, EMS 2.0/Plus and Heatronics 3).
* A web interface for easy configuration and real-time monitoring of the EMS bus. * A web interface for easy configuration and real-time monitoring of the EMS bus.
* Telnet for advanced configuration and verbose traffic logging. * Telnet for advanced configuration and verbose traffic logging.
* Configurable MQTT, with templates for Home Assistant and Domoticz. * Configurable MQTT, with templates for Home Assistant and Domoticz.

View File

@@ -725,8 +725,8 @@ void MyESP::_consoleShowHelp() {
myDebug_P(PSTR("*")); myDebug_P(PSTR("*"));
myDebug_P(PSTR("* Commands:")); myDebug_P(PSTR("* Commands:"));
myDebug_P(PSTR("* ?/help=show commands, CTRL-D/quit=close telnet session")); myDebug_P(PSTR("* ?/help=show commands, CTRL-D/quit=end telnet session"));
myDebug_P(PSTR("* set, system, restart, mqttlog, kick, save")); myDebug_P(PSTR("* set, system, restart, mqttlog [all], kick, save"));
#ifdef CRASH #ifdef CRASH
myDebug_P(PSTR("* crash <dump | clear | test [n]>")); myDebug_P(PSTR("* crash <dump | clear | test [n]>"));
@@ -1052,12 +1052,12 @@ void MyESP::_telnetCommand(char * commandLine) {
} }
// print mqtt log command // print mqtt log command
if ((strcmp(ptrToCommandName, "mqttlog") == 0) && (wc == 1)) { if (strcmp(ptrToCommandName, "mqttlog") == 0) {
_printMQTTLog(); _printMQTTLog(wc != 1);
return; return;
} }
// show system stats // show system status
if ((strcmp(ptrToCommandName, "system") == 0) && (wc == 1)) { if ((strcmp(ptrToCommandName, "system") == 0) && (wc == 1)) {
showSystemStats(); showSystemStats();
return; return;
@@ -1070,7 +1070,7 @@ void MyESP::_telnetCommand(char * commandLine) {
return; return;
} }
// show system stats // quit
if ((strcmp(ptrToCommandName, "quit") == 0) && (wc == 1)) { if ((strcmp(ptrToCommandName, "quit") == 0) && (wc == 1)) {
myDebug_P(PSTR("[TELNET] exiting telnet session")); myDebug_P(PSTR("[TELNET] exiting telnet session"));
SerialAndTelnet.disconnectClient(); SerialAndTelnet.disconnectClient();
@@ -1333,13 +1333,13 @@ void MyESP::_systemCheckLoop() {
} }
} }
// print out ESP system stats // print out ESP system status
// for battery power is ESP.getVcc() // for battery power is ESP.getVcc()
void MyESP::showSystemStats() { void MyESP::showSystemStats() {
#if defined(ESP8266) #if defined(ESP8266)
myDebug_P(PSTR("%sESP8266 System stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sESP8266 System status:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
#else #else
myDebug_P(PSTR("ESP32 System stats:")); myDebug_P(PSTR("ESP32 System status:"));
#endif #endif
myDebug_P(PSTR("")); myDebug_P(PSTR(""));
@@ -2688,13 +2688,13 @@ void MyESP::_printHeap(const char * prefix) {
} }
// print MQTT log - everything that was published last per topic // print MQTT log - everything that was published last per topic
void MyESP::_printMQTTLog() { void MyESP::_printMQTTLog(bool show_sub = false) {
myDebug_P(PSTR("MQTT publish log:")); myDebug_P(PSTR("MQTT publish log:"));
uint8_t i; uint8_t i;
for (i = 0; i < MYESP_MQTTLOG_MAX; i++) { for (i = 0; i < MYESP_MQTTLOG_MAX; i++) {
if ((MQTT_log[i].topic != nullptr) && (MQTT_log[i].type == MYESP_MQTTLOGTYPE_PUBLISH)) { if ((MQTT_log[i].topic != nullptr) && (MQTT_log[i].type == MYESP_MQTTLOGTYPE_PUBLISH)) {
myDebug_P(PSTR(" Timestamp:%02d:%02d:%02d Topic:%s Payload:%s"), myDebug_P(PSTR(" (%02d:%02d:%02d) Topic:%s Payload:%s"),
to_hour(MQTT_log[i].timestamp), to_hour(MQTT_log[i].timestamp),
to_minute(MQTT_log[i].timestamp), to_minute(MQTT_log[i].timestamp),
to_second(MQTT_log[i].timestamp), to_second(MQTT_log[i].timestamp),
@@ -2703,6 +2703,8 @@ void MyESP::_printMQTTLog() {
} }
} }
// show subscriptions
if (show_sub) {
myDebug_P(PSTR("")); // newline myDebug_P(PSTR("")); // newline
myDebug_P(PSTR("MQTT subscriptions:")); myDebug_P(PSTR("MQTT subscriptions:"));
@@ -2711,6 +2713,7 @@ void MyESP::_printMQTTLog() {
myDebug_P(PSTR(" Topic:%s"), MQTT_log[i].topic); myDebug_P(PSTR(" Topic:%s"), MQTT_log[i].topic);
} }
} }
}
myDebug_P(PSTR("")); // newline myDebug_P(PSTR("")); // newline
} }

View File

@@ -9,7 +9,7 @@
#ifndef MyESP_h #ifndef MyESP_h
#define MyESP_h #define MyESP_h
#define MYESP_VERSION "1.2.24" #define MYESP_VERSION "1.2.25"
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
@@ -345,7 +345,7 @@ class MyESP {
// mqtt log // mqtt log
_MQTT_Log_t MQTT_log[MYESP_MQTTLOG_MAX]; // log for publish and subscribe messages _MQTT_Log_t MQTT_log[MYESP_MQTTLOG_MAX]; // log for publish and subscribe messages
void _printMQTTLog(); void _printMQTTLog(bool show_sub);
void _addMQTTLog(const char * topic, const char * payload, const MYESP_MQTTLOGTYPE_t type); void _addMQTTLog(const char * topic, const char * payload, const MYESP_MQTTLOGTYPE_t type);
AsyncMqttClient mqttClient; // the MQTT class AsyncMqttClient mqttClient; // the MQTT class

View File

@@ -213,13 +213,11 @@ _EMS_THERMOSTAT_MODE _getThermostatDayMode(uint8_t hc_num) {
return thermoMode; return thermoMode;
} }
// Info - display stats on an 'info' command // Info - display status and data on an 'info' command
void showInfo() { void showInfo() {
// General stats from EMS bus
static char buffer_type[128] = {0}; static char buffer_type[128] = {0};
myDebug_P(PSTR("%sEMS-ESP system stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sEMS-ESP system status:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
_EMS_SYS_LOGGING sysLog = ems_getLogging(); _EMS_SYS_LOGGING sysLog = ems_getLogging();
if (sysLog == EMS_SYS_LOGGING_BASIC) { if (sysLog == EMS_SYS_LOGGING_BASIC) {
myDebug_P(PSTR(" System logging set to Basic")); myDebug_P(PSTR(" System logging set to Basic"));
@@ -254,7 +252,7 @@ void showInfo() {
((EMSESP_Settings.shower_timer) ? "enabled" : "disabled"), ((EMSESP_Settings.shower_timer) ? "enabled" : "disabled"),
((EMSESP_Settings.shower_alert) ? "enabled" : "disabled")); ((EMSESP_Settings.shower_alert) ? "enabled" : "disabled"));
myDebug_P(PSTR("\n%sEMS Bus stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("\n%sEMS Bus status:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
if (ems_getBusConnected()) { if (ems_getBusConnected()) {
myDebug_P(PSTR(" Bus is connected, protocol: %s"), (ems_isHT3() ? "HT3" : "Buderus")); myDebug_P(PSTR(" Bus is connected, protocol: %s"), (ems_isHT3() ? "HT3" : "Buderus"));
@@ -274,14 +272,13 @@ void showInfo() {
myDebug_P(PSTR("")); myDebug_P(PSTR(""));
// show boiler stats if connected // show boiler data if connected
if (ems_getBoilerEnabled()) { if (ems_getBoilerEnabled()) {
myDebug_P(PSTR("%sBoiler stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sBoiler data:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
// version details // version details
myDebug_P(PSTR(" Boiler: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_BOILER, buffer_type)); myDebug_P(PSTR(" Boiler: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_BOILER, buffer_type));
// active stats
if (ems_getBusConnected()) { if (ems_getBusConnected()) {
if (EMS_Boiler.tapwaterActive != EMS_VALUE_INT_NOTSET) { if (EMS_Boiler.tapwaterActive != EMS_VALUE_INT_NOTSET) {
myDebug_P(PSTR(" Hot tap water: %s"), EMS_Boiler.tapwaterActive ? "running" : "off"); myDebug_P(PSTR(" Hot tap water: %s"), EMS_Boiler.tapwaterActive ? "running" : "off");
@@ -374,7 +371,7 @@ void showInfo() {
// For SM10/SM100/SM200 Solar Module // For SM10/SM100/SM200 Solar Module
if (ems_getSolarModuleEnabled()) { if (ems_getSolarModuleEnabled()) {
myDebug_P(PSTR("")); // newline myDebug_P(PSTR("")); // newline
myDebug_P(PSTR("%sSolar Module stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sSolar Module data:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
myDebug_P(PSTR(" Solar module: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_SOLAR, buffer_type)); myDebug_P(PSTR(" Solar module: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_SOLAR, buffer_type));
_renderShortValue("Collector temperature", "C", EMS_SolarModule.collectorTemp); _renderShortValue("Collector temperature", "C", EMS_SolarModule.collectorTemp);
_renderShortValue("Bottom temperature", "C", EMS_SolarModule.bottomTemp); _renderShortValue("Bottom temperature", "C", EMS_SolarModule.bottomTemp);
@@ -394,16 +391,16 @@ void showInfo() {
// For HeatPumps // For HeatPumps
if (ems_getHeatPumpEnabled()) { if (ems_getHeatPumpEnabled()) {
myDebug_P(PSTR("")); // newline myDebug_P(PSTR("")); // newline
myDebug_P(PSTR("%sHeat Pump stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sHeat Pump data:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
myDebug_P(PSTR(" Heat Pump module: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_HEATPUMP, buffer_type)); myDebug_P(PSTR(" Heat Pump module: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_HEATPUMP, buffer_type));
_renderIntValue("Pump modulation", "%", EMS_HeatPump.HPModulation); _renderIntValue("Pump modulation", "%", EMS_HeatPump.HPModulation);
_renderIntValue("Pump speed", "%", EMS_HeatPump.HPSpeed); _renderIntValue("Pump speed", "%", EMS_HeatPump.HPSpeed);
} }
// Thermostat stats // Thermostat data
if (ems_getThermostatEnabled()) { if (ems_getThermostatEnabled()) {
myDebug_P(PSTR("")); // newline myDebug_P(PSTR("")); // newline
myDebug_P(PSTR("%sThermostat stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sThermostat data:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
myDebug_P(PSTR(" Thermostat: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_THERMOSTAT, buffer_type, false)); myDebug_P(PSTR(" Thermostat: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_THERMOSTAT, buffer_type, false));
// Render Thermostat Date & Time // Render Thermostat Date & Time
@@ -481,7 +478,7 @@ void showInfo() {
// Mixing modules sensors // Mixing modules sensors
if (ems_getMixingDeviceEnabled()) { if (ems_getMixingDeviceEnabled()) {
myDebug_P(PSTR("")); // newline myDebug_P(PSTR("")); // newline
myDebug_P(PSTR("%sMixing module stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR("%sMixing module data:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
myDebug_P(PSTR(" Mixing: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_MIXING, buffer_type,false)); myDebug_P(PSTR(" Mixing: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_MIXING, buffer_type,false));
if (EMS_Boiler.switchTemp < EMS_VALUE_USHORT_NOTSET) if (EMS_Boiler.switchTemp < EMS_VALUE_USHORT_NOTSET)
_renderUShortValue("Switch temperature", "C", EMS_Boiler.switchTemp); _renderUShortValue("Switch temperature", "C", EMS_Boiler.switchTemp);
@@ -1001,6 +998,11 @@ bool LoadSaveCallback(MYESP_FSACTION_t action, JsonObject settings) {
EMSESP_Settings.shower_alert = settings["shower_alert"]; EMSESP_Settings.shower_alert = settings["shower_alert"];
EMSESP_Settings.publish_time = settings["publish_time"] | DEFAULT_PUBLISHTIME; EMSESP_Settings.publish_time = settings["publish_time"] | DEFAULT_PUBLISHTIME;
// can't be 0 which could be the case coming from earlier builds < 1.9.5b12
if (EMSESP_Settings.publish_time == 0) {
EMSESP_Settings.publish_time = DEFAULT_PUBLISHTIME;
}
EMSESP_Settings.listen_mode = settings["listen_mode"]; EMSESP_Settings.listen_mode = settings["listen_mode"];
ems_setTxDisabled(EMSESP_Settings.listen_mode); ems_setTxDisabled(EMSESP_Settings.listen_mode);
@@ -2041,7 +2043,7 @@ void setup() {
void loop() { void loop() {
myESP.loop(); // handle telnet, mqtt, wifi etc myESP.loop(); // handle telnet, mqtt, wifi etc
// check Dallas sensors, using same schedule as publish_time (default 2 mins in DS18_READ_INTERVAL) // Dallas sensors which are polled every 2 seconds (see DS18_READ_INTERVAL)
if (EMSESP_Settings.dallas_sensors) { if (EMSESP_Settings.dallas_sensors) {
ds18.loop(); ds18.loop();
} }

View File

@@ -76,7 +76,7 @@ bool ems_isHT3() {
return (EMS_Sys_Status.emsIDMask == 0x80); return (EMS_Sys_Status.emsIDMask == 0x80);
} }
// init stats and counters and buffers // init EMS device values, counters and buffers
void ems_init() { void ems_init() {
ems_clearDeviceList(); // init the device map ems_clearDeviceList(); // init the device map
@@ -751,12 +751,14 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
* It may happen that we were interrupted (for instance by WIFI activity) and the * It may happen that we were interrupted (for instance by WIFI activity) and the
* buffer isn't valid anymore, so we must not answer at all... * buffer isn't valid anymore, so we must not answer at all...
*/ */
/*
if (EMS_Sys_Status.emsRxStatus != EMS_RX_STATUS_IDLE) { if (EMS_Sys_Status.emsRxStatus != EMS_RX_STATUS_IDLE) {
if (EMS_Sys_Status.emsLogging > EMS_SYS_LOGGING_NONE) { if (EMS_Sys_Status.emsLogging > EMS_SYS_LOGGING_NONE) {
myDebug_P(PSTR("** Warning, we missed the bus - Rx non-idle!")); myDebug_P(PSTR("** Warning, we missed the bus - Rx non-idle!"));
} }
return; return;
} }
*/
/* /*
* check if we just received one byte * check if we just received one byte
@@ -1989,8 +1991,8 @@ void ems_getThermostatValues() {
* Generic function to return various settings from the thermostat * Generic function to return various settings from the thermostat
*/ */
void ems_getBoilerValues() { void ems_getBoilerValues() {
ems_doReadCommand(EMS_TYPE_UBAMonitorFast, EMS_Boiler.device_id); // get boiler stats, instead of waiting 10secs for the broadcast ems_doReadCommand(EMS_TYPE_UBAMonitorFast, EMS_Boiler.device_id); // get boiler data, instead of waiting 10secs for the broadcast
ems_doReadCommand(EMS_TYPE_UBAMonitorSlow, EMS_Boiler.device_id); // get more boiler stats, instead of waiting 60secs for the broadcast ems_doReadCommand(EMS_TYPE_UBAMonitorSlow, EMS_Boiler.device_id); // get more boiler data, instead of waiting 60secs for the broadcast
ems_doReadCommand(EMS_TYPE_UBAParameterWW, EMS_Boiler.device_id); // get Warm Water values ems_doReadCommand(EMS_TYPE_UBAParameterWW, EMS_Boiler.device_id); // get Warm Water values
ems_doReadCommand(EMS_TYPE_UBAParametersMessage, EMS_Boiler.device_id); // get MC10 boiler values ems_doReadCommand(EMS_TYPE_UBAParametersMessage, EMS_Boiler.device_id); // get MC10 boiler values
ems_doReadCommand(EMS_TYPE_UBATotalUptimeMessage, EMS_Boiler.device_id); // get uptime from boiler ems_doReadCommand(EMS_TYPE_UBATotalUptimeMessage, EMS_Boiler.device_id); // get uptime from boiler
@@ -2625,6 +2627,7 @@ void ems_setFlowTemp(uint8_t temperature) {
/** /**
* Set the warm water mode to comfort to Eco/Comfort * Set the warm water mode to comfort to Eco/Comfort
* 1 = Hot, 2 = Eco, 3 = Intelligent * 1 = Hot, 2 = Eco, 3 = Intelligent
* to 0x33
*/ */
void ems_setWarmWaterModeComfort(uint8_t comfort) { void ems_setWarmWaterModeComfort(uint8_t comfort) {
_EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx _EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx

View File

@@ -55,7 +55,7 @@
#define EMS_OFFSET_UBASetPoints_flowtemp 0 // flow temp #define EMS_OFFSET_UBASetPoints_flowtemp 0 // flow temp
// SM and HP Types // SM and HP Types
// Assuming SM100 behaves like SM200 // Assuming here that the SM200 behaves like SM100
#define EMS_TYPE_SM10Monitor 0x97 // SM10Monitor #define EMS_TYPE_SM10Monitor 0x97 // SM10Monitor
#define EMS_TYPE_SM100Monitor 0x0262 // SM100Monitor #define EMS_TYPE_SM100Monitor 0x0262 // SM100Monitor
#define EMS_TYPE_SM100Status 0x0264 // SM100Status #define EMS_TYPE_SM100Status 0x0264 // SM100Status
@@ -113,7 +113,6 @@
#define EMS_OFFSET_RC35StatusMessage_mode 1 // day mode, also summer on RC3's #define EMS_OFFSET_RC35StatusMessage_mode 1 // day mode, also summer on RC3's
#define EMS_OFFSET_RC35StatusMessage_mode1 0 // for holiday mode #define EMS_OFFSET_RC35StatusMessage_mode1 0 // for holiday mode
#define EMS_TYPE_RC35Set_HC1 0x3D // for setting values like temp and mode (Working mode HC1) #define EMS_TYPE_RC35Set_HC1 0x3D // for setting values like temp and mode (Working mode HC1)
#define EMS_TYPE_RC35Set_HC2 0x47 // for setting values like temp and mode (Working mode HC2) #define EMS_TYPE_RC35Set_HC2 0x47 // for setting values like temp and mode (Working mode HC2)
#define EMS_TYPE_RC35Set_HC3 0x51 // for setting values like temp and mode (Working mode HC3) #define EMS_TYPE_RC35Set_HC3 0x51 // for setting values like temp and mode (Working mode HC3)

View File

@@ -1 +1 @@
#define APP_VERSION "1.9.5b17m" #define APP_VERSION "1.9.5b18m"

View File

@@ -253,7 +253,7 @@
<div class="row form-group"> <div class="row form-group">
<label class="col-xs-3">Heartbeat<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" <label class="col-xs-3">Heartbeat<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right"
data-content="Enable or Disable an automatic MQTT topic publish with system stats"></i></label> data-content="Enable or Disable an automatic MQTT topic publish with system status"></i></label>
<div class="col-xs-9"> <div class="col-xs-9">
<form> <form>
<label class="radio-inline"> <label class="radio-inline">