Merge pull request #583 from proddy/dev

minor changes when testing coldshot
This commit is contained in:
Proddy
2022-07-23 13:04:46 +02:00
committed by GitHub
9 changed files with 26 additions and 81 deletions

View File

@@ -282,51 +282,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Added ## Added
- power settings, disabling BLE and turning off Wifi sleep
- Rx and Tx counts to Heartbeat MQTT payload
- ethernet support
- id to info command to show only a heatingcircuit
- add sending devices that are not listed to 0x07
- extra MQTT boolean option for "ON" and "OFF"
- support for chunked MQTT payloads to allow large data sets > 2kb
- external Button support (#708) for resetting to factory defaults and other actions
- new console set command in `system`, `set board_profile <profile>` for quickly enabling cabled ethernet connections without using the captive wifi portal
- added in MQTT nested mode, for thermostat and mixer, like we had back in v2
- cascade MC400 (product-id 210) (3.0.0b6), power values for heating sources (3.0.1b1)
- values for wwMaxPower, wwFlowtempOffset
- RC300 `thermostat temp -1` to clear temporary setpoint in auto mode
- syslog port selectable (#744)
- individual mqtt commands (#31) - individual mqtt commands (#31)
- board Profiles (#11) - board Profiles (#11)
## Fixed ## Fixed
- telegrams matched to masterthermostat 0x18
- multiple roomcontrollers
- readback after write with delay (give ems-devices time to set the value)
- thermostat ES72/RC20 device 66 to command-set RC20_2
- MQTT payloads not adding to queue when MQTT is re-connecting (fixes #369)
- fix for HA topics with invalid command formats (#728)
- wrong position of values #723, #732
- OTA Upload via Web on OSX
- Rx and Tx quality % would sometimes show > 100 - Rx and Tx quality % would sometimes show > 100
## Changed ## Changed
- changed how telegram parameters are rendered for mqtt, console and web (#632)
- split `show values` in smaller packages (edited)
- extended length of IP/hostname from 32 to 48 chars (#676)
- check flowsensor for `tap_water_active`
- mqtt prefixed with `Base`
- count Dallas sensor fails
- switch from SPIFFS to LITTLEFS
- added ID to MQTT payloads which is the Device's product ID and used in HA to identify a unique HA device
- increased MQTT buffer and reduced wait time between publishes
- updated to the latest ArduinoJson library
- some names of mqtt-tags like in v2.2.1
- new ESP32 partition side to allow for smoother OTA and fallback
- network Gateway IP is optional (#682)emsesp/EMS-ESP
- moved to a new GitHub repo https://github.com/emsesp/EMS-ESP32
- invert LED changed to Hide LED. Default is off. - invert LED changed to Hide LED. Default is off.
- renamed Scan Network to Scan WiFi Network - renamed Scan Network to Scan WiFi Network
- added version to cmd=settings - added version to cmd=settings

View File

@@ -28,8 +28,10 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri
std::string extension = fname.substr(position + 1); std::string extension = fname.substr(position + 1);
size_t fsize = request->contentLength(); size_t fsize = request->contentLength();
#if defined(EMSESP_USE_SERIAL)
Serial.printf("Received filename: %s, len: %d, index: %d, ext: %s, fsize: %d", filename.c_str(), len, index, extension.c_str(), fsize); Serial.printf("Received filename: %s, len: %d, index: %d, ext: %s, fsize: %d", filename.c_str(), len, index, extension.c_str(), fsize);
Serial.println(); Serial.println();
#endif
if ((extension == "bin") && (fsize > 1500000)) { if ((extension == "bin") && (fsize > 1500000)) {
is_firmware = true; is_firmware = true;

View File

@@ -1,40 +1,5 @@
(<https://github.com/emsesp/EMS-ESP32/issues/41>) (Based on <https://github.com/emsesp/EMS-ESP32/issues/41>)
When developing and testing the web interface, it's handy not to bother with re-flashing an ESP32 each time. The idea is to mimic the ESP using a mock/stub server that responds to the REST (HTTP POST & GET) and WebSocket calls. When developing and testing the web interface, it's handy not to bother with re-flashing an ESP32 each time. The idea is to mimic the ESP using a mock/stub server that responds to the REST (HTTP POST & GET) and WebSocket calls.
To set it up it do To set it up it do run `npm install` in the `mock-api` folder, then from the `interface` folder run `npm run standalone`. This will start the mock API server on port 3080 using data from `mock-api/server.js` and the web server runs on port 3000.
```sh
% cd mock-api
% npm install
% cd interface
% npm install
```
and to run it
```sh
% cd interface
% npm run standalone
```
## Notes
- new file `interface/src/setupProxy.js`
- new files `mock-api/server.js` with the hardcoded data. Requires its own npm packages for express
## Testing
```bash
% curl -i http://localhost:3080/rest/emsespSettings
```
or from a browser use port 3000 since `setupProxy.js` is redirecting, like http://172.22.227.82:3000/rest/emsespSettings
http://172.22.227.82:3090/es/log?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWUsInZlcnNpb24iOiIzLjAuMmIwIn0.MsHSgoJKI1lyYz77EiT5ZN3ECMrb4mPv9FNy3udq0TU
Testing the EventSource/SSE use http://172.22.227.82:3090/es/log
## To Do
- add filter rule to prevent from exposing yourself to malicious attacks when running the dev server(<https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a>)

View File

@@ -1132,7 +1132,7 @@ rest_server.post(EMSESP_BOARDPROFILE_ENDPOINT, (req, res) => {
// EMS-ESP API specific // EMS-ESP API specific
const emsesp_info = { const emsesp_info = {
System: { System: {
version: '3.x.x', version: '3.4.2',
uptime: '001+06:40:34.018', uptime: '001+06:40:34.018',
'uptime (seconds)': 110434, 'uptime (seconds)': 110434,
freemem: 131, freemem: 131,
@@ -1224,7 +1224,6 @@ rest_server.get(GET_CUSTOMIZATIONS_ENDPOINT, (req, res) => {
// start server // start server
const expressServer = rest_server.listen(port, () => const expressServer = rest_server.listen(port, () =>
console.log(`Mock server for EMS-ESP is up and running at http://localhost:${port}`),
) )
console.log(`EMS-ESP Rest API listening to http://localhost:${port}/api`) console.log(`EMS-ESP Rest API listening to http://localhost:${port}/api`)

View File

@@ -29,3 +29,15 @@ Authorization: Bearer {{token}}
"entity" : "seltemp", "entity" : "seltemp",
"value" : 21.0 "value" : 21.0
} }
###
POST http://10.10.10.134/api
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.2bHpWya2C7Q12WjNUBD6_7N3RCD7CMl-EGhyQVzFdDg
{
"device" : "boiler",
"entity" : "wwtapactivated",
"value" : "on"
}

View File

@@ -398,7 +398,7 @@ void EMSESPShell::add_console_commands() {
shell.print(F("Available commands are: ")); shell.print(F("Available commands are: "));
Command::show(shell, device_type, false); // non-verbose mode Command::show(shell, device_type, false); // non-verbose mode
} else if (return_code != CommandRet::OK) { } else if (return_code != CommandRet::OK) {
shell.println(F("Bad syntax")); shell.printfln(F("Bad syntax (error code %d)"), return_code);
} }
}, },
[&](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) -> std::vector<std::string> { [&](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) -> std::vector<std::string> {

View File

@@ -1590,9 +1590,10 @@ bool Boiler::set_ww_activated(const char * value, const int8_t id) {
// Activate / De-activate the Warm Tap Water // Activate / De-activate the Warm Tap Water
// Note: Using the type 0x1D to put the boiler into Test mode. This may be shown on the boiler with a flashing 'T' // Note: Using the type 0x1D to put the boiler into Test mode. This may be shown on the boiler with a flashing 'T'
bool Boiler::set_tapwarmwater_activated(const char * value, const int8_t id) { bool Boiler::set_tapwarmwater_activated(const char * value, const int8_t id) {
if (!Helpers::hasValue(wwTapActivated_, EMS_VALUE_BOOL)) { // as it's a command it may not initially exist
return false; // if (!Helpers::hasValue(wwTapActivated_, EMS_VALUE_BOOL)) {
} // return false;
// }
bool v = false; bool v = false;
if (!Helpers::value2bool(value, v)) { if (!Helpers::value2bool(value, v)) {

View File

@@ -692,6 +692,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
EMSESP::mqtt_.incoming("ems-esp/boiler/wwseltemp", "59"); EMSESP::mqtt_.incoming("ems-esp/boiler/wwseltemp", "59");
} }
#if defined(EMSESP_STANDALONE)
// https://github.com/emsesp/EMS-ESP32/issues/541 // https://github.com/emsesp/EMS-ESP32/issues/541
if (command == "api_wwmode") { if (command == "api_wwmode") {
shell.printfln(F("Testing API wwmode")); shell.printfln(F("Testing API wwmode"));
@@ -710,6 +711,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
request.url("/api/thermostat/wwmode"); request.url("/api/thermostat/wwmode");
EMSESP::webAPIService.webAPIService_post(&request, json); EMSESP::webAPIService.webAPIService_post(&request, json);
} }
#endif
if (command == "api") { if (command == "api") {
shell.printfln(F("Testing API with MQTT and REST, standalone")); shell.printfln(F("Testing API with MQTT and REST, standalone"));

View File

@@ -32,7 +32,7 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "web" // #define EMSESP_DEBUG_DEFAULT "web"
// #define EMSESP_DEBUG_DEFAULT "mqtt" // #define EMSESP_DEBUG_DEFAULT "mqtt"
// #define EMSESP_DEBUG_DEFAULT "general" // #define EMSESP_DEBUG_DEFAULT "general"
// #define EMSESP_DEBUG_DEFAULT "boiler" #define EMSESP_DEBUG_DEFAULT "boiler"
// #define EMSESP_DEBUG_DEFAULT "mqtt2" // #define EMSESP_DEBUG_DEFAULT "mqtt2"
// #define EMSESP_DEBUG_DEFAULT "mqtt_nested" // #define EMSESP_DEBUG_DEFAULT "mqtt_nested"
// #define EMSESP_DEBUG_DEFAULT "ha" // #define EMSESP_DEBUG_DEFAULT "ha"
@@ -50,7 +50,7 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "analog" // #define EMSESP_DEBUG_DEFAULT "analog"
// #define EMSESP_DEBUG_DEFAULT "api_values" // #define EMSESP_DEBUG_DEFAULT "api_values"
// #define EMSESP_DEBUG_DEFAULT "mqtt_post" // #define EMSESP_DEBUG_DEFAULT "mqtt_post"
#define EMSESP_DEBUG_DEFAULT "api_wwmode" // #define EMSESP_DEBUG_DEFAULT "api_wwmode"
class Test { class Test {
public: public: