minor updates

This commit is contained in:
Paul
2020-03-23 11:26:09 +01:00
parent 9321b53e40
commit 393f920116
6 changed files with 77 additions and 75 deletions

View File

@@ -36,9 +36,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `status` payload on start-up shows the IP and Version of EMS-ESP - `status` payload on start-up shows the IP and Version of EMS-ESP
- `thermostat mode` takes a string like manual,auto,heat,day,night,eco,comfort,holiday,nofrost - `thermostat mode` takes a string like manual,auto,heat,day,night,eco,comfort,holiday,nofrost
- `thermostat temp` also takes a mode string, e.g. `thermostat temp 20 heat` - `thermostat temp` also takes a mode string, e.g. `thermostat temp 20 heat`
- `queue` renamed to `txqueue`
### Removed ### Removed
- `autodetect scan` - `autodetect scan`. Replaced with `devices scan` and `devices scan+` for deep scanning
- `mqttlog all` and showing MQTT log in the web interface - no point showing history of previous mqtt publishes in ESP's precious memory. For debugging I recommend using MQTT Explorer or another external tool. - `mqttlog all` and showing MQTT log in the web interface - no point showing history of previous mqtt publishes in ESP's precious memory. For debugging I recommend using MQTT Explorer or another external tool.
## [1.9.4] 15-12-2019 ## [1.9.4] 15-12-2019

View File

@@ -4,7 +4,7 @@
[platformio] [platformio]
default_envs = release default_envs = release
;default_envs = debug ; default_envs = debug
[common] [common]
; custom build options are: ; custom build options are:
@@ -14,7 +14,7 @@ default_envs = release
; -DFORCE_SERIAL ; -DFORCE_SERIAL
; -DMYESP_DEBUG ; -DMYESP_DEBUG
; -DSENSOR_MQTT_USEID ; -DSENSOR_MQTT_USEID
;custom_flags = -DFORCE_SERIAL -DMYESP_DEBUG -DEMSESP_SIMULATE ; custom_flags = -DFORCE_SERIAL -DMYESP_DEBUG -DEMSESP_SIMULATE
custom_flags = custom_flags =
# Available lwIP variants (macros): # Available lwIP variants (macros):
@@ -27,7 +27,7 @@ custom_flags =
# -DVTABLES_IN_FLASH # -DVTABLES_IN_FLASH
# -DNO_GLOBAL_EEPROM # -DNO_GLOBAL_EEPROM
# -DBEARSSL_SSL_BASIC # -DBEARSSL_SSL_BASIC
#general_flags = -DNO_GLOBAL_EEPROM -DVTABLES_IN_FLASH -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH # general_flags = -DNO_GLOBAL_EEPROM -DVTABLES_IN_FLASH -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
general_flags = -DNO_GLOBAL_EEPROM general_flags = -DNO_GLOBAL_EEPROM
@@ -40,10 +40,7 @@ build_flags = ${common.general_flags} -std=c++11 -fno-exceptions
[env] [env]
framework = arduino framework = arduino
;platform = espressif8266@2.2.2 ; arduino core 2.5.2
platform = espressif8266 platform = espressif8266
;platform = https://github.com/platformio/platform-espressif8266#develop
;platform = https://github.com/platformio/platform-espressif8266#feature/stage
lib_compat_mode = strict lib_compat_mode = strict
lib_deps = lib_deps =
https://github.com/rlogiacco/CircularBuffer https://github.com/rlogiacco/CircularBuffer
@@ -56,7 +53,7 @@ lib_deps =
JustWifi@2.0.2 ; https://github.com/xoseperez/justwifi JustWifi@2.0.2 ; https://github.com/xoseperez/justwifi
AsyncMqttClient@0.8.2 ; https://github.com/marvinroger/async-mqtt-client AsyncMqttClient@0.8.2 ; https://github.com/marvinroger/async-mqtt-client
EEPROM_Rotate@0.9.2 ; https://github.com/xoseperez/eeprom_rotate EEPROM_Rotate@0.9.2 ; https://github.com/xoseperez/eeprom_rotate
ArduinoJson@6.14.1 ; https://github.com/bblanchon/ArduinoJson https://github.com/bblanchon/ArduinoJson
ESPAsyncTCP@1.2.2 ; https://github.com/me-no-dev/ESPAsyncTCP ESPAsyncTCP@1.2.2 ; https://github.com/me-no-dev/ESPAsyncTCP
upload_speed = 921600 upload_speed = 921600
monitor_speed = 115200 monitor_speed = 115200

View File

@@ -435,7 +435,7 @@ void MyESP::_printMQTTQueue() {
bool MyESP::mqttPublish(const char * topic, const char * payload) { bool MyESP::mqttPublish(const char * topic, const char * payload) {
return (_mqttQueue(topic, payload, _mqtt_retain)); return (_mqttQueue(topic, payload, _mqtt_retain));
} }
bool MyESP::mqttPublish(const char * topic, JsonDocument payload) { bool MyESP::mqttPublish(const char * topic, JsonDocument & payload) {
return (_mqttQueue(topic, payload, _mqtt_retain)); return (_mqttQueue(topic, payload, _mqtt_retain));
} }
@@ -443,7 +443,7 @@ bool MyESP::mqttPublish(const char * topic, JsonDocument payload) {
bool MyESP::mqttPublish(const char * topic, const char * payload, bool retain) { bool MyESP::mqttPublish(const char * topic, const char * payload, bool retain) {
return (_mqttQueue(topic, payload, retain)); return (_mqttQueue(topic, payload, retain));
} }
bool MyESP::mqttPublish(const char * topic, JsonDocument payload, bool retain) { bool MyESP::mqttPublish(const char * topic, JsonDocument & payload, bool retain) {
return (_mqttQueue(topic, payload, retain)); return (_mqttQueue(topic, payload, retain));
} }
@@ -475,7 +475,7 @@ bool MyESP::_mqttQueue(const char * topic, const char * payload, bool retain) {
// convert json doc to a string buffer and place on queue // convert json doc to a string buffer and place on queue
// can't have empty payload or topic // can't have empty payload or topic
// returns false if can't add to queue // returns false if can't add to queue
bool MyESP::_mqttQueue(const char * topic, JsonDocument payload, bool retain) { bool MyESP::_mqttQueue(const char * topic, JsonDocument & payload, bool retain) {
if (!mqttClient.connected() || _mqtt_queue.size() >= MQTT_QUEUE_MAX_SIZE || !_hasValue(topic)) { if (!mqttClient.connected() || _mqtt_queue.size() >= MQTT_QUEUE_MAX_SIZE || !_hasValue(topic)) {
return false; return false;
} }
@@ -2753,7 +2753,8 @@ void MyESP::_webserver_setup() {
request->send(response); request->send(response);
}); });
_webServer->on("/update", _webServer->on(
"/update",
HTTP_POST, HTTP_POST,
[](AsyncWebServerRequest * request) { [](AsyncWebServerRequest * request) {
AsyncWebServerResponse * response = request->beginResponse(200, "text/plain", _shouldRestart ? "OK" : "FAIL"); AsyncWebServerResponse * response = request->beginResponse(200, "text/plain", _shouldRestart ? "OK" : "FAIL");

View File

@@ -9,7 +9,7 @@
#ifndef MyESP_h #ifndef MyESP_h
#define MyESP_h #define MyESP_h
#define MYESP_VERSION "1.2.36" #define MYESP_VERSION "1.2.37"
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
@@ -281,8 +281,8 @@ class MyESP {
void mqttUnsubscribe(const char * topic); void mqttUnsubscribe(const char * topic);
bool mqttPublish(const char * topic, const char * payload); bool mqttPublish(const char * topic, const char * payload);
bool mqttPublish(const char * topic, const char * payload, bool retain); bool mqttPublish(const char * topic, const char * payload, bool retain);
bool mqttPublish(const char * topic, JsonDocument payload); bool mqttPublish(const char * topic, JsonDocument & payload);
bool mqttPublish(const char * topic, JsonDocument payload, bool retain); bool mqttPublish(const char * topic, JsonDocument & payload, bool retain);
void setMQTT(mqtt_callback_f callback); void setMQTT(mqtt_callback_f callback);
bool mqttUseNestedJson(); bool mqttUseNestedJson();
@@ -343,7 +343,7 @@ class MyESP {
void _sendStart(); void _sendStart();
char * _mqttTopic(const char * topic); char * _mqttTopic(const char * topic);
bool _mqttQueue(const char * topic, const char * payload, bool retain); bool _mqttQueue(const char * topic, const char * payload, bool retain);
bool _mqttQueue(const char * topic, JsonDocument payload, bool retain); bool _mqttQueue(const char * topic, JsonDocument & payload, bool retain);
void _printMQTTQueue(); void _printMQTTQueue();
void _mqttPublishQueue(); void _mqttPublishQueue();
void _mqttRemoveLastPublish(); void _mqttRemoveLastPublish();

View File

@@ -109,8 +109,8 @@ static const command_t project_cmds[] PROGMEM = {
{false, "log <n | b | t | s | m | r | j | v | w [ID] | d [ID]>", "logging: none, basic, thermo, solar, mixing, raw, jabber, verbose, watch a type or device"}, {false, "log <n | b | t | s | m | r | j | v | w [ID] | d [ID]>", "logging: none, basic, thermo, solar, mixing, raw, jabber, verbose, watch a type or device"},
{false, "publish", "publish all values to MQTT"}, {false, "publish", "publish all values to MQTT"},
{false, "refresh", "fetch values from the EMS devices"}, {false, "refresh", "fetch values from the EMS devices"},
{false, "devices [scan] | [scan deep] | [save]", "list detected devices, quick scan or deep scan and save as known devices"}, {false, "devices [scan] | [scan+] | [clear] | [save] ", "list detected devices, quick scan, deep scan, clear and and save"},
{false, "queue", "show current Tx queue"}, {false, "txqueue", "show current Tx queue"},
{false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"}, {false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"},
{false, "thermostat read <type ID>", "send read request to the thermostat for heating circuit hc 1-4"}, {false, "thermostat read <type ID>", "send read request to the thermostat for heating circuit hc 1-4"},
{false, "thermostat temp <degrees> [mode] [hc]", "set thermostat temperature. mode is manual,auto,heat,day,night,eco,comfort,holiday,nofrost"}, {false, "thermostat temp <degrees> [mode] [hc]", "set thermostat temperature. mode is manual,auto,heat,day,night,eco,comfort,holiday,nofrost"},
@@ -254,14 +254,17 @@ 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"));
if (strlen(EMSESP_Settings.known_devices) > 0) {
myDebug_P(PSTR(" Saved known device IDs: %s"), EMSESP_Settings.known_devices);
} else {
myDebug_P(PSTR(" Saved known device IDs: none"));
}
myDebug_P(PSTR("\n%sEMS Bus status:%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"));
myDebug_P(PSTR(" Rx: # successful read requests=%d, # CRC errors=%d"), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr); myDebug_P(PSTR(" Rx: # successful read requests=%d, # CRC errors=%d"), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr);
if (strlen(EMSESP_Settings.known_devices) > 0) {
myDebug_P(PSTR(" Saved known device IDs: %s"), EMSESP_Settings.known_devices);
}
if (ems_getTxCapable()) { if (ems_getTxCapable()) {
char valuestr[8] = {0}; // for formatting floats char valuestr[8] = {0}; // for formatting floats
@@ -1487,6 +1490,11 @@ void TelnetCallback(uint8_t event) {
} }
} }
void clearEMSDevices() {
EMSESP_Settings.known_devices = strdup("");
myESP.saveSettings();
}
// get the list of know devices, as a string, and save them to the config file // get the list of know devices, as a string, and save them to the config file
void saveEMSDevices() { void saveEMSDevices() {
if (Devices.empty()) { if (Devices.empty()) {
@@ -1539,33 +1547,28 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) {
// wc = 2 or more. check for "scan" // wc = 2 or more. check for "scan"
char * second_cmd = _readWord(); char * second_cmd = _readWord();
if (strcmp(second_cmd, "scan") == 0) { if (strcmp(second_cmd, "scan") == 0) {
if (wc == 2) {
// just scan use UBA 0x07 telegram // just scan use UBA 0x07 telegram
myDebug_P(PSTR("Requesting EMS bus master for its device list and scanning for external sensors...")); myDebug_P(PSTR("Requesting EMS bus master for its device list and scanning for external sensors..."));
scanDallas(); scanDallas();
Devices.clear(); // init the device map Devices.clear(); // init the device map
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id); ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
return; return;
} } else if (strcmp(second_cmd, "scan+") == 0) {
// wc is 3 or more. check for additional "force" argument
char * third_cmd = _readWord();
if (strcmp(third_cmd, "deep") == 0) {
myDebug_P(PSTR("Started deep scan of EMS bus for our known devices. This can take up to 10 seconds...")); myDebug_P(PSTR("Started deep scan of EMS bus for our known devices. This can take up to 10 seconds..."));
Devices.clear(); // init the device map Devices.clear(); // init the device map
ems_scanDevices(); ems_scanDevices();
return; return;
}
} else if (strcmp(second_cmd, "save") == 0) { } else if (strcmp(second_cmd, "save") == 0) {
saveEMSDevices(); saveEMSDevices();
return; return;
} else if (strcmp(second_cmd, "clear") == 0) {
clearEMSDevices();
return;
} }
ok = false; // unknown command ok = false; // unknown command
} }
if (strcmp(first_cmd, "txqueue") == 0) {
if (strcmp(first_cmd, "queue") == 0) {
ems_printTxQueue(); ems_printTxQueue();
ok = true; ok = true;
} }
@@ -2278,7 +2281,7 @@ void initEMSESP() {
EMSESP_Settings.tx_mode = EMS_TXMODE_DEFAULT; // default tx mode EMSESP_Settings.tx_mode = EMS_TXMODE_DEFAULT; // default tx mode
EMSESP_Settings.bus_id = EMS_BUSID_DEFAULT; // Service Key is default EMSESP_Settings.bus_id = EMS_BUSID_DEFAULT; // Service Key is default
EMSESP_Settings.master_thermostat = 0; EMSESP_Settings.master_thermostat = 0;
EMSESP_Settings.known_devices = nullptr; EMSESP_Settings.known_devices = strdup("");
// shower settings // shower settings
EMSESP_Shower.timerStart = 0; EMSESP_Shower.timerStart = 0;

View File

@@ -1 +1 @@
#define APP_VERSION "1.9.5b55" #define APP_VERSION "1.9.5b57"