From e3a644182eb3aec65674644fef9cfea5de6e1c83 Mon Sep 17 00:00:00 2001 From: Proddy Date: Mon, 30 Oct 2023 13:00:31 +0100 Subject: [PATCH 01/14] switch back to C++11 --- platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 51d4fbd78..c98d3438f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -17,10 +17,10 @@ core_build_flags = -D NDEBUG -D ARDUINO_ARCH_ESP32=1 -D ESP32=1 - -std=gnu++17 + ; -std=gnu++17 -core_unbuild_flags = -std=gnu++11 -; core_unbuild_flags = +; core_unbuild_flags = -std=gnu++11 +core_unbuild_flags = ; my_build_flags is set in pio_local.ini my_build_flags = From b9e57414ce23db11e40c0f26a0983200bc37e941 Mon Sep 17 00:00:00 2001 From: Proddy Date: Mon, 30 Oct 2023 13:01:43 +0100 Subject: [PATCH 02/14] #1364 --- src/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command.cpp b/src/command.cpp index 7486a617d..fd6325f0b 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -338,7 +338,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * snprintf(info_s, sizeof(info_s), "'%s/%s'", dname, cmd); } if ((value == nullptr) || (strlen(value) == 0)) { - LOG_INFO(("%sCalling command %s"), ro.c_str(), info_s); + LOG_DEBUG(("%sCalling command %s"), ro.c_str(), info_s); } else { if (id > 0) { LOG_INFO(("%sCalling command %s with value %s and id %d on device 0x%02X"), ro.c_str(), info_s, value, id, device_id); From 527dd870a299c08f8fc3ab91ca72409efb1e50a8 Mon Sep 17 00:00:00 2001 From: Proddy Date: Mon, 30 Oct 2023 13:10:03 +0100 Subject: [PATCH 03/14] change shower log message if using NTP --- src/shower.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shower.cpp b/src/shower.cpp index 865877570..ea40bf7fa 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -111,9 +111,11 @@ void Shower::loop() { char dt[25]; strftime(dt, sizeof(dt), "%FT%T%z", tm_); doc["timestamp"] = dt; + LOG_INFO("shower finished (duration %s)", dt); + } else { + LOG_INFO("shower finished (duration %lu s)", duration_); } Mqtt::queue_publish("shower_data", doc.as()); - LOG_INFO("finished with duration %lu seconds", duration_); } } From 29c1169b33c163812270105d3e0fd6f29772018c Mon Sep 17 00:00:00 2001 From: Proddy Date: Tue, 31 Oct 2023 12:32:57 +0100 Subject: [PATCH 04/14] shower duration in sec --- interface/package.json | 12 +-- interface/yarn.lock | 235 +++++++++++++++++++++-------------------- src/shower.cpp | 2 +- 3 files changed, 129 insertions(+), 120 deletions(-) diff --git a/interface/package.json b/interface/package.json index 7a9af0609..c0c804384 100644 --- a/interface/package.json +++ b/interface/package.json @@ -23,12 +23,12 @@ "@babel/core": "^7.23.2", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@mui/icons-material": "^5.14.15", - "@mui/material": "^5.14.15", + "@mui/icons-material": "^5.14.16", + "@mui/material": "^5.14.16", "@table-library/react-table-library": "4.1.7", "@types/imagemin": "^8.0.3", "@types/lodash-es": "^4.17.10", - "@types/node": "^20.8.9", + "@types/node": "^20.8.10", "@types/react": "^18.2.33", "@types/react-dom": "^18.2.14", "@types/react-router-dom": "^5.3.3", @@ -51,8 +51,8 @@ "devDependencies": { "@preact/compat": "^17.1.2", "@preact/preset-vite": "^2.6.0", - "@typescript-eslint/eslint-plugin": "^6.9.0", - "@typescript-eslint/parser": "^6.9.0", + "@typescript-eslint/eslint-plugin": "^6.9.1", + "@typescript-eslint/parser": "^6.9.1", "concurrently": "^8.2.2", "eslint": "^8.52.0", "eslint-config-airbnb": "^19.0.4", @@ -68,7 +68,7 @@ "preact": "^10.18.1", "prettier": "^3.0.3", "rollup-plugin-visualizer": "^5.9.2", - "terser": "^5.22.0", + "terser": "^5.23.0", "vite": "^4.5.0", "vite-plugin-imagemin": "^0.6.1", "vite-tsconfig-paths": "^4.2.1" diff --git a/interface/yarn.lock b/interface/yarn.lock index 8a570c936..a3abf7a49 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -794,14 +794,14 @@ __metadata: languageName: node linkType: hard -"@mui/base@npm:5.0.0-beta.21": - version: 5.0.0-beta.21 - resolution: "@mui/base@npm:5.0.0-beta.21" +"@mui/base@npm:5.0.0-beta.22": + version: 5.0.0-beta.22 + resolution: "@mui/base@npm:5.0.0-beta.22" dependencies: "@babel/runtime": "npm:^7.23.2" "@floating-ui/react-dom": "npm:^2.0.2" - "@mui/types": "npm:^7.2.7" - "@mui/utils": "npm:^5.14.15" + "@mui/types": "npm:^7.2.8" + "@mui/utils": "npm:^5.14.16" "@popperjs/core": "npm:^2.11.8" clsx: "npm:^2.0.0" prop-types: "npm:^15.8.1" @@ -812,20 +812,20 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 083b4399481f3d00bdfa849436e7eb7e7d3b70e0f91069d138b55f607ba6f9cd5706b400cda992e1ce415cfec8fa2f578af517a4f4c2af2feb04bedc3280cd7c + checksum: e93199464a7934637b84f3c6cd96898587ab4d3fba8843ee99ea88c656a0cef6c778e3d0eb6d82a6f120f501371007baa72648743e2ebd37bffa9d162dd0f8a7 languageName: node linkType: hard -"@mui/core-downloads-tracker@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/core-downloads-tracker@npm:5.14.15" - checksum: 2538bb7a62ca4eddfa2e5a1bdc589a665682092408e269019cfaedb2591aa76c4bdc8a90d0775c1614616c68546371a9723967c396af8a8b7a67c532fcfd1bc1 +"@mui/core-downloads-tracker@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/core-downloads-tracker@npm:5.14.16" + checksum: 26d691d20eabc7f0f23d4fc4bc21f247dde43ab86c5f3e57201ed63afbb67dba94e0b0e80cb8f2f0e6f6e1ba94e46853f0ca6ab593d558a749bde843ec1d4aa6 languageName: node linkType: hard -"@mui/icons-material@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/icons-material@npm:5.14.15" +"@mui/icons-material@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/icons-material@npm:5.14.16" dependencies: "@babel/runtime": "npm:^7.23.2" peerDependencies: @@ -835,21 +835,21 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: cc2a3ec7b82eb89226b6d20af92dfc8d9542b8c688eaf4d9de00543defa42e0377953c837b6be6a246f273c2d43e6582227d8eef805ac1e6d9ed352efc7d5a28 + checksum: e4dc4071eb68b06c54f25733cd00c749a18c69c16186defc467db5599ea46c32bfb8cc64e40b208e4b85f9186ab8b2e76f0553eac98727e8446c81461d665f58 languageName: node linkType: hard -"@mui/material@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/material@npm:5.14.15" +"@mui/material@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/material@npm:5.14.16" dependencies: "@babel/runtime": "npm:^7.23.2" - "@mui/base": "npm:5.0.0-beta.21" - "@mui/core-downloads-tracker": "npm:^5.14.15" - "@mui/system": "npm:^5.14.15" - "@mui/types": "npm:^7.2.7" - "@mui/utils": "npm:^5.14.15" - "@types/react-transition-group": "npm:^4.4.7" + "@mui/base": "npm:5.0.0-beta.22" + "@mui/core-downloads-tracker": "npm:^5.14.16" + "@mui/system": "npm:^5.14.16" + "@mui/types": "npm:^7.2.8" + "@mui/utils": "npm:^5.14.16" + "@types/react-transition-group": "npm:^4.4.8" clsx: "npm:^2.0.0" csstype: "npm:^3.1.2" prop-types: "npm:^15.8.1" @@ -868,16 +868,16 @@ __metadata: optional: true "@types/react": optional: true - checksum: 5962b501498c37903b712104dbb9a5507f5cf5996233a4ce543a36e0c4c492ab3f0aff5ae638b83e9931af7f612b2920dde51cd7e09ca73128875b1231d51448 + checksum: ce5b4c682cb3674513627b1555957a694f0586fc5bb7fcb1ad1de29472c7f2a743c6659f4b8394c3db2d9a42802e2dbc12b160fef76dabc9765b73d7d03152f9 languageName: node linkType: hard -"@mui/private-theming@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/private-theming@npm:5.14.15" +"@mui/private-theming@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/private-theming@npm:5.14.16" dependencies: "@babel/runtime": "npm:^7.23.2" - "@mui/utils": "npm:^5.14.15" + "@mui/utils": "npm:^5.14.16" prop-types: "npm:^15.8.1" peerDependencies: "@types/react": ^17.0.0 || ^18.0.0 @@ -885,13 +885,13 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: e7b7f19fe475fc56196a680eb959e3ca7e34fd30bd1f643b3f7943bd66fed471ed6f2ce51686afbd8caa30b1d281f0a3c11103673c9160f44194734de0bd3023 + checksum: 48cbc62d20caab7df48d97d3bff95f0b86679fcbe5494e5b36b34f5464787351e9beeb1f674a240e3f1586c61a23e3e710210a3a47d2ca4e208f7c14a49f2678 languageName: node linkType: hard -"@mui/styled-engine@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/styled-engine@npm:5.14.15" +"@mui/styled-engine@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/styled-engine@npm:5.14.16" dependencies: "@babel/runtime": "npm:^7.23.2" "@emotion/cache": "npm:^11.11.0" @@ -906,19 +906,19 @@ __metadata: optional: true "@emotion/styled": optional: true - checksum: 551388e12b3d4d0c5b29e76aed2eaae1c2efcb8aba6ab72f4e6061ac4612765c05d5fe144e184fb98bfa317971364b63ed0957fed95b15ad095cea2a3c4a7ef6 + checksum: 4fed894a3a795e84dec63d0962a64c371ff9bdf27f022a3e502c9edbcfae790f3fd271d833b65ed5f45b736b47eac900e5edba1b72e063ae103beb85c9c7f8e9 languageName: node linkType: hard -"@mui/system@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/system@npm:5.14.15" +"@mui/system@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/system@npm:5.14.16" dependencies: "@babel/runtime": "npm:^7.23.2" - "@mui/private-theming": "npm:^5.14.15" - "@mui/styled-engine": "npm:^5.14.15" - "@mui/types": "npm:^7.2.7" - "@mui/utils": "npm:^5.14.15" + "@mui/private-theming": "npm:^5.14.16" + "@mui/styled-engine": "npm:^5.14.16" + "@mui/types": "npm:^7.2.8" + "@mui/utils": "npm:^5.14.16" clsx: "npm:^2.0.0" csstype: "npm:^3.1.2" prop-types: "npm:^15.8.1" @@ -934,28 +934,28 @@ __metadata: optional: true "@types/react": optional: true - checksum: 8e58db57a94fca01c70f7b944bb3d904fa0c4e60558f2fd7acf54f34e8c781c3ef7147a7bd364c77f98170d26f0b1cccdf64b5060281b3ae3d67ff845c5e7e61 + checksum: 6480e4bf2834a8234054106abce9f8369e562acd4a7974649528b221b844d5eb18c9137971a14bd36cf8af94d12010dac2af16c4df8f0448ae0443d540706958 languageName: node linkType: hard -"@mui/types@npm:^7.2.7": - version: 7.2.7 - resolution: "@mui/types@npm:7.2.7" +"@mui/types@npm:^7.2.8": + version: 7.2.8 + resolution: "@mui/types@npm:7.2.8" peerDependencies: "@types/react": ^17.0.0 || ^18.0.0 peerDependenciesMeta: "@types/react": optional: true - checksum: 1aa564afe0e3afa6c95f432ef36ee89ce291fe39aa2a0c7091ce8b8a9dbfe15af4c6291b56f9863a9825089a6fd534edb50c5232270d5b075b0e1e00a445ad5a + checksum: 47be368669d5bb5e43458d93d20c7e9f4f6ca2fec2bc7b541dcc7b59a0168ac6bfa6b88f51f5ad1d044c07a1fb247b803683bcaf969052aab559f25f11727ba5 languageName: node linkType: hard -"@mui/utils@npm:^5.14.15": - version: 5.14.15 - resolution: "@mui/utils@npm:5.14.15" +"@mui/utils@npm:^5.14.16": + version: 5.14.16 + resolution: "@mui/utils@npm:5.14.16" dependencies: "@babel/runtime": "npm:^7.23.2" - "@types/prop-types": "npm:^15.7.8" + "@types/prop-types": "npm:^15.7.9" prop-types: "npm:^15.8.1" react-is: "npm:^18.2.0" peerDependencies: @@ -964,7 +964,7 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 1f3907809ee8b0703da0a20360f84a92064fd4d139054cba791f2ef099b9a51677352ee91213c0ac139a482f631e45ad4bd5e5531b3d5edd2938f6464ec399e0 + checksum: 02eb4550ba2ab30f98934a108dec4cc97f040b1c1d9a44d6adf7162286169fd7bf224a85625ed0b3feec27fdf7033bd1d3bb2225a8dd93ffcbd160090d288ef5 languageName: node linkType: hard @@ -1288,7 +1288,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^20.8.9": +"@types/node@npm:*": version: 20.8.9 resolution: "@types/node@npm:20.8.9" dependencies: @@ -1297,6 +1297,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^20.8.10": + version: 20.8.10 + resolution: "@types/node@npm:20.8.10" + dependencies: + undici-types: "npm:~5.26.4" + checksum: 8930039077c8ad74de74c724909412bea8110c3f8892bcef8dda3e9629073bed65632ee755f94b252bcdae8ca71cf83e89a4a440a105e2b1b7c9797b43483049 + languageName: node + linkType: hard + "@types/parse-json@npm:^4.0.0": version: 4.0.1 resolution: "@types/parse-json@npm:4.0.1" @@ -1304,7 +1313,7 @@ __metadata: languageName: node linkType: hard -"@types/prop-types@npm:*, @types/prop-types@npm:^15.7.8": +"@types/prop-types@npm:*, @types/prop-types@npm:^15.7.9": version: 15.7.9 resolution: "@types/prop-types@npm:15.7.9" checksum: c7591d3ff7593e243908a07e1d3e2bb6e8879008af5800d8378115a90d0fdf669a1cae72a6d7f69e59c4fa7bb4c8ed61f6ebc1c520fe110c6f2b03ac02414072 @@ -1341,7 +1350,7 @@ __metadata: languageName: node linkType: hard -"@types/react-transition-group@npm:^4.4.7": +"@types/react-transition-group@npm:^4.4.8": version: 4.4.8 resolution: "@types/react-transition-group@npm:4.4.8" dependencies: @@ -1393,15 +1402,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/eslint-plugin@npm:6.9.0" +"@typescript-eslint/eslint-plugin@npm:^6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/eslint-plugin@npm:6.9.1" dependencies: "@eslint-community/regexpp": "npm:^4.5.1" - "@typescript-eslint/scope-manager": "npm:6.9.0" - "@typescript-eslint/type-utils": "npm:6.9.0" - "@typescript-eslint/utils": "npm:6.9.0" - "@typescript-eslint/visitor-keys": "npm:6.9.0" + "@typescript-eslint/scope-manager": "npm:6.9.1" + "@typescript-eslint/type-utils": "npm:6.9.1" + "@typescript-eslint/utils": "npm:6.9.1" + "@typescript-eslint/visitor-keys": "npm:6.9.1" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" ignore: "npm:^5.2.4" @@ -1414,44 +1423,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: bcf4578ef5ec046149d3692a622d0ffff125df9d9436a1964ac560024b3ccf8e847e83d608c4b9f1b3bde7a48f4c42c34b1c8dfad99df076c41bfcef9d6704fe + checksum: 10a75e072be6645edd6fd74b200f3a3ee23e2ebb04a93d8e9be70f0a34dd94572146433a0a0f2732e9667ab8bdb2037d6d4261c10474fd94cfa9c56d02546215 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/parser@npm:6.9.0" +"@typescript-eslint/parser@npm:^6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/parser@npm:6.9.1" dependencies: - "@typescript-eslint/scope-manager": "npm:6.9.0" - "@typescript-eslint/types": "npm:6.9.0" - "@typescript-eslint/typescript-estree": "npm:6.9.0" - "@typescript-eslint/visitor-keys": "npm:6.9.0" + "@typescript-eslint/scope-manager": "npm:6.9.1" + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/typescript-estree": "npm:6.9.1" + "@typescript-eslint/visitor-keys": "npm:6.9.1" debug: "npm:^4.3.4" peerDependencies: eslint: ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 607813cc677095f77000a77eee58c5e2fd02d45c10e35e51830cb1284d1e3b9ff33c3b06124368e51d7ff312a88311026931026b3eb36f77436b88901ef3a8fd + checksum: 855a62180ad54f5a05ae4f15742e810b811aeceacd5be5a3498aeb11bd5c7877d25d4f7dc56d010a7b3ad2992e85f31d41340fb46a7fd68fc682ae65d82304d1 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/scope-manager@npm:6.9.0" +"@typescript-eslint/scope-manager@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/scope-manager@npm:6.9.1" dependencies: - "@typescript-eslint/types": "npm:6.9.0" - "@typescript-eslint/visitor-keys": "npm:6.9.0" - checksum: ee872441fb9224859b31270e1a7dec3a51078f0475926b8f6132502db68f080eccaa7191915e91c9f8aa53179000af2523af4707c81a8a5218db3815f1887aa6 + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/visitor-keys": "npm:6.9.1" + checksum: a9ca328e42fbadaeffaed807c141d71f01d471b1aeeb1abbb107a0fe630963a33aeb6e215cb26874a01bee9589e8d773ad7a7fea7b14b9710d30dd1e0d6f6820 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/type-utils@npm:6.9.0" +"@typescript-eslint/type-utils@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/type-utils@npm:6.9.1" dependencies: - "@typescript-eslint/typescript-estree": "npm:6.9.0" - "@typescript-eslint/utils": "npm:6.9.0" + "@typescript-eslint/typescript-estree": "npm:6.9.1" + "@typescript-eslint/utils": "npm:6.9.1" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.0.1" peerDependencies: @@ -1459,23 +1468,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: b435914bfce1ef3335a511fe4bb22c178090175997e39569db174e39ffc2b02eb62112ddfe093ef70509e429219dd373a31dba4b5cb899de38583f7c80353201 + checksum: cad9502565d9b0f203a4fa2a37f31cdde9734d050fa5324b7403d55d5125a891d0e8b6a8b2a1c0039b47b64f187219cc7fe37b905f48dee576b3b0e73f76a79c languageName: node linkType: hard -"@typescript-eslint/types@npm:6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/types@npm:6.9.0" - checksum: 39a9206062dc8efb9ec4378d7f03e7e59ce85d2171a4e0ed90653eb44ec92089a1d587371600dfa3a28521d818bbc79e8cce825787f7800f381ecee9b497cc40 +"@typescript-eslint/types@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/types@npm:6.9.1" + checksum: 28bf79fc9e30cafa1d747f20f95b2ce949816312bb9e1f4b0a4add6537fcf70a2b64c0da17b03c4cf70bf415263077de6edbd49ad08e482e9270454f2c61e1a3 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/typescript-estree@npm:6.9.0" +"@typescript-eslint/typescript-estree@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/typescript-estree@npm:6.9.1" dependencies: - "@typescript-eslint/types": "npm:6.9.0" - "@typescript-eslint/visitor-keys": "npm:6.9.0" + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/visitor-keys": "npm:6.9.1" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -1484,34 +1493,34 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: f1ca4fd2cb586ff54e58f3f1967c0800ef9489829df9acb5ccea61e90395ec915ac1eeb8ba8c102d34ab161a9c3342c756ec7da983c2512c13104be3e1eb4f69 + checksum: 40d1d654c3d7223c84e9340740bde95484ef246f5248cf9f6cd5ae308c79463b52c2b964f935ff68577fb0ea9d6862c9a8547e9430449e1f4eb3c53da2dbfc55 languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/utils@npm:6.9.0" +"@typescript-eslint/utils@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/utils@npm:6.9.1" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" "@types/json-schema": "npm:^7.0.12" "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:6.9.0" - "@typescript-eslint/types": "npm:6.9.0" - "@typescript-eslint/typescript-estree": "npm:6.9.0" + "@typescript-eslint/scope-manager": "npm:6.9.1" + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/typescript-estree": "npm:6.9.1" semver: "npm:^7.5.4" peerDependencies: eslint: ^7.0.0 || ^8.0.0 - checksum: 4937c9ad754681b4f0591eb5be3caa34b2df6c07845f16292120b03755453c4c19f1c34710f6f9eb138d509ec554575b899b44b33e263536d9d43f5b1fbe2208 + checksum: 36432f0f170a81d5a6e6c8919b7d492e9be323310124e9a9d03aa64db7f32c381bc3e7f894cefc9c2b427b0a6df95613477c2a00808911a7b8e95a37fcce54a1 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.9.0": - version: 6.9.0 - resolution: "@typescript-eslint/visitor-keys@npm:6.9.0" +"@typescript-eslint/visitor-keys@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/visitor-keys@npm:6.9.1" dependencies: - "@typescript-eslint/types": "npm:6.9.0" + "@typescript-eslint/types": "npm:6.9.1" eslint-visitor-keys: "npm:^3.4.1" - checksum: 562ce06df6d4e13257c396f5322b4839383bbd78d68411781ab0a9a336579b0b3480e3b4cb8e67b9e27ebc108560643e0be22712ba453db1cdd7a3424d8d86ac + checksum: 46d8a3335777798d43b9bf3393b96176881794184faf831670e4ee52493834cd6fbd3199ff387112ae795e344e3c92a8e78f79254d6c5bee012354859c8f333b languageName: node linkType: hard @@ -1530,19 +1539,19 @@ __metadata: "@babel/core": "npm:^7.23.2" "@emotion/react": "npm:^11.11.1" "@emotion/styled": "npm:^11.11.0" - "@mui/icons-material": "npm:^5.14.15" - "@mui/material": "npm:^5.14.15" + "@mui/icons-material": "npm:^5.14.16" + "@mui/material": "npm:^5.14.16" "@preact/compat": "npm:^17.1.2" "@preact/preset-vite": "npm:^2.6.0" "@table-library/react-table-library": "npm:4.1.7" "@types/imagemin": "npm:^8.0.3" "@types/lodash-es": "npm:^4.17.10" - "@types/node": "npm:^20.8.9" + "@types/node": "npm:^20.8.10" "@types/react": "npm:^18.2.33" "@types/react-dom": "npm:^18.2.14" "@types/react-router-dom": "npm:^5.3.3" - "@typescript-eslint/eslint-plugin": "npm:^6.9.0" - "@typescript-eslint/parser": "npm:^6.9.0" + "@typescript-eslint/eslint-plugin": "npm:^6.9.1" + "@typescript-eslint/parser": "npm:^6.9.1" alova: "npm:^2.13.1" async-validator: "npm:^4.2.5" concurrently: "npm:^8.2.2" @@ -1571,7 +1580,7 @@ __metadata: react-toastify: "npm:^9.1.3" rollup-plugin-visualizer: "npm:^5.9.2" sockette: "npm:^2.0.6" - terser: "npm:^5.22.0" + terser: "npm:^5.23.0" typesafe-i18n: "npm:^5.26.2" typescript: "npm:^5.2.2" vite: "npm:^4.5.0" @@ -7903,9 +7912,9 @@ __metadata: languageName: node linkType: hard -"terser@npm:^5.22.0": - version: 5.22.0 - resolution: "terser@npm:5.22.0" +"terser@npm:^5.23.0": + version: 5.23.0 + resolution: "terser@npm:5.23.0" dependencies: "@jridgewell/source-map": "npm:^0.3.3" acorn: "npm:^8.8.2" @@ -7913,7 +7922,7 @@ __metadata: source-map-support: "npm:~0.5.20" bin: terser: bin/terser - checksum: e5407f9a143e7f9306f1b585b16dbb03df19b93318b55a26b542e12b74cc792dcf6961d9a2cab6778b20d7b591f498c200376d282a300cf9999ca40bccbc047c + checksum: 0a9ffc843cf9ee529b3cb85c4e961fd61dc1d484c462372a7158099c3147c28d8bfe9d57e49d4d7594a9c7deed0a7f28a30f79a9161152bd89791fe986e834f0 languageName: node linkType: hard diff --git a/src/shower.cpp b/src/shower.cpp index ea40bf7fa..09b67d85c 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -113,7 +113,7 @@ void Shower::loop() { doc["timestamp"] = dt; LOG_INFO("shower finished (duration %s)", dt); } else { - LOG_INFO("shower finished (duration %lu s)", duration_); + LOG_INFO("shower finished (duration %lu s)", duration_ / 1000UL); } Mqtt::queue_publish("shower_data", doc.as()); } From 7c3dac3da710b6e89daf7c0ef2a0289a3180f1c2 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 31 Oct 2023 21:57:28 +0100 Subject: [PATCH 05/14] order board profiles in menu --- interface/src/project/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/project/types.ts b/interface/src/project/types.ts index 0e1ff3706..b538f146f 100644 --- a/interface/src/project/types.ts +++ b/interface/src/project/types.ts @@ -238,6 +238,7 @@ type BoardProfiles = { export const BOARD_PROFILES: BoardProfiles = { S32: 'BBQKees Gateway S32', E32: 'BBQKees Gateway E32', + S32S3: 'BBQKees Gateway S3', NODEMCU: 'NodeMCU 32S', 'MH-ET': 'MH-ET Live D1 Mini', LOLIN: 'Lolin D32', @@ -245,8 +246,7 @@ export const BOARD_PROFILES: BoardProfiles = { OLIMEXPOE: 'Olimex ESP32-POE', C3MINI: 'Wemos C3 Mini', S2MINI: 'Wemos S2 Mini', - S3MINI: 'Liligo S3', - S32S3: 'BBQKees Gateway S3' + S3MINI: 'Liligo S3' }; export interface BoardProfile { From 9bf56b2e6d8d792ffedf9c99d8aba013100fabf9 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 31 Oct 2023 21:57:38 +0100 Subject: [PATCH 06/14] package update --- interface/package.json | 4 ++-- interface/yarn.lock | 42 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/interface/package.json b/interface/package.json index c0c804384..51078e8e3 100644 --- a/interface/package.json +++ b/interface/package.json @@ -42,7 +42,7 @@ "react-dom": "latest", "react-dropzone": "^14.2.3", "react-icons": "^4.11.0", - "react-router-dom": "^6.17.0", + "react-router-dom": "^6.18.0", "react-toastify": "^9.1.3", "sockette": "^2.0.6", "typesafe-i18n": "^5.26.2", @@ -68,7 +68,7 @@ "preact": "^10.18.1", "prettier": "^3.0.3", "rollup-plugin-visualizer": "^5.9.2", - "terser": "^5.23.0", + "terser": "^5.24.0", "vite": "^4.5.0", "vite-plugin-imagemin": "^0.6.1", "vite-tsconfig-paths": "^4.2.1" diff --git a/interface/yarn.lock b/interface/yarn.lock index a3abf7a49..eb1bf057d 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1099,10 +1099,10 @@ __metadata: languageName: node linkType: hard -"@remix-run/router@npm:1.10.0": - version: 1.10.0 - resolution: "@remix-run/router@npm:1.10.0" - checksum: 61f5e6374f2d0edd177a61c8a44715290d9197a61362505fb0784f948a39e8353d9604ce3747151f837fc7b950e1fbd71bc797b161643325c545037ffbedd134 +"@remix-run/router@npm:1.11.0": + version: 1.11.0 + resolution: "@remix-run/router@npm:1.11.0" + checksum: 629ec578b9dfd3c5cb5de64a0798dd7846ec5ba0351aa66f42b1c65efb43da8f30366be59b825303648965b0df55b638c110949b24ef94fd62e98117fdfb0c0f languageName: node linkType: hard @@ -1576,11 +1576,11 @@ __metadata: react-dom: "npm:latest" react-dropzone: "npm:^14.2.3" react-icons: "npm:^4.11.0" - react-router-dom: "npm:^6.17.0" + react-router-dom: "npm:^6.18.0" react-toastify: "npm:^9.1.3" rollup-plugin-visualizer: "npm:^5.9.2" sockette: "npm:^2.0.6" - terser: "npm:^5.23.0" + terser: "npm:^5.24.0" typesafe-i18n: "npm:^5.26.2" typescript: "npm:^5.2.2" vite: "npm:^4.5.0" @@ -6828,27 +6828,27 @@ __metadata: languageName: node linkType: hard -"react-router-dom@npm:^6.17.0": - version: 6.17.0 - resolution: "react-router-dom@npm:6.17.0" +"react-router-dom@npm:^6.18.0": + version: 6.18.0 + resolution: "react-router-dom@npm:6.18.0" dependencies: - "@remix-run/router": "npm:1.10.0" - react-router: "npm:6.17.0" + "@remix-run/router": "npm:1.11.0" + react-router: "npm:6.18.0" peerDependencies: react: ">=16.8" react-dom: ">=16.8" - checksum: fc881346af12cdfc4f709c6ca91090d5ed62362154a398a0e8c2b19daabee1fbc8a3ddd0ab727e743ea4268b87f3b2ebc3251c730e2c190ee3ab286059f523e5 + checksum: b0e72603d73172b6c6662afe2faed326753d5bbd9905aa560e3dade7996fc13d19e34e3ed668d2849efd685e2db2f711129c84b1439870e92c9cc91ddc343cf5 languageName: node linkType: hard -"react-router@npm:6.17.0": - version: 6.17.0 - resolution: "react-router@npm:6.17.0" +"react-router@npm:6.18.0": + version: 6.18.0 + resolution: "react-router@npm:6.18.0" dependencies: - "@remix-run/router": "npm:1.10.0" + "@remix-run/router": "npm:1.11.0" peerDependencies: react: ">=16.8" - checksum: 5c589c67b53cc1a210bd08285392e951a2c3d51a2502806f68d9ce604307944239b0a3b766d8390b484d707ace3068af858e999a1c242662b917ddcd4ab3c453 + checksum: a00c8f347b7ffee575f4a7731782e688e3fca458ca5bd970fb41cef66a6851853caa24464155ab438d5879f367b1223a539642a405a865913ffe7e63e53b1245 languageName: node linkType: hard @@ -7912,9 +7912,9 @@ __metadata: languageName: node linkType: hard -"terser@npm:^5.23.0": - version: 5.23.0 - resolution: "terser@npm:5.23.0" +"terser@npm:^5.24.0": + version: 5.24.0 + resolution: "terser@npm:5.24.0" dependencies: "@jridgewell/source-map": "npm:^0.3.3" acorn: "npm:^8.8.2" @@ -7922,7 +7922,7 @@ __metadata: source-map-support: "npm:~0.5.20" bin: terser: bin/terser - checksum: 0a9ffc843cf9ee529b3cb85c4e961fd61dc1d484c462372a7158099c3147c28d8bfe9d57e49d4d7594a9c7deed0a7f28a30f79a9161152bd89791fe986e834f0 + checksum: bd7ba6bfef58f8c179592894923c8c933d980e17287d3f2a9927550be853d1601beebb724cf015929599b32945641c44f9c3db8dd242c7933af3830bcb853510 languageName: node linkType: hard From 89d591500c08c15ec60fa7c700ee9240dc367ebd Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 31 Oct 2023 21:58:07 +0100 Subject: [PATCH 07/14] support HA writable text fields --- src/mqtt.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 3248dfb24..dc5b3f133 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -472,6 +472,7 @@ void Mqtt::on_disconnect(espMqttClientTypes::DisconnectReason reason) { } else { LOG_WARNING("MQTT disconnected: code %d", reason); } + mqttClient_->clearQueue(true); } // MQTT on_connect - when an MQTT connect is established @@ -589,7 +590,7 @@ bool Mqtt::queue_message(const uint8_t operation, const std::string & topic, con return true; } } - if (!mqtt_enabled_ || topic.empty()) { + if (!mqtt_enabled_ || topic.empty() || !connected()) { return false; // quit, not using MQTT } // check free mem @@ -847,10 +848,11 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev bool set_ha_classes = false; // set to true if we want to set the state class and device class - // create the topic, depending on the type and whether the device entity is writable (a command) + // create the topic + // depending on the type and whether the device entity is writable (a command) // https://developers.home-assistant.io/docs/core/entity char topic[MQTT_TOPIC_MAX_SIZE]; - // if it's a command then we can use Number, Switch, Select. Otherwise stick to Sensor + // if it's a command then we can use Number, Switch, Select or Text. Otherwise stick to Sensor if (has_cmd) { switch (type) { case DeviceValueType::INT: @@ -877,6 +879,10 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev snprintf(topic, sizeof(topic), "sensor/%s", config_topic); set_ha_classes = true; break; + case DeviceValueType::STRING: + snprintf(topic, sizeof(topic), "text/%s", config_topic); // e.g. set_datetime, set_holiday, set_wwswitchtime + set_ha_classes = true; + break; default: // plain old sensor snprintf(topic, sizeof(topic), "sensor/%s", config_topic); @@ -910,12 +916,10 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev char sample_val[30] = "0"; // sample, correct(!) entity value, used only to prevent warning/error in HA if real value is not published yet - // handle commands, which are device entities that are writable - // we add the command topic parameter - // note: there is no way to handle strings in HA so datetimes (e.g. set_datetime, set_holiday, set_wwswitchtime etc) are excluded + // we add the command topic parameter for commands if (has_cmd) { - // command topic back to EMS-ESP char command_topic[MQTT_TOPIC_MAX_SIZE]; + // add command topic if (tag >= DeviceValueTAG::TAG_HC1) { snprintf(command_topic, sizeof(command_topic), "%s/%s/%s/%s", mqtt_basename_.c_str(), device_name, EMSdevice::tag_to_mqtt(tag), entity); } else { @@ -923,7 +927,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev } doc["cmd_t"] = command_topic; - // for enums, add options + // extend for enums, add options if (type == DeviceValueType::ENUM) { JsonArray option_list = doc.createNestedArray("ops"); // options if (EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX) { @@ -941,7 +945,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev } } else if (type != DeviceValueType::STRING && type != DeviceValueType::BOOL) { - // Must be Numeric.... + // For numeric's add the range doc["mode"] = "box"; // auto, slider or box if (num_op > 0) { doc["step"] = 1.0 / num_op; @@ -1306,5 +1310,4 @@ void Mqtt::add_avty_to_doc(const char * state_t, const JsonObject & doc, const c doc["avty_mode"] = "all"; } - -} // namespace emsesp +} // namespace emsesp \ No newline at end of file From 33ac89e202bbe5639fba1cfff86cb576ce90280f Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 31 Oct 2023 21:58:19 +0100 Subject: [PATCH 08/14] uppercase Value --- interface/src/project/DashboardDevicesDialog.tsx | 6 +++--- interface/src/project/DashboardSensorsAnalogDialog.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/src/project/DashboardDevicesDialog.tsx b/interface/src/project/DashboardDevicesDialog.tsx index 25449b382..aab6fa30d 100644 --- a/interface/src/project/DashboardDevicesDialog.tsx +++ b/interface/src/project/DashboardDevicesDialog.tsx @@ -114,7 +114,7 @@ const DashboardDevicesDialog = ({ {editItem.l ? ( Date: Sat, 4 Nov 2023 11:46:16 +0100 Subject: [PATCH 09/14] package update --- interface/package.json | 8 +-- interface/yarn.lock | 138 +++++++++++++++++++++-------------------- 2 files changed, 75 insertions(+), 71 deletions(-) diff --git a/interface/package.json b/interface/package.json index 51078e8e3..702e68c46 100644 --- a/interface/package.json +++ b/interface/package.json @@ -29,7 +29,7 @@ "@types/imagemin": "^8.0.3", "@types/lodash-es": "^4.17.10", "@types/node": "^20.8.10", - "@types/react": "^18.2.33", + "@types/react": "^18.2.34", "@types/react-dom": "^18.2.14", "@types/react-router-dom": "^5.3.3", "alova": "^2.13.1", @@ -54,18 +54,18 @@ "@typescript-eslint/eslint-plugin": "^6.9.1", "@typescript-eslint/parser": "^6.9.1", "concurrently": "^8.2.2", - "eslint": "^8.52.0", + "eslint": "^8.53.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-autofix": "^1.1.0", "eslint-plugin-import": "^2.29.0", - "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-prettier": "alpha", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", - "preact": "^10.18.1", + "preact": "^10.18.2", "prettier": "^3.0.3", "rollup-plugin-visualizer": "^5.9.2", "terser": "^5.24.0", diff --git a/interface/yarn.lock b/interface/yarn.lock index eb1bf057d..8d8492cc3 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -267,7 +267,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.7": +"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.7": version: 7.23.2 resolution: "@babel/runtime@npm:7.23.2" dependencies: @@ -641,9 +641,9 @@ __metadata: languageName: node linkType: hard -"@eslint/eslintrc@npm:^2.1.2": - version: 2.1.2 - resolution: "@eslint/eslintrc@npm:2.1.2" +"@eslint/eslintrc@npm:^2.1.3": + version: 2.1.3 + resolution: "@eslint/eslintrc@npm:2.1.3" dependencies: ajv: "npm:^6.12.4" debug: "npm:^4.3.2" @@ -654,14 +654,14 @@ __metadata: js-yaml: "npm:^4.1.0" minimatch: "npm:^3.1.2" strip-json-comments: "npm:^3.1.1" - checksum: fa25638f2666cac6810f98ee7d0f4b912f191806467c1b40d72bac759fffef0b3357f12a1869817286837b258e4de3517e0c7408520e156ca860fc53a1fbaed9 + checksum: 77b70a89232fe702c2f765b5b92970f5e4224b55363b923238b996c66fcd991504f40d3663c0543ae17d6c5049ab9b07ab90b65d7601e6f25e8bcd4caf69ac75 languageName: node linkType: hard -"@eslint/js@npm:8.52.0": - version: 8.52.0 - resolution: "@eslint/js@npm:8.52.0" - checksum: 86beff213d0ae4ced203a922b74e2cc4d767d109e7815f985bf648946ba072198977102e32afc9fa04f7825a6de83a831874f6b6675ba0c1d0743ade2dc2d53d +"@eslint/js@npm:8.53.0": + version: 8.53.0 + resolution: "@eslint/js@npm:8.53.0" + checksum: a372d55aa2bbe0d9399acc8de3c892dcfe507fd914d29fde6826ae54a13452619be626aa7eb70b1ec4d4da5302b6ed8e8ac9bf1f830003f15c0ad56c30b4f520 languageName: node linkType: hard @@ -1359,7 +1359,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:^18.2.33": +"@types/react@npm:*": version: 18.2.33 resolution: "@types/react@npm:18.2.33" dependencies: @@ -1370,6 +1370,17 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:^18.2.34": + version: 18.2.34 + resolution: "@types/react@npm:18.2.34" + dependencies: + "@types/prop-types": "npm:*" + "@types/scheduler": "npm:*" + csstype: "npm:^3.0.2" + checksum: 6d16f86b384e829edc3710b1dd9ec4eb1d6b26bc079c5cf605bd0cbf77ae6224f15c76949afadb7f53df4544cfe4025c1111fbe36732cd7f660a320fbc2e5866 + languageName: node + linkType: hard + "@types/responselike@npm:^1.0.0": version: 1.0.2 resolution: "@types/responselike@npm:1.0.2" @@ -1547,7 +1558,7 @@ __metadata: "@types/imagemin": "npm:^8.0.3" "@types/lodash-es": "npm:^4.17.10" "@types/node": "npm:^20.8.10" - "@types/react": "npm:^18.2.33" + "@types/react": "npm:^18.2.34" "@types/react-dom": "npm:^18.2.14" "@types/react-router-dom": "npm:^5.3.3" "@typescript-eslint/eslint-plugin": "npm:^6.9.1" @@ -1555,14 +1566,14 @@ __metadata: alova: "npm:^2.13.1" async-validator: "npm:^4.2.5" concurrently: "npm:^8.2.2" - eslint: "npm:^8.52.0" + eslint: "npm:^8.53.0" eslint-config-airbnb: "npm:^19.0.4" eslint-config-airbnb-typescript: "npm:^17.1.0" eslint-config-prettier: "npm:^9.0.0" eslint-import-resolver-typescript: "npm:^3.6.1" eslint-plugin-autofix: "npm:^1.1.0" eslint-plugin-import: "npm:^2.29.0" - eslint-plugin-jsx-a11y: "npm:^6.7.1" + eslint-plugin-jsx-a11y: "npm:^6.8.0" eslint-plugin-prettier: "npm:alpha" eslint-plugin-react: "npm:^7.33.2" eslint-plugin-react-hooks: "npm:^4.6.0" @@ -1570,7 +1581,7 @@ __metadata: jwt-decode: "npm:^4.0.0" lodash-es: "npm:^4.17.21" mime-types: "npm:^2.1.35" - preact: "npm:^10.18.1" + preact: "npm:^10.18.2" prettier: "npm:^3.0.3" react: "npm:latest" react-dom: "npm:latest" @@ -1754,7 +1765,7 @@ __metadata: languageName: node linkType: hard -"aria-query@npm:^5.1.3": +"aria-query@npm:^5.3.0": version: 5.3.0 resolution: "aria-query@npm:5.3.0" dependencies: @@ -1865,10 +1876,10 @@ __metadata: languageName: node linkType: hard -"ast-types-flow@npm:^0.0.7": - version: 0.0.7 - resolution: "ast-types-flow@npm:0.0.7" - checksum: 663b90e99b56ee2d7f736a6b6fff8b3c5404f28fa1860bb8d83ee5a9bff9e687520d0d6d9db6edff5a34fd4d3c0c11a3beb1cf75e43c9a880cca04371cc99808 +"ast-types-flow@npm:^0.0.8": + version: 0.0.8 + resolution: "ast-types-flow@npm:0.0.8" + checksum: 85a1c24af4707871c27cfe456bd2ff7fcbe678f3d1c878ac968c9557735a171a17bdcc8c8f903ceab3fc3c49d5b3da2194e6ab0a6be7fec0e133fa028f21ba1b languageName: node linkType: hard @@ -1902,14 +1913,14 @@ __metadata: languageName: node linkType: hard -"axe-core@npm:^4.6.2": - version: 4.8.2 - resolution: "axe-core@npm:4.8.2" - checksum: 3e8dbf264a57767713daa77fe04bbabd71a956b08b99c2eb0ec61b75852f21190653f557d2da623dea9e0a7555460deaac71d9f6a9125c0b52576f8581bfbe52 +"axe-core@npm:=4.7.0": + version: 4.7.0 + resolution: "axe-core@npm:4.7.0" + checksum: 615c0f7722c3c9fcf353dbd70b00e2ceae234d4c17cbc839dd85c01d16797c4e4da45f8d27c6118e9e6b033fb06efd196106e13651a1b2f3a10e0f11c7b2f660 languageName: node linkType: hard -"axobject-query@npm:^3.1.1": +"axobject-query@npm:^3.2.1": version: 3.2.1 resolution: "axobject-query@npm:3.2.1" dependencies: @@ -3034,7 +3045,7 @@ __metadata: languageName: node linkType: hard -"es-iterator-helpers@npm:^1.0.12": +"es-iterator-helpers@npm:^1.0.12, es-iterator-helpers@npm:^1.0.15": version: 1.0.15 resolution: "es-iterator-helpers@npm:1.0.15" dependencies: @@ -3539,29 +3550,29 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-jsx-a11y@npm:^6.7.1": - version: 6.7.1 - resolution: "eslint-plugin-jsx-a11y@npm:6.7.1" +"eslint-plugin-jsx-a11y@npm:^6.8.0": + version: 6.8.0 + resolution: "eslint-plugin-jsx-a11y@npm:6.8.0" dependencies: - "@babel/runtime": "npm:^7.20.7" - aria-query: "npm:^5.1.3" - array-includes: "npm:^3.1.6" - array.prototype.flatmap: "npm:^1.3.1" - ast-types-flow: "npm:^0.0.7" - axe-core: "npm:^4.6.2" - axobject-query: "npm:^3.1.1" + "@babel/runtime": "npm:^7.23.2" + aria-query: "npm:^5.3.0" + array-includes: "npm:^3.1.7" + array.prototype.flatmap: "npm:^1.3.2" + ast-types-flow: "npm:^0.0.8" + axe-core: "npm:=4.7.0" + axobject-query: "npm:^3.2.1" damerau-levenshtein: "npm:^1.0.8" emoji-regex: "npm:^9.2.2" - has: "npm:^1.0.3" - jsx-ast-utils: "npm:^3.3.3" - language-tags: "npm:=1.0.5" + es-iterator-helpers: "npm:^1.0.15" + hasown: "npm:^2.0.0" + jsx-ast-utils: "npm:^3.3.5" + language-tags: "npm:^1.0.9" minimatch: "npm:^3.1.2" - object.entries: "npm:^1.1.6" - object.fromentries: "npm:^2.0.6" - semver: "npm:^6.3.0" + object.entries: "npm:^1.1.7" + object.fromentries: "npm:^2.0.7" peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 - checksum: b7eb451304dc27c9552649a716be1de3b5d577f39e53f6da6a2dac084b84b349b0224be3020439f99c2b3bf417a13c5591326f1ce6af8d74f1cb5d5d95c4222b + checksum: 7a8e4498531a43d988ce2f12502a3f5ce96eacfec13f956cf927f24bb041b724fb7fc0f0306ea19d143bfc79e138bf25e25acca0822847206ac6bf5ce095e846 languageName: node linkType: hard @@ -3643,14 +3654,14 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.52.0": - version: 8.52.0 - resolution: "eslint@npm:8.52.0" +"eslint@npm:^8.53.0": + version: 8.53.0 + resolution: "eslint@npm:8.53.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.2.0" "@eslint-community/regexpp": "npm:^4.6.1" - "@eslint/eslintrc": "npm:^2.1.2" - "@eslint/js": "npm:8.52.0" + "@eslint/eslintrc": "npm:^2.1.3" + "@eslint/js": "npm:8.53.0" "@humanwhocodes/config-array": "npm:^0.11.13" "@humanwhocodes/module-importer": "npm:^1.0.1" "@nodelib/fs.walk": "npm:^1.2.8" @@ -3687,7 +3698,7 @@ __metadata: text-table: "npm:^0.2.0" bin: eslint: bin/eslint.js - checksum: 01784ab15351d749bc95446039ed7acd5124f7cc84acdbf98c7199272eae06212a8f3ea4a9b47e7cc54ab17ca094c3a664bbfc3002c7de27936220e278b5028a + checksum: e305a71ce2b9a8631b293266fe53e346c76f28bc8d004af33f10e537cf133db1fb87af3599376e70ed6e0f89a78be10c4f08ddd0c1c9c0c497cd143b4a270420 languageName: node linkType: hard @@ -4625,13 +4636,6 @@ __metadata: languageName: node linkType: hard -"has@npm:^1.0.3": - version: 1.0.4 - resolution: "has@npm:1.0.4" - checksum: c245f332fe78c7b6b8753857240ac12b3286f995f656a33c77e0f5baab7d0157e6ddb1c34940ffd2bffc51f75ede50cd8b29ff65c13e336376aca8cf3df58043 - languageName: node - linkType: hard - "hasown@npm:^2.0.0": version: 2.0.0 resolution: "hasown@npm:2.0.0" @@ -5493,7 +5497,7 @@ __metadata: languageName: node linkType: hard -"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.3": +"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.5": version: 3.3.5 resolution: "jsx-ast-utils@npm:3.3.5" dependencies: @@ -5544,19 +5548,19 @@ __metadata: languageName: node linkType: hard -"language-subtag-registry@npm:~0.3.2": +"language-subtag-registry@npm:^0.3.20": version: 0.3.22 resolution: "language-subtag-registry@npm:0.3.22" checksum: 5591f4abd775d1ab5945355a5ba894327d2d94c900607bdb69aac1bc5bb921dbeeeb5f616df95e8c0ae875501d19c1cfa0e852ece822121e95048deb34f2b4d2 languageName: node linkType: hard -"language-tags@npm:=1.0.5": - version: 1.0.5 - resolution: "language-tags@npm:1.0.5" +"language-tags@npm:^1.0.9": + version: 1.0.9 + resolution: "language-tags@npm:1.0.9" dependencies: - language-subtag-registry: "npm:~0.3.2" - checksum: 2161292ddae73ff2f5a15fd2d753b21096b81324337dff4ad78d702c63210d5beb18892cd53a3455ee6e88065807c8e285e82c40503678951d2071d101a473b4 + language-subtag-registry: "npm:^0.3.20" + checksum: d3a7c14b694e67f519153d6df6cb200681648d38d623c3bfa9d6a66a5ec5493628acb88e9df5aceef3cf1902ab263a205e7d59ee4cf1d6bb67e707b83538bd6d languageName: node linkType: hard @@ -6196,7 +6200,7 @@ __metadata: languageName: node linkType: hard -"object.entries@npm:^1.1.5, object.entries@npm:^1.1.6": +"object.entries@npm:^1.1.5, object.entries@npm:^1.1.6, object.entries@npm:^1.1.7": version: 1.1.7 resolution: "object.entries@npm:1.1.7" dependencies: @@ -6657,10 +6661,10 @@ __metadata: languageName: node linkType: hard -"preact@npm:^10.18.1": - version: 10.18.1 - resolution: "preact@npm:10.18.1" - checksum: 587c4634b310efc306ef9315f849b8e4ff538435087a1dca626e1394b98570af1ecdc254b7f0bb3060fc7ab87456c5f891f9b8a167d5c34dbbcfcf60b6e993f4 +"preact@npm:^10.18.2": + version: 10.18.2 + resolution: "preact@npm:10.18.2" + checksum: c7dcd6ea812adb0bdc215366b14aadc44724b6dd6c4e9aadd986126d94abde62f3e02e18d6157a9984873be9877f206c0afa10a09346178c4c828a103a66a0e1 languageName: node linkType: hard From cd564f0c5429ba3a2e8cd5cab5008a593ea3d688 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sat, 4 Nov 2023 11:46:42 +0100 Subject: [PATCH 10/14] no commands for nrgheat & nrgww - #1382 --- src/mqtt.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index dc5b3f133..1cb53908a 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -753,7 +753,8 @@ bool Mqtt::publish_ha_sensor_config(DeviceValue & dv, const char * model, const // determine if we're creating the command topics which we use special HA configs // unless the entity has been marked as read-only and so it'll default to using the sensor/ type - bool has_cmd = dv.has_cmd && !dv.has_state(DeviceValueState::DV_READONLY); + // or we're dealing with Energy sensors that must have "diagnostic" as an entity category (e.g. negheat & nrgww) + bool has_cmd = dv.has_cmd && !dv.has_state(DeviceValueState::DV_READONLY) && (dv.uom != DeviceValueUOM::KWH); return publish_ha_sensor_config(dv.type, dv.tag, @@ -1080,11 +1081,11 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev } else { doc[sc_ha] = F_(measurement); } - doc[dc_ha] = "energy"; // no icon needed + doc[dc_ha] = "energy"; break; case DeviceValueUOM::KWH: doc[sc_ha] = F_(total_increasing); - doc[dc_ha] = "energy"; // no icon needed + doc[dc_ha] = "energy"; break; case DeviceValueUOM::UA: doc[ic_ha] = F_(iconua); @@ -1128,8 +1129,9 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev } } - // add category "diagnostic" for system entities - // config for writeable entities, like switches. diagnostic for read only sensors. + // add category + // "config" for writeable entities, like switch, number, text, select + // "diagnostic" for read only sensors doc["ent_cat"] = (has_cmd) ? "config" : "diagnostic"; // add the dev json object to the end From a449ebd0ea85c830d0563af0c5e8a5d42e6ab7db Mon Sep 17 00:00:00 2001 From: Proddy Date: Sat, 4 Nov 2023 13:13:52 +0100 Subject: [PATCH 11/14] improvements to #1382 --- src/mqtt.cpp | 62 ++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 1cb53908a..bf9a9fad9 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -847,7 +847,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev char config_topic[70]; snprintf(config_topic, sizeof(config_topic), "%s/%s_%s/config", mqtt_basename_.c_str(), device_name, entity_with_tag); - bool set_ha_classes = false; // set to true if we want to set the state class and device class + bool readonly_sensors = true; // create the topic // depending on the type and whether the device entity is writable (a command) @@ -860,43 +860,41 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev case DeviceValueType::UINT: case DeviceValueType::SHORT: case DeviceValueType::USHORT: + case DeviceValueType::ULONG: + // number - https://www.home-assistant.io/integrations/number.mqtt + // Domoticz does not support number, use sensor if (discovery_type() == discoveryType::HOMEASSISTANT) { - // number - https://www.home-assistant.io/integrations/number.mqtt snprintf(topic, sizeof(topic), "number/%s", config_topic); + readonly_sensors = false; } else { - // Domoticz does not support number, use sensor snprintf(topic, sizeof(topic), "sensor/%s", config_topic); } break; case DeviceValueType::BOOL: // switch - https://www.home-assistant.io/integrations/switch.mqtt snprintf(topic, sizeof(topic), "switch/%s", config_topic); + readonly_sensors = false; break; case DeviceValueType::ENUM: // select - https://www.home-assistant.io/integrations/select.mqtt snprintf(topic, sizeof(topic), "select/%s", config_topic); - break; - case DeviceValueType::ULONG: - snprintf(topic, sizeof(topic), "sensor/%s", config_topic); - set_ha_classes = true; + readonly_sensors = false; break; case DeviceValueType::STRING: + // text - https://www.home-assistant.io/integrations/text.mqtt snprintf(topic, sizeof(topic), "text/%s", config_topic); // e.g. set_datetime, set_holiday, set_wwswitchtime - set_ha_classes = true; + readonly_sensors = false; break; default: - // plain old sensor - snprintf(topic, sizeof(topic), "sensor/%s", config_topic); + // plain old sensor, and make read-only break; } - } else { - set_ha_classes = true; // these are Read only sensors. We can set the device class and state class - // plain old read only device entity - if (type == DeviceValueType::BOOL) { - snprintf(topic, sizeof(topic), "binary_sensor/%s", config_topic); // binary sensor (for booleans) - } else { - snprintf(topic, sizeof(topic), "sensor/%s", config_topic); // normal HA sensor - } + } + + // For read-only sensors there are either sensor or binary_sensor + // for both we also set the device class and state class + if (readonly_sensors) { + snprintf(topic, sizeof(topic), (type == DeviceValueType::BOOL) ? "binary_sensor/%s" : "sensor/%s", config_topic); // binary sensor (for booleans) } // if we're asking to remove this topic, send an empty payload and exit @@ -912,13 +910,15 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev doc["obj_id"] = uniq_id; // same as unique_id const char * ic_ha = "ic"; // icon - only set this if there is no device class - const char * sc_ha = "stat_cla"; // state class const char * uom_ha = "unit_of_meas"; // unit of measure char sample_val[30] = "0"; // sample, correct(!) entity value, used only to prevent warning/error in HA if real value is not published yet // we add the command topic parameter for commands if (has_cmd) { + // add category + doc["ent_cat"] = "config"; // for writeable entities, like switch, number, text, select + char command_topic[MQTT_TOPIC_MAX_SIZE]; // add command topic if (tag >= DeviceValueTAG::TAG_HC1) { @@ -1040,12 +1040,16 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev doc[uom_ha] = EMSdevice::uom_to_string(uom); // default } } + doc["val_tpl"] = (std::string) "{{" + val_obj + " if " + val_cond + " else " + sample_val + "}}"; - // this next section is adding the state class, device class and sometimes the icon - // used for Sensor and Binary Sensor Entities in HA - if (set_ha_classes) { - const char * dc_ha = "dev_cla"; // device class + // Add the state class, device class and sometimes the icon. Used only for read-only sensors Sensor and Binary Sensor + if (readonly_sensors) { + // first set the catagory + doc["ent_cat"] = "diagnostic"; + + const char * dc_ha = "dev_cla"; // device class + const char * sc_ha = "stat_cla"; // state class switch (uom) { case DeviceValueUOM::DEGREES: @@ -1129,16 +1133,8 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev } } - // add category - // "config" for writeable entities, like switch, number, text, select - // "diagnostic" for read only sensors - doc["ent_cat"] = (has_cmd) ? "config" : "diagnostic"; - - // add the dev json object to the end - doc["dev"] = dev_json; - - // add "availability" section - add_avty_to_doc(stat_t, doc.as(), val_cond); + doc["dev"] = dev_json; // add the dev json object to the end + add_avty_to_doc(stat_t, doc.as(), val_cond); // add "availability" section return queue_ha(topic, doc.as()); } From 2a8d3b8cd6eb0dfaa63582eb6929aa39d2cf8137 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 5 Nov 2023 17:12:21 +0100 Subject: [PATCH 12/14] package update --- interface/package.json | 2 +- interface/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/package.json b/interface/package.json index 702e68c46..55aa635ae 100644 --- a/interface/package.json +++ b/interface/package.json @@ -29,7 +29,7 @@ "@types/imagemin": "^8.0.3", "@types/lodash-es": "^4.17.10", "@types/node": "^20.8.10", - "@types/react": "^18.2.34", + "@types/react": "^18.2.35", "@types/react-dom": "^18.2.14", "@types/react-router-dom": "^5.3.3", "alova": "^2.13.1", diff --git a/interface/yarn.lock b/interface/yarn.lock index 8d8492cc3..8aaf2043c 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1370,14 +1370,14 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:^18.2.34": - version: 18.2.34 - resolution: "@types/react@npm:18.2.34" +"@types/react@npm:^18.2.35": + version: 18.2.35 + resolution: "@types/react@npm:18.2.35" dependencies: "@types/prop-types": "npm:*" "@types/scheduler": "npm:*" csstype: "npm:^3.0.2" - checksum: 6d16f86b384e829edc3710b1dd9ec4eb1d6b26bc079c5cf605bd0cbf77ae6224f15c76949afadb7f53df4544cfe4025c1111fbe36732cd7f660a320fbc2e5866 + checksum: 3c8c752d21856f74ddb96b9dd13cdd70c0ce1522808f20511f0220f392ea727fae9388db4da3ebe317d9bac98a0d930566d4277b22e92c1cad414429739e1d76 languageName: node linkType: hard @@ -1558,7 +1558,7 @@ __metadata: "@types/imagemin": "npm:^8.0.3" "@types/lodash-es": "npm:^4.17.10" "@types/node": "npm:^20.8.10" - "@types/react": "npm:^18.2.34" + "@types/react": "npm:^18.2.35" "@types/react-dom": "npm:^18.2.14" "@types/react-router-dom": "npm:^5.3.3" "@typescript-eslint/eslint-plugin": "npm:^6.9.1" From c4c9ed739f81737bc16cc09a8b82ae25795b6d73 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 5 Nov 2023 17:12:35 +0100 Subject: [PATCH 13/14] 3.6.3-dev.6 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 4c07d89fc..20dd49e31 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.6.3-dev.5" +#define EMSESP_APP_VERSION "3.6.3-dev.6" From 3f913777513418f5423cdbc5d504509a3527c5a4 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 5 Nov 2023 17:12:43 +0100 Subject: [PATCH 14/14] added notes on MQTT changes --- CHANGELOG_LATEST.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 8cfdd7c5e..13dd3156c 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -4,6 +4,8 @@ ## **IMPORTANT! BREAKING CHANGES** +Writeable Text entities have moved from type `sensor` to `text` in Home Assistant to make them also editable within an HA dashboard. Examples are `datetime`, `holidays`, `switchtime`, `vacations`, `maintenancedate`...). You will need to manually remove any old discovery topics from your MQTT broker using an application like MQTT Explorer. + ## Added - humidity for ventilation devices @@ -11,6 +13,7 @@ - names for BC400, GB192i, read temperatures for low loss header and heatblock [#1317](https://github.com/emsesp/EMS-ESP32/discussions/1317) - option for `forceheatingoff` [#1262](https://github.com/emsesp/EMS-ESP32/issues/1262) - shower_data MQTT payload contains the timestamp [#1329](https://github.com/emsesp/EMS-ESP32/issues/1329) +- HA discovery for writeable text entities [#1337](https://github.com/emsesp/EMS-ESP32/pull/1377) ## Fixed