From 3900b8fc942403c5f929c9d1d51e3d0c4b3dfa23 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:30:47 +0200 Subject: [PATCH 1/7] log API call --- src/command.cpp | 86 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index ce269c332..2a906fcdb 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -315,58 +315,56 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * } // check if we have a matching command - if (cf) { - // check permissions - if (cf->has_flags(CommandFlag::ADMIN_ONLY) && !is_admin) { - output["message"] = "authentication failed"; - return CommandRet::NOT_ALLOWED; // command not allowed - } - - auto description = Helpers::translated_word(cf->description_); - char info_s[100]; - if (strlen(description)) { - snprintf(info_s, sizeof(info_s), "'%s/%s' (%s)", dname, cmd, description); - } else { - snprintf(info_s, sizeof(info_s), "'%s/%s'", dname, cmd); - } + if (!cf) { + // we didn't find the command, report error + LOG_DEBUG("Command failed: invalid command '%s'", cmd ? cmd : ""); + return message(CommandRet::NOT_FOUND, "invalid command", output); + } - std::string ro = EMSESP::system_.readonly_mode() ? "[readonly] " : ""; + // check permissions and abort if not authorized + if (cf->has_flags(CommandFlag::ADMIN_ONLY) && !is_admin) { + output["message"] = "authentication failed"; + return CommandRet::NOT_ALLOWED; // command not allowed + } - if ((value == nullptr) || (strlen(value) == 0)) { - LOG_DEBUG(("%sCalling command %s"), ro.c_str(), info_s); + // build up the log string for reporting back + // We send the log message as Warning so it appears in the log (debug is only enabled when compiling with DEBUG) + std::string ro = EMSESP::system_.readonly_mode() ? "[readonly] " : ""; + auto description = Helpers::translated_word(cf->description_); + char info_s[100]; + if (strlen(description)) { + snprintf(info_s, sizeof(info_s), "'%s/%s' (%s)", dname, cmd, description); + } else { + snprintf(info_s, sizeof(info_s), "'%s/%s'", dname, cmd); + } + if ((value == nullptr) || (strlen(value) == 0)) { + LOG_WARNING(("%sCalling command %s"), ro.c_str(), info_s); + } else { + if (id > 0) { + LOG_WARNING(("%sCalling command %s with value %s and id %d on device 0x%02X"), ro.c_str(), info_s, value, id, device_id); } else { - if (id > 0) { - LOG_DEBUG(("%sCalling command %s with value %s and id %d on device 0x%02X"), ro.c_str(), info_s, value, id, device_id); - } else { - LOG_DEBUG(("%sCalling command %s with value %s"), ro.c_str(), info_s, value); - } - } - - // call the function based on type - if (cf->cmdfunction_json_) { - return_code = ((cf->cmdfunction_json_)(value, id, output)) ? CommandRet::OK : CommandRet::ERROR; - } - - // check if read-only. This also checks for valid tags (e.g. heating circuits) - if (cf->cmdfunction_) { - if (!single_command && EMSESP::cmd_is_readonly(device_type, device_id, cmd, id)) { - return_code = CommandRet::INVALID; // readonly or invalid hc - } else { - return_code = ((cf->cmdfunction_)(value, id)) ? CommandRet::OK : CommandRet::ERROR; - } + LOG_WARNING(("%sCalling command %s with value %s"), ro.c_str(), info_s, value); } + } - // report back - if (return_code != CommandRet::OK) { - return message(return_code, "callback function failed", output); + // call the function based on type, either with a json package or no parameters + if (cf->cmdfunction_json_) { + // JSON + return_code = ((cf->cmdfunction_json_)(value, id, output)) ? CommandRet::OK : CommandRet::ERROR; + } else if (cf->cmdfunction_) { + // Normal command + if (!single_command && EMSESP::cmd_is_readonly(device_type, device_id, cmd, id)) { + return_code = CommandRet::INVALID; // error on readonly or invalid hc + } else { + return_code = ((cf->cmdfunction_)(value, id)) ? CommandRet::OK : CommandRet::ERROR; } - - return return_code; } - // we didn't find the command and its not an endpoint, report error - LOG_DEBUG("Command failed: invalid command '%s'", cmd ? cmd : ""); - return message(CommandRet::NOT_FOUND, "invalid command", output); + // report back. If not OK show output from error, other return the HTTP code + if (return_code != CommandRet::OK) { + return message(return_code, "callback function failed", output); + } + return return_code; } // add a command to the list, which does not return json From bc0a90ee41e8be2e7209a137439ad7a256272b8d Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:30:54 +0200 Subject: [PATCH 2/7] update packages --- interface/package.json | 20 +-- interface/yarn.lock | 365 +++++++++++++++++++++++++++-------------- 2 files changed, 256 insertions(+), 129 deletions(-) diff --git a/interface/package.json b/interface/package.json index 459db9aaa..56fadba3c 100644 --- a/interface/package.json +++ b/interface/package.json @@ -22,13 +22,13 @@ "@alova/adapter-xhr": "^1.0.1", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@mui/icons-material": "^5.14.9", - "@mui/material": "^5.14.10", + "@mui/icons-material": "^5.14.11", + "@mui/material": "^5.14.11", "@table-library/react-table-library": "4.1.7", "@types/lodash-es": "^4.17.9", - "@types/node": "^20.6.5", - "@types/react": "^18.2.22", - "@types/react-dom": "^18.2.7", + "@types/node": "^20.8.0", + "@types/react": "^18.2.24", + "@types/react-dom": "^18.2.8", "@types/react-router-dom": "^5.3.3", "alova": "^2.13.1", "async-validator": "^4.2.5", @@ -47,12 +47,12 @@ "typescript": "^5.2.2" }, "devDependencies": { - "@babel/core": "^7.22.20", + "@babel/core": "^7.23.0", "@preact/compat": "^17.1.2", "@preact/preset-vite": "^2.5.0", "@types/babel__core": "^7", - "@typescript-eslint/eslint-plugin": "^6.7.2", - "@typescript-eslint/parser": "^6.7.2", + "@typescript-eslint/eslint-plugin": "^6.7.3", + "@typescript-eslint/parser": "^6.7.3", "eslint": "^8.50.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^17.1.0", @@ -65,12 +65,12 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "npm-run-all": "^4.1.5", - "preact": "^10.17.1", + "preact": "^10.18.1", "prettier": "^3.0.3", "rollup-plugin-visualizer": "^5.9.2", "terser": "^5.20.0", "vite": "^4.4.9", - "vite-plugin-svgr": "^4.0.0", + "vite-plugin-svgr": "^4.1.0", "vite-tsconfig-paths": "^4.2.1" }, "packageManager": "yarn@3.4.1" diff --git a/interface/yarn.lock b/interface/yarn.lock index ef1eeba73..ad5dad73f 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -46,7 +46,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.21.3, @babel/core@npm:^7.22.1, @babel/core@npm:^7.22.20": +"@babel/core@npm:^7.21.3, @babel/core@npm:^7.22.1": version: 7.22.20 resolution: "@babel/core@npm:7.22.20" dependencies: @@ -69,6 +69,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/core@npm:7.23.0" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.22.13 + "@babel/generator": ^7.23.0 + "@babel/helper-compilation-targets": ^7.22.15 + "@babel/helper-module-transforms": ^7.23.0 + "@babel/helpers": ^7.23.0 + "@babel/parser": ^7.23.0 + "@babel/template": ^7.22.15 + "@babel/traverse": ^7.23.0 + "@babel/types": ^7.23.0 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: ba3604b28de28cdb07d7829f67127b03ad2e826c4e28a0560a037c8bbe16b8dc8cdb8baf344e916ad3c28c63aab88c1a1a38f5e3df6047ab79c910b41bb3a4e8 + languageName: node + linkType: hard + "@babel/generator@npm:^7.22.15": version: 7.22.15 resolution: "@babel/generator@npm:7.22.15" @@ -81,6 +104,18 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/generator@npm:7.23.0" + dependencies: + "@babel/types": ^7.23.0 + "@jridgewell/gen-mapping": ^0.3.2 + "@jridgewell/trace-mapping": ^0.3.17 + jsesc: ^2.5.1 + checksum: b7d8727c574119b5ef06e5d5d0d8d939527d51537db4b08273caebb18f3f2b1d4517b874776085e161fd47d28f26b22c08e7f270b64f43b2afd4a60c5936d6cd + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -120,6 +155,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-function-name@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/helper-function-name@npm:7.23.0" + dependencies: + "@babel/template": ^7.22.15 + "@babel/types": ^7.23.0 + checksum: d771dd1f3222b120518176733c52b7cadac1c256ff49b1889dbbe5e3fed81db855b8cc4e40d949c9d3eae0e795e8229c1c8c24c0e83f27cfa6ee3766696c6428 + languageName: node + linkType: hard + "@babel/helper-hoist-variables@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-hoist-variables@npm:7.22.5" @@ -153,6 +198,21 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-transforms@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/helper-module-transforms@npm:7.23.0" + dependencies: + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-module-imports": ^7.22.15 + "@babel/helper-simple-access": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/helper-validator-identifier": ^7.22.20 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 15a52e401bd17fe44ba9be51cca693a3e182dc93264dc28ede732081c43211741df81ce8eb15e82e81c8ad51beb8893301ecc31d5c77add0f7be78dff6815318 + languageName: node + linkType: hard + "@babel/helper-plugin-utils@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-plugin-utils@npm:7.22.5" @@ -210,6 +270,17 @@ __metadata: languageName: node linkType: hard +"@babel/helpers@npm:^7.23.0": + version: 7.23.1 + resolution: "@babel/helpers@npm:7.23.1" + dependencies: + "@babel/template": ^7.22.15 + "@babel/traverse": ^7.23.0 + "@babel/types": ^7.23.0 + checksum: ae5a34bb60a0d8bbf9dc4273d90cd5b9499c048f11e2f0df1b033ba3ef3876b96a411374817a20bb24e69619853a04f9a4e7d01b3d1cef5e0c054b9bce9e3128 + languageName: node + linkType: hard + "@babel/highlight@npm:^7.22.13": version: 7.22.20 resolution: "@babel/highlight@npm:7.22.20" @@ -230,6 +301,15 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/parser@npm:7.23.0" + bin: + parser: ./bin/babel-parser.js + checksum: ab4ea9360ed4ba3c728c5a9bf33035103ebde20a7e943c4ae1d42becb02a313d731d12a93c795c5a19777031e4022e64b92a52262eda902522a1a18649826283 + languageName: node + linkType: hard + "@babel/plugin-syntax-jsx@npm:^7.22.5": version: 7.22.5 resolution: "@babel/plugin-syntax-jsx@npm:7.22.5" @@ -305,6 +385,24 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/traverse@npm:7.23.0" + dependencies: + "@babel/code-frame": ^7.22.13 + "@babel/generator": ^7.23.0 + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-function-name": ^7.23.0 + "@babel/helper-hoist-variables": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/parser": ^7.23.0 + "@babel/types": ^7.23.0 + debug: ^4.1.0 + globals: ^11.1.0 + checksum: 84f93e64179965a0de6109a8b1ce92d66eb52a76e8ba325d27bdec6952cedd8fc98eabf09fe443ef667a051300dc7ed8924e7bf61a87ad456501d1da46657509 + languageName: node + linkType: hard + "@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.8.3": version: 7.22.19 resolution: "@babel/types@npm:7.22.19" @@ -316,6 +414,17 @@ __metadata: languageName: node linkType: hard +"@babel/types@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/types@npm:7.23.0" + dependencies: + "@babel/helper-string-parser": ^7.22.5 + "@babel/helper-validator-identifier": ^7.22.20 + to-fast-properties: ^2.0.0 + checksum: 70e4db41acb6793d0eb8d81a2fa88f19ee661219b84bd5f703dbdb54eb3a4d3c0dfc55e69034c945b479df9f43fd4b1376480aaccfc19797ce5af1c5d2576b36 + languageName: node + linkType: hard + "@emotion/babel-plugin@npm:^11.11.0": version: 11.11.0 resolution: "@emotion/babel-plugin@npm:11.11.0" @@ -787,14 +896,14 @@ __metadata: languageName: node linkType: hard -"@mui/base@npm:5.0.0-beta.16": - version: 5.0.0-beta.16 - resolution: "@mui/base@npm:5.0.0-beta.16" +"@mui/base@npm:5.0.0-beta.17": + version: 5.0.0-beta.17 + resolution: "@mui/base@npm:5.0.0-beta.17" dependencies: "@babel/runtime": ^7.22.15 "@floating-ui/react-dom": ^2.0.2 "@mui/types": ^7.2.4 - "@mui/utils": ^5.14.10 + "@mui/utils": ^5.14.11 "@popperjs/core": ^2.11.8 clsx: ^2.0.0 prop-types: ^15.8.1 @@ -805,20 +914,20 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 035cdb9bba59394d2f937d3f17a0a5d5121a269542129cc99f5b82e4e773d5b31dc6b7fbe1fcacf8b744ff7a8ad9640fb30c27e283f89770f802147fd9d50962 + checksum: 7d0b67a279f9b63e88cd74426153fae129b3bbe670ccc06ba293357edb5466df01e8f953d86944a1ba500a8cf7cb2c2f3af0691b62b1a8e983dfbe19abc93717 languageName: node linkType: hard -"@mui/core-downloads-tracker@npm:^5.14.10": - version: 5.14.10 - resolution: "@mui/core-downloads-tracker@npm:5.14.10" - checksum: 165751152a5fa490cee7d5919030e12a489c4e23ba253ecd14d78dcda07fea49d715ee656976854716f95d37fd89fa68f34e115f73e6bfed872bd1ba153ecd31 +"@mui/core-downloads-tracker@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/core-downloads-tracker@npm:5.14.11" + checksum: 206e74991d1fb1ce83f915d8761d08e793462a98213f433368a085b4715292580efcd4df5368266d7da1a2f7cc851e6f3762db27f24958d214aedbae6e562abd languageName: node linkType: hard -"@mui/icons-material@npm:^5.14.9": - version: 5.14.9 - resolution: "@mui/icons-material@npm:5.14.9" +"@mui/icons-material@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/icons-material@npm:5.14.11" dependencies: "@babel/runtime": ^7.22.15 peerDependencies: @@ -828,20 +937,20 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 99f3c59b90d21edc5dc8fcb5c15d6dc01bd8ee8b48533e5b839d6cccdfec67fa18be2d4e6611913652d75d4b71691f1ecf250f984e4e81166ba7145274c5be82 + checksum: f956b48b8ac83318a8e5e93a084f4f62ce82694e591a611e40d35c7c41d6395339bbde0416d0b80927e1ed3a051d4984076a090c2f8655046ac281bc5ca6466e languageName: node linkType: hard -"@mui/material@npm:^5.14.10": - version: 5.14.10 - resolution: "@mui/material@npm:5.14.10" +"@mui/material@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/material@npm:5.14.11" dependencies: "@babel/runtime": ^7.22.15 - "@mui/base": 5.0.0-beta.16 - "@mui/core-downloads-tracker": ^5.14.10 - "@mui/system": ^5.14.10 + "@mui/base": 5.0.0-beta.17 + "@mui/core-downloads-tracker": ^5.14.11 + "@mui/system": ^5.14.11 "@mui/types": ^7.2.4 - "@mui/utils": ^5.14.10 + "@mui/utils": ^5.14.11 "@types/react-transition-group": ^4.4.6 clsx: ^2.0.0 csstype: ^3.1.2 @@ -861,16 +970,16 @@ __metadata: optional: true "@types/react": optional: true - checksum: 82500d343c71ae22f8e9bfe5632cdf71092d15502574f20c42d44c33828f87dbb864be84f31d0dadc0f304d70fc8854581e2b4779b23cd2d753208e497acfc3d + checksum: 53b5ba0732cee87c82c16a64c3bc145f1fd88ae014c5d1dab9f84c24a212375f75cf1cb44b0ceca80135e009ec4f1fe13a8a3ca2079a55bbe5a15f22a706429c languageName: node linkType: hard -"@mui/private-theming@npm:^5.14.10": - version: 5.14.10 - resolution: "@mui/private-theming@npm:5.14.10" +"@mui/private-theming@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/private-theming@npm:5.14.11" dependencies: "@babel/runtime": ^7.22.15 - "@mui/utils": ^5.14.10 + "@mui/utils": ^5.14.11 prop-types: ^15.8.1 peerDependencies: "@types/react": ^17.0.0 || ^18.0.0 @@ -878,13 +987,13 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 0ef27687f575f09d8167db5dbc6bda0a0e19d603a3d00c8ff9d3f2544e5c55292b01be0317782640e0072bb19916015920c01e693bd36bd28068775a05a54b6d + checksum: e9b96b86355685a9dcbf95e617f3d86b33c502e005a5c6cd9b9cc64d102742b00b960560666d49b0ef0c4f4dac2d7a17f81ca6a745ff893b64e22515b53bd8fc languageName: node linkType: hard -"@mui/styled-engine@npm:^5.14.10": - version: 5.14.10 - resolution: "@mui/styled-engine@npm:5.14.10" +"@mui/styled-engine@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/styled-engine@npm:5.14.11" dependencies: "@babel/runtime": ^7.22.15 "@emotion/cache": ^11.11.0 @@ -899,19 +1008,19 @@ __metadata: optional: true "@emotion/styled": optional: true - checksum: 0f7184abfc81ed7a82c2256d3bab3efdf202d4e761e4cd98e67bafc7fe7d96176a6cac3c54b156fc4e161ca830294356eef28970f584b62c1a4d6ec3d6256dfe + checksum: b71cf3d9d0377bc5cdba01f4f72153147310b4d054fb10b6e5899b5307d05cc44770bcd8ba61069806c35bd367e5241328fbce7a7e91c7ec11e483fdb79fbc49 languageName: node linkType: hard -"@mui/system@npm:^5.14.10": - version: 5.14.10 - resolution: "@mui/system@npm:5.14.10" +"@mui/system@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/system@npm:5.14.11" dependencies: "@babel/runtime": ^7.22.15 - "@mui/private-theming": ^5.14.10 - "@mui/styled-engine": ^5.14.10 + "@mui/private-theming": ^5.14.11 + "@mui/styled-engine": ^5.14.11 "@mui/types": ^7.2.4 - "@mui/utils": ^5.14.10 + "@mui/utils": ^5.14.11 clsx: ^2.0.0 csstype: ^3.1.2 prop-types: ^15.8.1 @@ -927,7 +1036,7 @@ __metadata: optional: true "@types/react": optional: true - checksum: daf86070f786dbb70b997b0dbe11485634407bb60b18219d2929649e92486f9097c3c17d658ca3cd266d5708b658fc8bead6d6b53d63995c25bf76445d3d4919 + checksum: 3677dce2b1c010d5679f96a8c9cd54d803558b9ac881e4adec480ae7c3136b54895f5850131abf31b7d16493964a048d5261128332cecf2e3944c9dd58814bf1 languageName: node linkType: hard @@ -943,9 +1052,9 @@ __metadata: languageName: node linkType: hard -"@mui/utils@npm:^5.14.10": - version: 5.14.10 - resolution: "@mui/utils@npm:5.14.10" +"@mui/utils@npm:^5.14.11": + version: 5.14.11 + resolution: "@mui/utils@npm:5.14.11" dependencies: "@babel/runtime": ^7.22.15 "@types/prop-types": ^15.7.5 @@ -957,7 +1066,7 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: fb778e1a5fb97920b9457667d910f6055bb0a22bec26f011b4e269e9646e46f6c4800e00b80feab8f8ec79242afd4c342437671a0389b6ac807e14a32338dd24 + checksum: 21048b65e482e2f4279bf2b0e1619f026ed605bfe71818f6373b6362abc5062ea293ab7791691da1275de2d72b16cc5dafca70c2169359eca0b1c46c52aba879 languageName: node linkType: hard @@ -1359,10 +1468,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.6.5": - version: 20.6.5 - resolution: "@types/node@npm:20.6.5" - checksum: 82202ecb917d6371fdbb44f8d7a1b41a6b41d2495774e9dff67c4bbeee317054bd4d1a537f435df1060bb304e30a6a5184daf8b4ef336bc6496fcab7adab7949 +"@types/node@npm:^20.8.0": + version: 20.8.0 + resolution: "@types/node@npm:20.8.0" + checksum: 9ee3b9116bdb85bf519fe373f0faafdec048b6e3e34b1d97c20a3331f3d3ae0a87b08696805758447694869620d6359c81c18fdee30751a8fb4231bffa8f5482 languageName: node linkType: hard @@ -1380,12 +1489,12 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:^18.2.7": - version: 18.2.7 - resolution: "@types/react-dom@npm:18.2.7" +"@types/react-dom@npm:^18.2.8": + version: 18.2.8 + resolution: "@types/react-dom@npm:18.2.8" dependencies: "@types/react": "*" - checksum: bd090f5e1b13765fbc191d9eb720dd152d26c20558221963009189c4636ce11e4c1c976e4cde4a74335f997a2be651af27d3727474a8091424101a83a71eebfb + checksum: a2afa9f626751f2314ddbecb5503122912ff646827b1c81b7b230ce04083c43b71c82b02244526eb88c1795019033364a4afee0f7f719e46116a51ca8e287613 languageName: node linkType: hard @@ -1419,7 +1528,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:^18.2.22": +"@types/react@npm:*": version: 18.2.22 resolution: "@types/react@npm:18.2.22" dependencies: @@ -1430,6 +1539,17 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:^18.2.24": + version: 18.2.24 + resolution: "@types/react@npm:18.2.24" + dependencies: + "@types/prop-types": "*" + "@types/scheduler": "*" + csstype: ^3.0.2 + checksum: a83c7ae0010b265012ef038e3e00e4708c27c523f0aa0631e44f934e9c5338a51b6db1901f91d8ba10d3dc292a3a200b2cb5e47430cde58fbf988969866fe75a + languageName: node + linkType: hard + "@types/scheduler@npm:*": version: 0.16.3 resolution: "@types/scheduler@npm:0.16.3" @@ -1444,15 +1564,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/eslint-plugin@npm:6.7.2" +"@typescript-eslint/eslint-plugin@npm:^6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/eslint-plugin@npm:6.7.3" dependencies: "@eslint-community/regexpp": ^4.5.1 - "@typescript-eslint/scope-manager": 6.7.2 - "@typescript-eslint/type-utils": 6.7.2 - "@typescript-eslint/utils": 6.7.2 - "@typescript-eslint/visitor-keys": 6.7.2 + "@typescript-eslint/scope-manager": 6.7.3 + "@typescript-eslint/type-utils": 6.7.3 + "@typescript-eslint/utils": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 debug: ^4.3.4 graphemer: ^1.4.0 ignore: ^5.2.4 @@ -1465,44 +1585,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: ce0c1f0cc56cdf0d442439288a8d3530fff224b93840d7bd862da38521865f60516aa6a006d77e48dc91c296915e27c1b9131bff5d7495c9e848280f53e4dd03 + checksum: ca62d707e3378132f366fb37d206f5e5bb9c7986f44ac9b08b5fa4d5b10a7564832454a491e0f9f6a73e7fb54082afda067c9ddb850534de26a1afb8c83659ed languageName: node linkType: hard -"@typescript-eslint/parser@npm:^6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/parser@npm:6.7.2" +"@typescript-eslint/parser@npm:^6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/parser@npm:6.7.3" dependencies: - "@typescript-eslint/scope-manager": 6.7.2 - "@typescript-eslint/types": 6.7.2 - "@typescript-eslint/typescript-estree": 6.7.2 - "@typescript-eslint/visitor-keys": 6.7.2 + "@typescript-eslint/scope-manager": 6.7.3 + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/typescript-estree": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 debug: ^4.3.4 peerDependencies: eslint: ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: dde49a291d15e4eba0f286de40bd6ebcec4167979220bba5c30ff94a3c5f6f36ce2d04e7df94204a84b8cb99c261252b972500e2c46733a55d8c8c325937eeca + checksum: a2e7ae539cfcc556c48e54b4f1b00502f4ad437a0386b46bd99874de48d7b9c25973ad1de17dc41cbd4543734b0ed6817efce4551293bee64ff9b359c683d53a languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/scope-manager@npm:6.7.2" +"@typescript-eslint/scope-manager@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/scope-manager@npm:6.7.3" dependencies: - "@typescript-eslint/types": 6.7.2 - "@typescript-eslint/visitor-keys": 6.7.2 - checksum: 806cc2c10edb3324763bbedfa922147bf38b114da432c5feb11886f1b7f9f498b014cb1c26fbd9ea18ead3245abe268e29ea120962fd463de0a950ca69f620c4 + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 + checksum: 0063be085818824a6975df672fbde70bec773efeec4be8e7cb56ffb3143d8df5e8c8095dbe8793dfc4e6e74987165b9efaf433039017e5970e972cbd98294f18 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/type-utils@npm:6.7.2" +"@typescript-eslint/type-utils@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/type-utils@npm:6.7.3" dependencies: - "@typescript-eslint/typescript-estree": 6.7.2 - "@typescript-eslint/utils": 6.7.2 + "@typescript-eslint/typescript-estree": 6.7.3 + "@typescript-eslint/utils": 6.7.3 debug: ^4.3.4 ts-api-utils: ^1.0.1 peerDependencies: @@ -1510,23 +1630,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 4ca831cbeeb221ed318d9761b1e3652bc55c391029cfc588ff5535b43542fb454684ef62f21f7c27c60dd75daea6c79320c177a501646b78bee5403c67027df3 + checksum: 34387fb32559f8ad2e1bf3135a1cfe43077ce445c5de60b2cb931c703cc501d2c87f717886917eb0af4a10ec61944028421fd7540acdfdc95bd849993dfd8546 languageName: node linkType: hard -"@typescript-eslint/types@npm:6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/types@npm:6.7.2" - checksum: d5daf0051609b1bbe5a0d43a130647c23e2951f2443307d3b5dd323a71e3bedd32f3263a4bb5fdfaa8ad8a78c865ba3d5b606695cb27d85c412d2a8931c5d9a6 +"@typescript-eslint/types@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/types@npm:6.7.3" + checksum: f25389e20da03de34189f850b7e3af8c10d1a45d87387f1818b79cc42c835548ef223b67fe92c9139ac52bd05a69161ac38eb1a1c3a2c37d44d621ba52b0f03b languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/typescript-estree@npm:6.7.2" +"@typescript-eslint/typescript-estree@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/typescript-estree@npm:6.7.3" dependencies: - "@typescript-eslint/types": 6.7.2 - "@typescript-eslint/visitor-keys": 6.7.2 + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -1535,34 +1655,34 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 80205c23807ea0d508189de4326ec18dccfcaf4bccd4304c9fc8b49504083df3d001af16733272487197ffd5d499e6c8d0e0f2eb9d2d61423e163b6d4787a7bb + checksum: 9176acfcd1328bf3a82007e1b60e278f2c75d8e09eedc6f6f85f993bbb89d2bf4070cf59b660547ac4139f1b7449cb28f5215a59e720019f070cba9e9f6d997a languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/utils@npm:6.7.2" +"@typescript-eslint/utils@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/utils@npm:6.7.3" dependencies: "@eslint-community/eslint-utils": ^4.4.0 "@types/json-schema": ^7.0.12 "@types/semver": ^7.5.0 - "@typescript-eslint/scope-manager": 6.7.2 - "@typescript-eslint/types": 6.7.2 - "@typescript-eslint/typescript-estree": 6.7.2 + "@typescript-eslint/scope-manager": 6.7.3 + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/typescript-estree": 6.7.3 semver: ^7.5.4 peerDependencies: eslint: ^7.0.0 || ^8.0.0 - checksum: c1e5af3efc47bb5bff0d48fc73bf87e951b1393144e4ea072c3eec4346fe425a22c3261ede4ab9c9115bf15ad6c26c7c645522a12163e71d3df910e5005a87ba + checksum: 6b63f193f3be52c33239e4bf3d3a9b60e0a0cc191ec8efeaeca2321317ebd10dffbea97176446830db9ecacb3b185502515b18cdc96838d3e2f9b28e6d7bc8e8 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.7.2": - version: 6.7.2 - resolution: "@typescript-eslint/visitor-keys@npm:6.7.2" +"@typescript-eslint/visitor-keys@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/visitor-keys@npm:6.7.3" dependencies: - "@typescript-eslint/types": 6.7.2 + "@typescript-eslint/types": 6.7.3 eslint-visitor-keys: ^3.4.1 - checksum: e6b35338a98fcf6719388a2dce7ae476622f6fa37b0d5e3607de260100a72b8cb86e76b73b16a9a3c434e8386e1ea394cd946add1e4ce712d3b8a7fd0e221830 + checksum: 2e31cd0cd578ab5c36ea6f6c37055ee686ca7ef1bd47dc882d6383f77689d68c5c85750eda06c22fe3c8bac69ec12913446ba172cdc79610b60eb188d2aad3d3 languageName: node linkType: hard @@ -1571,22 +1691,22 @@ __metadata: resolution: "EMS-ESP@workspace:." dependencies: "@alova/adapter-xhr": ^1.0.1 - "@babel/core": ^7.22.20 + "@babel/core": ^7.23.0 "@emotion/react": ^11.11.1 "@emotion/styled": ^11.11.0 - "@mui/icons-material": ^5.14.9 - "@mui/material": ^5.14.10 + "@mui/icons-material": ^5.14.11 + "@mui/material": ^5.14.11 "@preact/compat": ^17.1.2 "@preact/preset-vite": ^2.5.0 "@table-library/react-table-library": 4.1.7 "@types/babel__core": ^7 "@types/lodash-es": ^4.17.9 - "@types/node": ^20.6.5 - "@types/react": ^18.2.22 - "@types/react-dom": ^18.2.7 + "@types/node": ^20.8.0 + "@types/react": ^18.2.24 + "@types/react-dom": ^18.2.8 "@types/react-router-dom": ^5.3.3 - "@typescript-eslint/eslint-plugin": ^6.7.2 - "@typescript-eslint/parser": ^6.7.2 + "@typescript-eslint/eslint-plugin": ^6.7.3 + "@typescript-eslint/parser": ^6.7.3 alova: ^2.13.1 async-validator: ^4.2.5 eslint: ^8.50.0 @@ -1605,7 +1725,7 @@ __metadata: lodash-es: ^4.17.21 mime-types: ^2.1.35 npm-run-all: ^4.1.5 - preact: ^10.17.1 + preact: ^10.18.1 prettier: ^3.0.3 react: latest react-dom: latest @@ -1619,7 +1739,7 @@ __metadata: typesafe-i18n: ^5.26.2 typescript: ^5.2.2 vite: ^4.4.9 - vite-plugin-svgr: ^4.0.0 + vite-plugin-svgr: ^4.1.0 vite-tsconfig-paths: ^4.2.1 languageName: unknown linkType: soft @@ -2211,6 +2331,13 @@ __metadata: languageName: node linkType: hard +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 8f2f7a27a1a011cc6cc88cc4da2d7d0cfa5ee0369508baae3d98c260bb3ac520691464e5bbe4ae7cdf09860c1d69ecc6f70c63c6e7c7f7e3f18ec08484dc7d9b + languageName: node + linkType: hard + "cosmiconfig@npm:^7.0.0": version: 7.1.0 resolution: "cosmiconfig@npm:7.1.0" @@ -4943,10 +5070,10 @@ eslint-plugin-prettier@alpha: languageName: node linkType: hard -"preact@npm:^10.17.1": - version: 10.17.1 - resolution: "preact@npm:10.17.1" - checksum: 6a264832afacb2e5c6ffd3bdbbb85cfbb1c5f8e33c616885cdbd8d07474819b6740c834dc3a749f6986366a57cdc33feba10680b2a65dc51d5e40a9c68c7b641 +"preact@npm:^10.18.1": + version: 10.18.1 + resolution: "preact@npm:10.18.1" + checksum: b157c46d5dbece48cf0f31b0e24d27c989ea019e77730427b4c7549953da7de015b34f13f93d0034966f033738ec582829da918c28d084bbb31d59f320f56aa0 languageName: node linkType: hard @@ -6106,16 +6233,16 @@ react@latest: languageName: node linkType: hard -"vite-plugin-svgr@npm:^4.0.0": - version: 4.0.0 - resolution: "vite-plugin-svgr@npm:4.0.0" +"vite-plugin-svgr@npm:^4.1.0": + version: 4.1.0 + resolution: "vite-plugin-svgr@npm:4.1.0" dependencies: "@rollup/pluginutils": ^5.0.4 "@svgr/core": ^8.1.0 "@svgr/plugin-jsx": ^8.1.0 peerDependencies: vite: ^2.6.0 || 3 || 4 - checksum: 9b6009302479ed48d102108afe4ad7a2a4969ea6835cd835640d621c50bb46659bb5c199d571ab14006d928766f32bb8f8857cfd682cfe9078080147a6f626d8 + checksum: 23b9a4e61bece955af65e29cb9e84242833690c93b3be9f00a5b724907ffb629251039f18d1151d9dbe523fa24f6423cc6c68e1e8758b0ef6fa6a5bb20fa3c82 languageName: node linkType: hard From 3f99806ddd446626fbefcc70fdfc67645184f4c8 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:31:11 +0200 Subject: [PATCH 3/7] sending dash/- to reset command doesn't error --- src/devices/boiler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 6454c919f..e601d3d96 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -2341,7 +2341,9 @@ bool Boiler::set_reset(const char * value, const int8_t id) { return false; } - if (num == 1) { + if (num == 0) { + return true; // dash + } else if (num == 1) { // LOG_INFO("Reset boiler maintenance message"); write_command(0x05, 0x08, 0xFF, 0x1C); has_update(&reset_); From 5d78f1c814a00cf32938597187fb42bb753efaf1 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:31:24 +0200 Subject: [PATCH 4/7] Reset command renamed to reset --- src/locale_translations.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale_translations.h b/src/locale_translations.h index 552777754..89022f3f4 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -284,7 +284,7 @@ MAKE_TRANSLATION(haclimate, "haclimate", "Discovery current room temperature", " // Entity translations: tag, mqtt, en, de, nl, sv, pl, no, fr, tr, it // Boiler MAKE_TRANSLATION(wwtapactivated, "wwtapactivated", "turn on/off", "Durchlauferhitzer aktiv", "zet aan/uit", "på/av", "system przygotowywania", "Varmtvann active", "ecs activée", "aç/kapa", "commuta on/off") -MAKE_TRANSLATION(reset, "reset", "Reset", "Reset", "Reset", "Nollställ", "kasowanie komunikatu", "nullstill", "reset", "Sıfırla", "Reset") +MAKE_TRANSLATION(reset, "reset", "reset", "Reset", "Reset", "Nollställ", "kasowanie komunikatu", "nullstill", "reset", "Sıfırla", "Reset") MAKE_TRANSLATION(oilPreHeat, "oilpreheat", "oil preheating", "Ölvorwärmung", "Olie voorverwarming", "Förvärmning olja", "podgrzewanie oleju", "oljeforvarming", "préchauffage de l'huile", "Yakıt Ön ısıtma devrede", "preriscaldamento olio") MAKE_TRANSLATION(heatingActive, "heatingactive", "heating active", "Heizen aktiv", "Verwarming actief", "Uppvärmning aktiv", "c.o. aktywne", "oppvarming aktiv", "chauffage actif", "ısıtma devrede", "riscaldamento attivo") MAKE_TRANSLATION(tapwaterActive, "tapwateractive", "tapwater active", "Warmwasser aktiv", "Warm water actief", "Varmvatten aktiv", "c.w.u. aktywne", "varmtvann aktiv", "eau chaude active", "sıcak kullanım suyu devrede", "acqua calda attiva") From 763a2eaab150ebd9eb27bf4bf545352b0bbdfb9c Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:31:31 +0200 Subject: [PATCH 5/7] bump version --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 4331eb523..c4715acd2 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.6.2-dev.2" +#define EMSESP_APP_VERSION "3.6.2-dev.3" From e1ee83b907f2c71e51b0264bf5947f7c3c0ce992 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:31:43 +0200 Subject: [PATCH 6/7] update with 3.6.2 --- CHANGELOG.md | 8 ++++---- CHANGELOG_LATEST.md | 15 +++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e7c0d6d8..94ba4ef9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Added -- show WiFi rssi in Network Status Page, show quality as color +- Show WiFi rssi in Network Status Page, show quality as color ## Fixed @@ -22,9 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed -- mqtt free mem check set to 60 kb -- small cosmetic changes to Searching in Customization web page -- updated to espressif32@6.4.0 +- MQTT free mem check set to 60 kb +- Small cosmetic changes to Searching in Customization web page +- Updated to espressif32@6.4.0 # [3.6.0] August 13 2023 diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 016532ba7..5484cf687 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -6,15 +6,18 @@ ## Added -- power entities -- optional input of BSSID for AP connection -- return empty json if no entries in scheduler/custom/analogsnesor/temperaturesensor +- Power entities +- Optional input of BSSID for AP connection +- Return empty json if no entries in scheduler/custom/analogsnesor/temperaturesensor ## Fixed -- wifi full scan to get strongest AP -- add missing dhw tags +- Wifi full scan to get strongest AP +- Add missing dhw tags +- Sending a dash/- to the Reset command doesn't return an error [#1308](https://github.com/emsesp/EMS-ESP32/discussions/1308) ## Changed -- mqtt queue max 300 messages, check heap and maxAlloc +- MQTT queue max 300 messages, check heap and maxAlloc +- API call commands are logged as WARN in the log +- Reset Command renamed to 'reset' in lowercase in EN From d3b086a675b21de85ec528e02c647a5891418113 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 1 Oct 2023 17:32:16 +0200 Subject: [PATCH 7/7] added more API tests --- src/test/test.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/test/test.cpp b/src/test/test.cpp index b28023ec3..3b932bc96 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -1045,7 +1045,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const EMSESP::mqtt_.incoming("ems-esp/thermostat", "{\"cmd\":\"mode\",\"data\":\"heat\",\"id\":1}"); - // MQTT bad tests + // MQTT bad tests - these should all fail EMSESP::mqtt_.incoming("ems-esp/thermostate/mode", "auto"); // unknown device EMSESP::mqtt_.incoming("ems-esp/thermostat/modee", "auto"); // unknown command EMSESP::mqtt_.incoming("ems-esp/thermostat/mode/auto", "auto"); // invalid, not allowed @@ -1124,19 +1124,26 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const request.url("/rest/writeDeviceValue"); EMSESP::webDataService.write_device_value(&request, json); - // write value from web - testing hc9/seltemp - should fail! - char data7[] = "{\"id\":2,\"devicevalue\":{\"v\":\"55\",\"u\":1,\"n\":\"hc2 selected room temperature\",\"c\":\"hc9/seltemp\"}"; + // call reset command + char data7[] = "{\"device\":\"boiler\", \"cmd\":\"reset\",\"value\":\"error\"}"; deserializeJson(doc, data7); json = doc.as(); - request.url("/rest/writeDeviceValue"); - EMSESP::webDataService.write_device_value(&request, json); + request.url("/api"); + EMSESP::webAPIService.webAPIService_post(&request, json); - // emsesp::EMSESP::logger().notice("*"); + emsesp::EMSESP::logger().warning("* these next ones should fail *"); - // should fail - char data8[] = "{}"; + // write value from web - testing hc9/seltemp - should fail! + char data8[] = "{\"id\":2,\"devicevalue\":{\"v\":\"55\",\"u\":1,\"n\":\"hc2 selected room temperature\",\"c\":\"hc9/seltemp\"}"; deserializeJson(doc, data8); json = doc.as(); + request.url("/rest/writeDeviceValue"); + EMSESP::webDataService.write_device_value(&request, json); + + // should fail! + char data9[] = "{}"; + deserializeJson(doc, data9); + json = doc.as(); request.url("/api/thermostat/mode/auto"); EMSESP::webAPIService.webAPIService_post(&request, json); ok = true;