diff --git a/CHANGELOG.md b/CHANGELOG.md index e2c8260d3..5e5994490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -282,51 +282,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 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 ` 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) - board Profiles (#11) ## 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 ## 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. - renamed Scan Network to Scan WiFi Network - added version to cmd=settings diff --git a/lib/framework/UploadFileService.cpp b/lib/framework/UploadFileService.cpp index 5edcc5dd8..ea12e92a4 100644 --- a/lib/framework/UploadFileService.cpp +++ b/lib/framework/UploadFileService.cpp @@ -28,8 +28,10 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri std::string extension = fname.substr(position + 1); 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.println(); +#endif if ((extension == "bin") && (fsize > 1500000)) { is_firmware = true; diff --git a/mock-api/README.md b/mock-api/README.md index efc5dcd92..9da932ffd 100644 --- a/mock-api/README.md +++ b/mock-api/README.md @@ -1,40 +1,5 @@ -() +(Based on ) 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 - -```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() +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. diff --git a/mock-api/server.js b/mock-api/server.js index d6b5686af..96fdb18a3 100644 --- a/mock-api/server.js +++ b/mock-api/server.js @@ -1132,7 +1132,7 @@ rest_server.post(EMSESP_BOARDPROFILE_ENDPOINT, (req, res) => { // EMS-ESP API specific const emsesp_info = { System: { - version: '3.x.x', + version: '3.4.2', uptime: '001+06:40:34.018', 'uptime (seconds)': 110434, freemem: 131, @@ -1224,7 +1224,6 @@ rest_server.get(GET_CUSTOMIZATIONS_ENDPOINT, (req, res) => { // start server 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`) diff --git a/scripts/api_test.http b/scripts/api_test.http index de5d162c7..1ced2e06f 100644 --- a/scripts/api_test.http +++ b/scripts/api_test.http @@ -29,3 +29,15 @@ Authorization: Bearer {{token}} "entity" : "seltemp", "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" +} \ No newline at end of file diff --git a/src/console.cpp b/src/console.cpp index 34ec3fbc8..3ebbc8ab0 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -398,7 +398,7 @@ void EMSESPShell::add_console_commands() { shell.print(F("Available commands are: ")); Command::show(shell, device_type, false); // non-verbose mode } 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 & arguments) -> std::vector { diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 6a5ca5ccc..d99bcf933 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -1590,9 +1590,10 @@ bool Boiler::set_ww_activated(const char * value, const int8_t id) { // 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' bool Boiler::set_tapwarmwater_activated(const char * value, const int8_t id) { - if (!Helpers::hasValue(wwTapActivated_, EMS_VALUE_BOOL)) { - return false; - } + // as it's a command it may not initially exist + // if (!Helpers::hasValue(wwTapActivated_, EMS_VALUE_BOOL)) { + // return false; + // } bool v = false; if (!Helpers::value2bool(value, v)) { diff --git a/src/test/test.cpp b/src/test/test.cpp index 7410cd07f..c69b437d9 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -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"); } +#if defined(EMSESP_STANDALONE) // https://github.com/emsesp/EMS-ESP32/issues/541 if (command == "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"); EMSESP::webAPIService.webAPIService_post(&request, json); } +#endif if (command == "api") { shell.printfln(F("Testing API with MQTT and REST, standalone")); diff --git a/src/test/test.h b/src/test/test.h index 30bc6f307..21c2e0918 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -32,7 +32,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "web" // #define EMSESP_DEBUG_DEFAULT "mqtt" // #define EMSESP_DEBUG_DEFAULT "general" -// #define EMSESP_DEBUG_DEFAULT "boiler" +#define EMSESP_DEBUG_DEFAULT "boiler" // #define EMSESP_DEBUG_DEFAULT "mqtt2" // #define EMSESP_DEBUG_DEFAULT "mqtt_nested" // #define EMSESP_DEBUG_DEFAULT "ha" @@ -50,7 +50,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "analog" // #define EMSESP_DEBUG_DEFAULT "api_values" // #define EMSESP_DEBUG_DEFAULT "mqtt_post" -#define EMSESP_DEBUG_DEFAULT "api_wwmode" +// #define EMSESP_DEBUG_DEFAULT "api_wwmode" class Test { public: