From 4734a81fdb91f8dab2108cbb06b69a0a1f05f427 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:35:08 +0100 Subject: [PATCH 01/11] add airbypass --- docs/Modbus-Entity-Registers.md | 1 + docs/dump_entities.csv | 1 + project-words.txt | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/Modbus-Entity-Registers.md b/docs/Modbus-Entity-Registers.md index 585d3616b..11925205f 100644 --- a/docs/Modbus-Entity-Registers.md +++ b/docs/Modbus-Entity-Registers.md @@ -5604,6 +5604,7 @@ | ventmode | ventilation mode | enum [auto\|off\|L1\|L2\|L3\|L4\|demand\|sleep\|intense\|bypass\|party\|fireplace] | | true | DEVICE_DATA | 6 | 1 | 1 | | airquality | air quality (voc) | uint16 (>=0<=31999) | | false | DEVICE_DATA | 7 | 1 | 1 | | airhumidity | relative air humidity | uint8 (>=0<=100) | % | false | DEVICE_DATA | 8 | 1 | 1 | +| bypass | bypass | boolean | | true | DEVICE_DATA | 9 | 1 | 1 | ## Devices of type *water* ### IPM diff --git a/docs/dump_entities.csv b/docs/dump_entities.csv index 4dc412909..1fd848ecd 100644 --- a/docs/dump_entities.csv +++ b/docs/dump_entities.csv @@ -5214,6 +5214,7 @@ device name,device type,product id,shortname,fullname,type [options...] \| (min/ "Logavent HRV176",ventilation,231,ventmode,ventilation mode,enum [auto\|off\|L1\|L2\|L3\|L4\|demand\|sleep\|intense\|bypass\|party\|fireplace], ,true,select.ventilation_ventilation_mode,select.ventilation_ventmode,18,0,1,6,1 "Logavent HRV176",ventilation,231,airquality,air quality (voc),uint16 (>=0<=31999), ,false,sensor.ventilation_air_quality_(voc),sensor.ventilation_airquality,18,0,1,7,1 "Logavent HRV176",ventilation,231,airhumidity,relative air humidity,uint8 (>=0<=100),%,false,sensor.ventilation_relative_air_humidity,sensor.ventilation_airhumidity,18,0,1,8,1 +"Logavent HRV176",ventilation,231,bypass,bypass,boolean, ,true,switch.ventilation_bypass,switch.ventilation_bypass,18,0,1,9,1 "IPM",water,100,dhw.seltemp,selected temperature,uint8 (>=0<=254),C,true,number.water_dhw_selected_temperature,number.water_dhw_seltemp,19,9,1,0,1 "IPM",water,100,dhw.temp,current temperature,uint16 (>=0<=3199),C,false,sensor.water_dhw_current_temperature,sensor.water_dhw_temp,19,9,1/10,1,1 "IPM",water,100,dhw.curtemp2,current extern temperature,uint16 (>=0<=3199),C,false,sensor.water_dhw_current_extern_temperature,sensor.water_dhw_curtemp2,19,9,1/10,2,1 diff --git a/project-words.txt b/project-words.txt index 5593827cd..fb9560230 100644 --- a/project-words.txt +++ b/project-words.txt @@ -1411,4 +1411,5 @@ solarinfl currsolarinfl temprature bblanchon -vacationmode \ No newline at end of file +vacationmode +airbypass \ No newline at end of file From dceafe65a75041fdf7fccebd5d895ef6d0dadb1d Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:35:18 +0100 Subject: [PATCH 02/11] formatting --- interface/src/app/settings/Version.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/src/app/settings/Version.tsx b/interface/src/app/settings/Version.tsx index e04cc9abe..179068798 100644 --- a/interface/src/app/settings/Version.tsx +++ b/interface/src/app/settings/Version.tsx @@ -140,7 +140,9 @@ const Version = () => { - {LL.INSTALL_VERSION(usingDevVersion ? latestDevVersion?.name : latestVersion?.name)} + {LL.INSTALL_VERSION( + usingDevVersion ? latestDevVersion?.name : latestVersion?.name + )} From ab80c82a221ff1dea20997ee1645f6fc7adb4d92 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:35:37 +0100 Subject: [PATCH 03/11] package update --- interface/package.json | 8 +- interface/yarn.lock | 295 ++++++++++++++++++++--------------------- mock-api/package.json | 4 +- mock-api/yarn.lock | 20 +-- 4 files changed, 159 insertions(+), 168 deletions(-) diff --git a/interface/package.json b/interface/package.json index db223f225..a58f04962 100644 --- a/interface/package.json +++ b/interface/package.json @@ -42,19 +42,19 @@ }, "devDependencies": { "@babel/core": "^7.26.9", - "@eslint/js": "^9.20.0", + "@eslint/js": "^9.21.0", "@preact/compat": "^18.3.1", "@preact/preset-vite": "^2.10.1", "@trivago/prettier-plugin-sort-imports": "^5.2.2", "@types/formidable": "^3", - "@types/node": "^22.13.4", + "@types/node": "^22.13.5", "@types/react": "^19.0.10", "@types/react-dom": "^19.0.4", "concurrently": "^9.1.2", - "eslint": "^9.20.1", + "eslint": "^9.21.0", "eslint-config-prettier": "^10.0.1", "formidable": "^3.5.2", - "prettier": "^3.5.1", + "prettier": "^3.5.2", "rollup-plugin-visualizer": "^5.14.0", "terser": "^5.39.0", "typescript-eslint": "8.24.1", diff --git a/interface/yarn.lock b/interface/yarn.lock index 952025504..35deac78f 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -609,7 +609,7 @@ __metadata: languageName: node linkType: hard -"@eslint/config-array@npm:^0.19.0": +"@eslint/config-array@npm:^0.19.2": version: 0.19.2 resolution: "@eslint/config-array@npm:0.19.2" dependencies: @@ -620,27 +620,18 @@ __metadata: languageName: node linkType: hard -"@eslint/core@npm:^0.10.0": - version: 0.10.0 - resolution: "@eslint/core@npm:0.10.0" +"@eslint/core@npm:^0.12.0": + version: 0.12.0 + resolution: "@eslint/core@npm:0.12.0" dependencies: "@types/json-schema": "npm:^7.0.15" - checksum: 10c0/074018075079b3ed1f14fab9d116f11a8824cdfae3e822badf7ad546962fafe717a31e61459bad8cc59cf7070dc413ea9064ddb75c114f05b05921029cde0a64 + checksum: 10c0/d032af81195bb28dd800c2b9617548c6c2a09b9490da3c5537fd2a1201501666d06492278bb92cfccac1f7ac249e58601dd87f813ec0d6a423ef0880434fa0c3 languageName: node linkType: hard -"@eslint/core@npm:^0.11.0": - version: 0.11.0 - resolution: "@eslint/core@npm:0.11.0" - dependencies: - "@types/json-schema": "npm:^7.0.15" - checksum: 10c0/1e0671d035c908175f445864a7864cf6c6a8b67a5dfba8c47b2ac91e2d3ed36e8c1f2fd81d98a73264f8677055559699d4adb0f97d86588e616fc0dc9a4b86c9 - languageName: node - linkType: hard - -"@eslint/eslintrc@npm:^3.2.0": - version: 3.2.0 - resolution: "@eslint/eslintrc@npm:3.2.0" +"@eslint/eslintrc@npm:^3.3.0": + version: 3.3.0 + resolution: "@eslint/eslintrc@npm:3.3.0" dependencies: ajv: "npm:^6.12.4" debug: "npm:^4.3.2" @@ -651,14 +642,14 @@ __metadata: js-yaml: "npm:^4.1.0" minimatch: "npm:^3.1.2" strip-json-comments: "npm:^3.1.1" - checksum: 10c0/43867a07ff9884d895d9855edba41acf325ef7664a8df41d957135a81a477ff4df4196f5f74dc3382627e5cc8b7ad6b815c2cea1b58f04a75aced7c43414ab8b + checksum: 10c0/215de990231b31e2fe6458f225d8cea0f5c781d3ecb0b7920703501f8cd21b3101fc5ef2f0d4f9a38865d36647b983e0e8ce8bf12fd2bcdd227fc48a5b1a43be languageName: node linkType: hard -"@eslint/js@npm:9.20.0, @eslint/js@npm:^9.20.0": - version: 9.20.0 - resolution: "@eslint/js@npm:9.20.0" - checksum: 10c0/10e7b5b9e628b5192e8fc6b0ecd27cf48322947e83e999ff60f9f9e44ac8d499138bcb9383cbfa6e51e780d53b4e76ccc2d1753b108b7173b8404fd484d37328 +"@eslint/js@npm:9.21.0, @eslint/js@npm:^9.21.0": + version: 9.21.0 + resolution: "@eslint/js@npm:9.21.0" + checksum: 10c0/86c24a2668808995037e3f40c758335df2ae277c553ac0cf84381a1a8698f3099d8a22dd9c388947e6b7f93fcc1142f62406072faaa2b83c43ca79993fc01bb3 languageName: node linkType: hard @@ -669,13 +660,13 @@ __metadata: languageName: node linkType: hard -"@eslint/plugin-kit@npm:^0.2.5": - version: 0.2.5 - resolution: "@eslint/plugin-kit@npm:0.2.5" +"@eslint/plugin-kit@npm:^0.2.7": + version: 0.2.7 + resolution: "@eslint/plugin-kit@npm:0.2.7" dependencies: - "@eslint/core": "npm:^0.10.0" + "@eslint/core": "npm:^0.12.0" levn: "npm:^0.4.1" - checksum: 10c0/ba9832b8409af618cf61791805fe201dd62f3c82c783adfcec0f5cd391e68b40beaecb47b9a3209e926dbcab65135f410cae405b69a559197795793399f61176 + checksum: 10c0/0a1aff1ad63e72aca923217e556c6dfd67d7cd121870eb7686355d7d1475d569773528a8b2111b9176f3d91d2ea81f7413c34600e8e5b73d59e005d70780b633 languageName: node linkType: hard @@ -710,10 +701,10 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/retry@npm:^0.4.1": - version: 0.4.1 - resolution: "@humanwhocodes/retry@npm:0.4.1" - checksum: 10c0/be7bb6841c4c01d0b767d9bb1ec1c9359ee61421ce8ba66c249d035c5acdfd080f32d55a5c9e859cdd7868788b8935774f65b2caf24ec0b7bd7bf333791f063b +"@humanwhocodes/retry@npm:^0.4.2": + version: 0.4.2 + resolution: "@humanwhocodes/retry@npm:0.4.2" + checksum: 10c0/0235525d38f243bee3bf8b25ed395fbf957fb51c08adae52787e1325673071abe856c7e18e530922ed2dd3ce12ed82ba01b8cee0279ac52a3315fcdc3a69ef0c languageName: node linkType: hard @@ -1091,135 +1082,135 @@ __metadata: languageName: node linkType: hard -"@rollup/rollup-android-arm-eabi@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-android-arm-eabi@npm:4.34.7" +"@rollup/rollup-android-arm-eabi@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.34.8" conditions: os=android & cpu=arm languageName: node linkType: hard -"@rollup/rollup-android-arm64@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-android-arm64@npm:4.34.7" +"@rollup/rollup-android-arm64@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-android-arm64@npm:4.34.8" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-arm64@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-darwin-arm64@npm:4.34.7" +"@rollup/rollup-darwin-arm64@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-darwin-arm64@npm:4.34.8" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-x64@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-darwin-x64@npm:4.34.7" +"@rollup/rollup-darwin-x64@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-darwin-x64@npm:4.34.8" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-freebsd-arm64@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-freebsd-arm64@npm:4.34.7" +"@rollup/rollup-freebsd-arm64@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-freebsd-arm64@npm:4.34.8" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-freebsd-x64@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-freebsd-x64@npm:4.34.7" +"@rollup/rollup-freebsd-x64@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-freebsd-x64@npm:4.34.8" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-linux-arm-gnueabihf@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.34.7" +"@rollup/rollup-linux-arm-gnueabihf@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.34.8" conditions: os=linux & cpu=arm & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm-musleabihf@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.34.7" +"@rollup/rollup-linux-arm-musleabihf@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.34.8" conditions: os=linux & cpu=arm & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-arm64-gnu@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.34.7" +"@rollup/rollup-linux-arm64-gnu@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.34.8" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm64-musl@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-arm64-musl@npm:4.34.7" +"@rollup/rollup-linux-arm64-musl@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.34.8" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-loongarch64-gnu@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-loongarch64-gnu@npm:4.34.7" +"@rollup/rollup-linux-loongarch64-gnu@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-loongarch64-gnu@npm:4.34.8" conditions: os=linux & cpu=loong64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-powerpc64le-gnu@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.34.7" +"@rollup/rollup-linux-powerpc64le-gnu@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.34.8" conditions: os=linux & cpu=ppc64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-riscv64-gnu@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.34.7" +"@rollup/rollup-linux-riscv64-gnu@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.34.8" conditions: os=linux & cpu=riscv64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-s390x-gnu@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.34.7" +"@rollup/rollup-linux-s390x-gnu@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.34.8" conditions: os=linux & cpu=s390x & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-gnu@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-x64-gnu@npm:4.34.7" +"@rollup/rollup-linux-x64-gnu@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.34.8" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-musl@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-linux-x64-musl@npm:4.34.7" +"@rollup/rollup-linux-x64-musl@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.34.8" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-win32-arm64-msvc@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.34.7" +"@rollup/rollup-win32-arm64-msvc@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.34.8" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-win32-ia32-msvc@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.34.7" +"@rollup/rollup-win32-ia32-msvc@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.34.8" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@rollup/rollup-win32-x64-msvc@npm:4.34.7": - version: 4.34.7 - resolution: "@rollup/rollup-win32-x64-msvc@npm:4.34.7" +"@rollup/rollup-win32-x64-msvc@npm:4.34.8": + version: 4.34.8 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.34.8" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -1408,12 +1399,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^22.13.4": - version: 22.13.4 - resolution: "@types/node@npm:22.13.4" +"@types/node@npm:*, @types/node@npm:^22.13.5": + version: 22.13.5 + resolution: "@types/node@npm:22.13.5" dependencies: undici-types: "npm:~6.20.0" - checksum: 10c0/3a234fa7766a3efc382cf81f66f474c26cdab2f54f43f757634c81c0444eb2160c2dabbde9741e4983078a318a88515b65416b5f1ab5478548579d7b3ead1d95 + checksum: 10c0/a2e7ed7bb0690e439004779baedeb05159c5cc41ef6d81c7a6ebea5303fde4033669e1c0e41ff7453b45fd2fea8dbd55fddfcd052950c7fcae3167c970bca725 languageName: node linkType: hard @@ -1596,7 +1587,7 @@ __metadata: "@babel/core": "npm:^7.26.9" "@emotion/react": "npm:^11.14.0" "@emotion/styled": "npm:^11.14.0" - "@eslint/js": "npm:^9.20.0" + "@eslint/js": "npm:^9.21.0" "@mui/icons-material": "npm:^6.4.5" "@mui/material": "npm:^6.4.5" "@preact/compat": "npm:^18.3.1" @@ -1604,19 +1595,19 @@ __metadata: "@table-library/react-table-library": "npm:4.1.12" "@trivago/prettier-plugin-sort-imports": "npm:^5.2.2" "@types/formidable": "npm:^3" - "@types/node": "npm:^22.13.4" + "@types/node": "npm:^22.13.5" "@types/react": "npm:^19.0.10" "@types/react-dom": "npm:^19.0.4" alova: "npm:3.2.8" async-validator: "npm:^4.2.5" concurrently: "npm:^9.1.2" - eslint: "npm:^9.20.1" + eslint: "npm:^9.21.0" eslint-config-prettier: "npm:^10.0.1" formidable: "npm:^3.5.2" jwt-decode: "npm:^4.0.0" mime-types: "npm:^2.1.35" preact: "npm:^10.26.2" - prettier: "npm:^3.5.1" + prettier: "npm:^3.5.2" react: "npm:^19.0.0" react-dom: "npm:^19.0.0" react-icons: "npm:^5.5.0" @@ -2041,9 +2032,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001688": - version: 1.0.30001699 - resolution: "caniuse-lite@npm:1.0.30001699" - checksum: 10c0/e87b3a0602c3124131f6a21f1eb262378e17a2ee3089e3c472ac8b9caa85cf7d6a219655379302c29c6f10a74051f2a712639d7f98ee0444c73fefcbaf25d519 + version: 1.0.30001700 + resolution: "caniuse-lite@npm:1.0.30001700" + checksum: 10c0/3d391bcdd193208166d3ad759de240b9c18ac3759dbd57195770f0fcd2eedcd47d5e853609aba1eee5a2def44b0a14eee457796bdb3451a27de0c8b27355017c languageName: node linkType: hard @@ -2624,9 +2615,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.5.73": - version: 1.5.101 - resolution: "electron-to-chromium@npm:1.5.101" - checksum: 10c0/9c6579e58b09cc27151ad135444253d241b8a354c2d1a122d280086549ce3c78a47388f6c37774d93ee73b353defdc1f215b702de2b18d34d53fcf8ed25e5f53 + version: 1.5.103 + resolution: "electron-to-chromium@npm:1.5.103" + checksum: 10c0/3b297311b9266ec3ad00eaa8566901603afedc2e19310a16ab9e7217e62f54dda83120ca5f2f75fe64a214d1ba6f6cbb52d7a1692e28de03fcba8bebf7bfc4d5 languageName: node linkType: hard @@ -3055,20 +3046,20 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^9.20.1": - version: 9.20.1 - resolution: "eslint@npm:9.20.1" +"eslint@npm:^9.21.0": + version: 9.21.0 + resolution: "eslint@npm:9.21.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.2.0" "@eslint-community/regexpp": "npm:^4.12.1" - "@eslint/config-array": "npm:^0.19.0" - "@eslint/core": "npm:^0.11.0" - "@eslint/eslintrc": "npm:^3.2.0" - "@eslint/js": "npm:9.20.0" - "@eslint/plugin-kit": "npm:^0.2.5" + "@eslint/config-array": "npm:^0.19.2" + "@eslint/core": "npm:^0.12.0" + "@eslint/eslintrc": "npm:^3.3.0" + "@eslint/js": "npm:9.21.0" + "@eslint/plugin-kit": "npm:^0.2.7" "@humanfs/node": "npm:^0.16.6" "@humanwhocodes/module-importer": "npm:^1.0.1" - "@humanwhocodes/retry": "npm:^0.4.1" + "@humanwhocodes/retry": "npm:^0.4.2" "@types/estree": "npm:^1.0.6" "@types/json-schema": "npm:^7.0.15" ajv: "npm:^6.12.4" @@ -3100,7 +3091,7 @@ __metadata: optional: true bin: eslint: bin/eslint.js - checksum: 10c0/056789dd5a00897730376f8c0a191e22840e97b7276916068ec096341cb2ec3a918c8bd474bf94ccd7b457ad9fbc16e5c521a993c7cc6ebcf241933e2fd378b0 + checksum: 10c0/558edb25b440cd51825d66fed3e84f1081bd6f4cb2cf994e60ece4c5978fa0583e88b75faf187c1fc21688c4ff7072f12bf5f6d1be1e09a4d6af78cff39dc520 languageName: node linkType: hard @@ -3301,13 +3292,13 @@ __metadata: linkType: hard "fast-xml-parser@npm:^4.1.3": - version: 4.5.1 - resolution: "fast-xml-parser@npm:4.5.1" + version: 4.5.3 + resolution: "fast-xml-parser@npm:4.5.3" dependencies: - strnum: "npm:^1.0.5" + strnum: "npm:^1.1.1" bin: fxparser: src/cli/cli.js - checksum: 10c0/70c6c675770d57d4b73716a1cdccff3780a5f818cffdab9c7560003e1724209001af32fbe7bb27a01107389b1998191c62e20104788ba17e218dfe063aa15b57 + checksum: 10c0/bf9ccadacfadc95f6e3f0e7882a380a7f219cf0a6f96575149f02cb62bf44c3b7f0daee75b8ff3847bcfd7fbcb201e402c71045936c265cf6d94b141ec4e9327 languageName: node linkType: hard @@ -3471,9 +3462,9 @@ __metadata: linkType: hard "flatted@npm:^3.2.9": - version: 3.3.2 - resolution: "flatted@npm:3.3.2" - checksum: 10c0/24cc735e74d593b6c767fe04f2ef369abe15b62f6906158079b9874bdb3ee5ae7110bb75042e70cd3f99d409d766f357caf78d5ecee9780206f5fdc5edbad334 + version: 3.3.3 + resolution: "flatted@npm:3.3.3" + checksum: 10c0/e957a1c6b0254aa15b8cce8533e24165abd98fadc98575db082b786b5da1b7d72062b81bfdcd1da2f4d46b6ed93bec2434e62333e9b4261d79ef2e75a10dd538 languageName: node linkType: hard @@ -5478,12 +5469,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^3.5.1": - version: 3.5.1 - resolution: "prettier@npm:3.5.1" +"prettier@npm:^3.5.2": + version: 3.5.2 + resolution: "prettier@npm:3.5.2" bin: prettier: bin/prettier.cjs - checksum: 10c0/9f6f810eae455d6e4213845151a484a2338f2e0d6a8b84ee8e13a83af8a2421ef6c1e31e61e4b135671fb57b9541f6624648880cc2061ac803e243ac898c0123 + checksum: 10c0/d7b597ed33f39c32ace675896ad187f06a3e48dc8a1e80051b5c5f0dae3586d53981704b8fda5ac3b080e6c2e0e197d239131b953702674f044351621ca5e1ac languageName: node linkType: hard @@ -5864,28 +5855,28 @@ __metadata: linkType: hard "rollup@npm:^4.30.1": - version: 4.34.7 - resolution: "rollup@npm:4.34.7" + version: 4.34.8 + resolution: "rollup@npm:4.34.8" dependencies: - "@rollup/rollup-android-arm-eabi": "npm:4.34.7" - "@rollup/rollup-android-arm64": "npm:4.34.7" - "@rollup/rollup-darwin-arm64": "npm:4.34.7" - "@rollup/rollup-darwin-x64": "npm:4.34.7" - "@rollup/rollup-freebsd-arm64": "npm:4.34.7" - "@rollup/rollup-freebsd-x64": "npm:4.34.7" - "@rollup/rollup-linux-arm-gnueabihf": "npm:4.34.7" - "@rollup/rollup-linux-arm-musleabihf": "npm:4.34.7" - "@rollup/rollup-linux-arm64-gnu": "npm:4.34.7" - "@rollup/rollup-linux-arm64-musl": "npm:4.34.7" - "@rollup/rollup-linux-loongarch64-gnu": "npm:4.34.7" - "@rollup/rollup-linux-powerpc64le-gnu": "npm:4.34.7" - "@rollup/rollup-linux-riscv64-gnu": "npm:4.34.7" - "@rollup/rollup-linux-s390x-gnu": "npm:4.34.7" - "@rollup/rollup-linux-x64-gnu": "npm:4.34.7" - "@rollup/rollup-linux-x64-musl": "npm:4.34.7" - "@rollup/rollup-win32-arm64-msvc": "npm:4.34.7" - "@rollup/rollup-win32-ia32-msvc": "npm:4.34.7" - "@rollup/rollup-win32-x64-msvc": "npm:4.34.7" + "@rollup/rollup-android-arm-eabi": "npm:4.34.8" + "@rollup/rollup-android-arm64": "npm:4.34.8" + "@rollup/rollup-darwin-arm64": "npm:4.34.8" + "@rollup/rollup-darwin-x64": "npm:4.34.8" + "@rollup/rollup-freebsd-arm64": "npm:4.34.8" + "@rollup/rollup-freebsd-x64": "npm:4.34.8" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.34.8" + "@rollup/rollup-linux-arm-musleabihf": "npm:4.34.8" + "@rollup/rollup-linux-arm64-gnu": "npm:4.34.8" + "@rollup/rollup-linux-arm64-musl": "npm:4.34.8" + "@rollup/rollup-linux-loongarch64-gnu": "npm:4.34.8" + "@rollup/rollup-linux-powerpc64le-gnu": "npm:4.34.8" + "@rollup/rollup-linux-riscv64-gnu": "npm:4.34.8" + "@rollup/rollup-linux-s390x-gnu": "npm:4.34.8" + "@rollup/rollup-linux-x64-gnu": "npm:4.34.8" + "@rollup/rollup-linux-x64-musl": "npm:4.34.8" + "@rollup/rollup-win32-arm64-msvc": "npm:4.34.8" + "@rollup/rollup-win32-ia32-msvc": "npm:4.34.8" + "@rollup/rollup-win32-x64-msvc": "npm:4.34.8" "@types/estree": "npm:1.0.6" fsevents: "npm:~2.3.2" dependenciesMeta: @@ -5931,7 +5922,7 @@ __metadata: optional: true bin: rollup: dist/bin/rollup - checksum: 10c0/115094e41ff8329e2320a7d37edb4d958aca678f8222b4b52e98981da700678c2ad92fddaf164455ca8c2cf9222d42e7b19a0f0e54bfb070b0b8c62d8f3e99aa + checksum: 10c0/b9e711e33413112fbb761107c3fddc4561dfc74335c393542a829a85ccfb2763bfd17bf2422d84a2e9bee7646e5367018973e97005fdf64e49c2e209612f0eb6 languageName: node linkType: hard @@ -5945,11 +5936,11 @@ __metadata: linkType: hard "rxjs@npm:^7.8.1": - version: 7.8.1 - resolution: "rxjs@npm:7.8.1" + version: 7.8.2 + resolution: "rxjs@npm:7.8.2" dependencies: tslib: "npm:^2.1.0" - checksum: 10c0/3c49c1ecd66170b175c9cacf5cef67f8914dcbc7cd0162855538d365c83fea631167cacb644b3ce533b2ea0e9a4d0b12175186985f89d75abe73dbd8f7f06f68 + checksum: 10c0/1fcd33d2066ada98ba8f21fcbbcaee9f0b271de1d38dc7f4e256bfbc6ffcdde68c8bfb69093de7eeb46f24b1fb820620bf0223706cff26b4ab99a7ff7b2e2c45 languageName: node linkType: hard @@ -6404,10 +6395,10 @@ __metadata: languageName: node linkType: hard -"strnum@npm:^1.0.5": - version: 1.0.5 - resolution: "strnum@npm:1.0.5" - checksum: 10c0/64fb8cc2effbd585a6821faa73ad97d4b553c8927e49086a162ffd2cc818787643390b89d567460a8e74300148d11ac052e21c921ef2049f2987f4b1b89a7ff1 +"strnum@npm:^1.1.1": + version: 1.1.1 + resolution: "strnum@npm:1.1.1" + checksum: 10c0/c016034f9896ea99c4a22a8a8142d1ec72dba8d514ddec399f96998d5d2ab9f9e5b6c75c761d9730c3244b794022b1a63ec293f0da41ab0a994e3584020ba1ad languageName: node linkType: hard diff --git a/mock-api/package.json b/mock-api/package.json index 9d456ad02..47121cbb0 100644 --- a/mock-api/package.json +++ b/mock-api/package.json @@ -9,11 +9,11 @@ "format": "prettier -l -w '**/*.{ts,tsx,js,css,json,md}'" }, "dependencies": { - "@msgpack/msgpack": "^3.0.1", + "@msgpack/msgpack": "^3.1.0", "@trivago/prettier-plugin-sort-imports": "^5.2.2", "formidable": "^3.5.2", "itty-router": "^5.0.18", - "prettier": "^3.5.1" + "prettier": "^3.5.2" }, "packageManager": "yarn@4.6.0" } diff --git a/mock-api/yarn.lock b/mock-api/yarn.lock index 3dd68a85f..eee4ade3c 100644 --- a/mock-api/yarn.lock +++ b/mock-api/yarn.lock @@ -132,10 +132,10 @@ __metadata: languageName: node linkType: hard -"@msgpack/msgpack@npm:^3.0.1": - version: 3.0.1 - resolution: "@msgpack/msgpack@npm:3.0.1" - checksum: 10c0/f039c3d8d31374eac37cdb4e70cf9d839757eb9b3c061ca66bd57a582e7f8a4e29303aeb3a4ca891bc1958a265ec91f9644aa783fdc2b21fb4e6621704c4cc67 +"@msgpack/msgpack@npm:^3.1.0": + version: 3.1.0 + resolution: "@msgpack/msgpack@npm:3.1.0" + checksum: 10c0/d31c299cc9f7620715eec77b12ec0cb4950943fd8b0c23275e37afe6ad30efe237e61333e8e340a0a433eca7a4595212fb905e70b4506ae5b866758e4291289b languageName: node linkType: hard @@ -260,11 +260,11 @@ __metadata: version: 0.0.0-use.local resolution: "mock-api@workspace:." dependencies: - "@msgpack/msgpack": "npm:^3.0.1" + "@msgpack/msgpack": "npm:^3.1.0" "@trivago/prettier-plugin-sort-imports": "npm:^5.2.2" formidable: "npm:^3.5.2" itty-router: "npm:^5.0.18" - prettier: "npm:^3.5.1" + prettier: "npm:^3.5.2" languageName: unknown linkType: soft @@ -291,12 +291,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^3.5.1": - version: 3.5.1 - resolution: "prettier@npm:3.5.1" +"prettier@npm:^3.5.2": + version: 3.5.2 + resolution: "prettier@npm:3.5.2" bin: prettier: bin/prettier.cjs - checksum: 10c0/9f6f810eae455d6e4213845151a484a2338f2e0d6a8b84ee8e13a83af8a2421ef6c1e31e61e4b135671fb57b9541f6624648880cc2061ac803e243ac898c0123 + checksum: 10c0/d7b597ed33f39c32ace675896ad187f06a3e48dc8a1e80051b5c5f0dae3586d53981704b8fda5ac3b080e6c2e0e197d239131b953702674f044351621ca5e1ac languageName: node linkType: hard From 01710316ed442a2d5ef421127f862e6bed198147 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:36:00 +0100 Subject: [PATCH 04/11] add test for analogsensors --- src/test/test.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/test.cpp b/src/test/test.cpp index 86069e15e..f1ab6f9ed 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -859,10 +859,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const shell.printfln("Testing adding Analog sensor"); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); - Mqtt::nested_format(1); // Mqtt::nested_format(0); - // Mqtt::send_response(false); // load some EMS data @@ -885,6 +883,23 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const request.url("/api/analogsensor/36"); EMSESP::webAPIService.webAPIService(&request); + // test setting a value + request.method(HTTP_POST); + JsonDocument doc; + + char data[] = "{\"value\":10,\"id\":33}"; + deserializeJson(doc, data); + request.url("/api/analogsensor/setvalue"); + EMSESP::webAPIService.webAPIService(&request, doc.as()); + shell.invoke_command("call analogsensor test_analogsensor4"); + + char data2[] = "{\"value\":11}"; + deserializeJson(doc, data2); + request.url("/api/analogsensor/test_analogsensor4"); + EMSESP::webAPIService.webAPIService(&request, doc.as()); + + shell.invoke_command("call analogsensor test_analogsensor4"); + // test renaming it // bool update(uint8_t id, const std::string & name, int16_t offset, float factor, uint8_t uom, uint8_t type); // EMSESP::analogsensor_.update(36, "test_analog1_new", 2, 0.7, 17, 1); @@ -1071,6 +1086,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // EMSESP::webAPIService.webAPIService(&request); // request.url("/api/thermostat/hc1"); // EMSESP::webAPIService.webAPIService(&request); + // request.url("/api/boiler/comfort/value"); + // EMSESP::webAPIService.webAPIService(&request); // POST COMMANDS request.method(HTTP_POST); From 8adca69140c4a74b619fc5701a317c77f5bd0dd9 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:36:12 +0100 Subject: [PATCH 05/11] update unit tests, add analogsensors --- test/test_api/test_api.cpp | 34 +++++++++++++++++++++++++--------- test/test_api/test_api.h | 33 +++++++++++++++++---------------- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/test/test_api/test_api.cpp b/test/test_api/test_api.cpp index 91ecd0109..54b6461be 100644 --- a/test/test_api/test_api.cpp +++ b/test/test_api/test_api.cpp @@ -22,7 +22,6 @@ #include #include "ESPAsyncWebServer.h" -#include "ESP32React.h" #include "web/WebAPIService.h" using namespace emsesp; @@ -32,7 +31,7 @@ void run_tests(); const char * call_url(const char * url); AsyncWebServer * webServer; -ESP32React * esp32React; +ESP32React * esp32React; WebAPIService * webAPIService; EMSESP application; FS dummyFS; @@ -67,13 +66,13 @@ static TestStream stream; // load the tests // this is generated from this file when compiled with -DEMSESP_UNITY_CREATE // copy the output to the test_api.h file -#include "test_api.h" // generated test functions +#include "test_api.h" -// Unity's setup call - is called before each test +// Unity's setup call - is called before each test - empty for now void setUp() { } -// Unity's teardown call - is called after each test +// Unity's teardown call - is called after each test - empty for now void tearDown() { } @@ -171,7 +170,6 @@ const char * call_url(const char * url) { request.method(HTTP_GET); request.url(url); webAPIService->webAPIService(&request); - return webAPIService->getResponse(); } @@ -187,7 +185,6 @@ const char * call_url(const char * url, const char * data) { request.method(HTTP_POST); request.url(url); webAPIService->webAPIService(&request, json); - return webAPIService->getResponse(); } @@ -268,11 +265,28 @@ void manual_test4() { TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/thermostat", data)); } +void manual_test5() { + auto expected_response = "[{}]"; // empty is good + char data[] = "{\"value\":11}"; + + TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/test_analogsensor4", data)); +} + +void manual_test6() { + auto expected_response = "[{}]"; // empty is good + char data[] = "{\"value\":10,\"id\":33}"; + + TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/setvalue", data)); +} + + void run_manual_tests() { RUN_TEST(manual_test1); RUN_TEST(manual_test2); RUN_TEST(manual_test3); RUN_TEST(manual_test4); + RUN_TEST(manual_test5); + RUN_TEST(manual_test6); } const char * run_console_command(const char * command) { @@ -318,8 +332,10 @@ void run_console_tests() { // auto-generate the tests void create_tests() { - // These tests should all pass.... + // These match the calls in test_api.h + // They are all READ calls, no POST or PUT. We use the manual tests for those. + // this first section should all pass capture("/api/boiler"); capture("/api/boiler/commands"); capture("/api/boiler/values"); @@ -406,7 +422,7 @@ void create_tests() { // Main entry point int main() { webServer = new AsyncWebServer(80); - esp32React = new ESP32React(webServer, &dummyFS); + esp32React = new ESP32React(webServer, &dummyFS); webAPIService = new WebAPIService(webServer, esp32React->getSecurityManager()); // Serial console for commands diff --git a/test/test_api/test_api.h b/test/test_api/test_api.h index 0d6ff3ef4..2e8c2b813 100644 --- a/test/test_api/test_api.h +++ b/test/test_api/test_api.h @@ -1,7 +1,6 @@ // ************************************************************************************************** // -// Compile with -DEMSESP_UNITY_CREATE to generate the test functions -// and copy the output and paste below. +// Compile with -DEMSESP_UNITY_CREATE to generate the test functions, copy the output and paste below. // // TODO convert output to JSON and compare, showing differences // @@ -92,7 +91,9 @@ void test_7() { void test_8() { auto expected_response = "[{\"name\":\"outdoortemp\",\"fullname\":\"outside " - "temperature\",\"circuit\":\"\",\"type\":\"number\",\"uom\":\"°C\",\"readable\":true,\"writeable\":false,\"visible\":true}]"; + "temperature\",\"circuit\":\"\",\"type\":\"number\",\"uom\":\"°C\",\"state_class\":\"measurement\",\"device_class\":" + "\"temperature\",\"readable\":true,\"writeable\":false,\"visible\":true}]"; + TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler/outdoortemp")); } @@ -126,15 +127,15 @@ void test_13() { void test_14() { auto expected_response = "[{\"name\":\"seltemp\",\"fullname\":\"hc1 selected room " - "temperature\",\"circuit\":\"hc1\",\"value\":20.5,\"type\":\"number\",\"min\":0,\"max\":30,\"uom\":\"°C\",\"readable\":true," - "\"writeable\":true,\"visible\":true}]"; + "temperature\",\"circuit\":\"hc1\",\"value\":20.5,\"type\":\"number\",\"min\":0,\"max\":30,\"uom\":\"°C\",\"state_class\":" + "\"measurement\",\"device_class\":\"temperature\",\"readable\":true,\"writeable\":true,\"visible\":true}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/thermostat/hc1/seltemp")); } void test_15() { auto expected_response = "[{\"name\":\"seltemp\",\"fullname\":\"hc2 selected room " - "temperature\",\"circuit\":\"hc2\",\"value\":20.6,\"type\":\"number\",\"min\":0,\"max\":30,\"uom\":\"°C\",\"readable\":true," - "\"writeable\":true,\"visible\":true}]"; + "temperature\",\"circuit\":\"hc2\",\"value\":20.6,\"type\":\"number\",\"min\":0,\"max\":30,\"uom\":\"°C\",\"state_class\":" + "\"measurement\",\"device_class\":\"temperature\",\"readable\":true,\"writeable\":true,\"visible\":true}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/thermostat/hc2/seltemp")); } @@ -163,20 +164,20 @@ void test_19() { "\"entityFormat\":1,\"base\":\"ems-esp\",\"discoveryPrefix\":\"homeassistant\",\"discoveryType\":0,\"nestedFormat\":1,\"haEnabled\":true,\"mqttQos\":0," "\"mqttRetain\":false,\"publishTimeHeartbeat\":60,\"publishTimeBoiler\":10,\"publishTimeThermostat\":10,\"publishTimeSolar\":10,\"publishTimeMixer\":" "10,\"publishTimeWater\":0,\"publishTimeOther\":10,\"publishTimeSensor\":10,\"publishSingle\":false,\"publish2command\":false,\"sendResponse\":false}," - "\"syslog\":{\"enabled\":false},\"sensor\":{\"temperatureSensors\":2,\"temperatureSensorReads\":0,\"temperatureSensorFails\":0,\"analogSensors\":3," + "\"syslog\":{\"enabled\":false},\"sensor\":{\"temperatureSensors\":2,\"temperatureSensorReads\":0,\"temperatureSensorFails\":0,\"analogSensors\":4," "\"analogSensorReads\":0,\"analogSensorFails\":0},\"api\":{\"APICalls\":0,\"APIFails\":0},\"bus\":{\"busStatus\":\"connected\",\"busProtocol\":" "\"Buderus\",\"busTelegramsReceived\":8,\"busReads\":0,\"busWrites\":0,\"busIncompleteTelegrams\":0,\"busReadsFailed\":0,\"busWritesFailed\":0," "\"busRxLineQuality\":100,\"busTxLineQuality\":100},\"settings\":{\"boardProfile\":\"S32\",\"locale\":\"en\",\"txMode\":8,\"emsBusID\":11," "\"showerTimer\":false,\"showerMinDuration\":180,\"showerAlert\":false,\"hideLed\":false,\"noTokenApi\":false,\"readonlyMode\":false,\"fahrenheit\":" "false,\"dallasParasite\":false,\"boolFormat\":1,\"boolDashboard\":1,\"enumFormat\":1,\"analogEnabled\":true,\"telnetEnabled\":true," - "\"maxWebLogBuffer\":25,\"webLogBuffer\":0,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":" + "\"maxWebLogBuffer\":25,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":" "\"boiler\",\"name\":\"My Custom " "Boiler\",\"deviceID\":\"0x08\",\"productID\":123,\"brand\":\"\",\"version\":\"01.00\",\"entities\":37,\"handlersReceived\":\"0x18\"," "\"handlersFetched\":\"0x14 0x33\",\"handlersPending\":\"0xBF 0x10 0x11 0xC2 0x15 0x1C 0x19 0x1A 0x35 0x34 0x2A 0xD1 0xE3 0xE4 0xE5 0xE9 0x2E " "0x3B\"},{\"type\":\"thermostat\",\"name\":\"FW120\",\"deviceID\":\"0x10\",\"productID\":192,\"brand\":\"\",\"version\":\"01.00\",\"entities\":15," "\"handlersReceived\":\"0x016F\",\"handlersFetched\":\"0x0170 0x0171\",\"handlersPending\":\"0xA3 0x06 0xA2 0x12 0x13 0x0172 0x0165 " "0x0168\"},{\"type\":\"temperaturesensor\",\"name\":\"temperaturesensor\",\"entities\":2},{\"type\":\"analogsensor\",\"name\":\"analogsensor\"," - "\"entities\":3},{\"type\":\"scheduler\",\"name\":\"scheduler\",\"entities\":2},{\"type\":\"custom\",\"name\":\"custom\",\"entities\":4}]}]"; + "\"entities\":4},{\"type\":\"scheduler\",\"name\":\"scheduler\",\"entities\":2},{\"type\":\"custom\",\"name\":\"custom\",\"entities\":4}]}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system")); } @@ -189,26 +190,26 @@ void test_20() { "\"entityFormat\":1,\"base\":\"ems-esp\",\"discoveryPrefix\":\"homeassistant\",\"discoveryType\":0,\"nestedFormat\":1,\"haEnabled\":true,\"mqttQos\":0," "\"mqttRetain\":false,\"publishTimeHeartbeat\":60,\"publishTimeBoiler\":10,\"publishTimeThermostat\":10,\"publishTimeSolar\":10,\"publishTimeMixer\":" "10,\"publishTimeWater\":0,\"publishTimeOther\":10,\"publishTimeSensor\":10,\"publishSingle\":false,\"publish2command\":false,\"sendResponse\":false}," - "\"syslog\":{\"enabled\":false},\"sensor\":{\"temperatureSensors\":2,\"temperatureSensorReads\":0,\"temperatureSensorFails\":0,\"analogSensors\":3," + "\"syslog\":{\"enabled\":false},\"sensor\":{\"temperatureSensors\":2,\"temperatureSensorReads\":0,\"temperatureSensorFails\":0,\"analogSensors\":4," "\"analogSensorReads\":0,\"analogSensorFails\":0},\"api\":{\"APICalls\":0,\"APIFails\":0},\"bus\":{\"busStatus\":\"connected\",\"busProtocol\":" "\"Buderus\",\"busTelegramsReceived\":8,\"busReads\":0,\"busWrites\":0,\"busIncompleteTelegrams\":0,\"busReadsFailed\":0,\"busWritesFailed\":0," "\"busRxLineQuality\":100,\"busTxLineQuality\":100},\"settings\":{\"boardProfile\":\"S32\",\"locale\":\"en\",\"txMode\":8,\"emsBusID\":11," "\"showerTimer\":false,\"showerMinDuration\":180,\"showerAlert\":false,\"hideLed\":false,\"noTokenApi\":false,\"readonlyMode\":false,\"fahrenheit\":" "false,\"dallasParasite\":false,\"boolFormat\":1,\"boolDashboard\":1,\"enumFormat\":1,\"analogEnabled\":true,\"telnetEnabled\":true," - "\"maxWebLogBuffer\":25,\"webLogBuffer\":0,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":" + "\"maxWebLogBuffer\":25,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":" "\"boiler\",\"name\":\"My Custom " "Boiler\",\"deviceID\":\"0x08\",\"productID\":123,\"brand\":\"\",\"version\":\"01.00\",\"entities\":37,\"handlersReceived\":\"0x18\"," "\"handlersFetched\":\"0x14 0x33\",\"handlersPending\":\"0xBF 0x10 0x11 0xC2 0x15 0x1C 0x19 0x1A 0x35 0x34 0x2A 0xD1 0xE3 0xE4 0xE5 0xE9 0x2E " "0x3B\"},{\"type\":\"thermostat\",\"name\":\"FW120\",\"deviceID\":\"0x10\",\"productID\":192,\"brand\":\"\",\"version\":\"01.00\",\"entities\":15," "\"handlersReceived\":\"0x016F\",\"handlersFetched\":\"0x0170 0x0171\",\"handlersPending\":\"0xA3 0x06 0xA2 0x12 0x13 0x0172 0x0165 " "0x0168\"},{\"type\":\"temperaturesensor\",\"name\":\"temperaturesensor\",\"entities\":2},{\"type\":\"analogsensor\",\"name\":\"analogsensor\"," - "\"entities\":3},{\"type\":\"scheduler\",\"name\":\"scheduler\",\"entities\":2},{\"type\":\"custom\",\"name\":\"custom\",\"entities\":4}]}]"; + "\"entities\":4},{\"type\":\"scheduler\",\"name\":\"scheduler\",\"entities\":2},{\"type\":\"custom\",\"name\":\"custom\",\"entities\":4}]}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/info")); } void test_21() { auto expected_response = - "[{\"name\":\"locale\",\"circuit\":\"settings\",\"readable\":true,\"writable\":false,\"visible\":true,\"value\":\"en\",\"type\":\"string\"}]"; + "[{\"name\":\"locale\",\"circuit\":\"settings\",\"readable\":true,\"writeable\":false,\"visible\":true,\"value\":\"en\",\"type\":\"string\"}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/settings/locale")); } @@ -267,12 +268,12 @@ void test_31() { } void test_32() { - auto expected_response = "[{\"test_analogsensor1\":0,\"test_analogsensor2\":1,\"test_analogsensor3\":0}]"; + auto expected_response = "[{\"test_analogsensor1\":0,\"test_analogsensor2\":1,\"test_analogsensor3\":0,\"test_analogsensor4\":0}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor")); } void test_33() { - auto expected_response = "[{\"test_analogsensor1\":0,\"test_analogsensor2\":1,\"test_analogsensor3\":0}]"; + auto expected_response = "[{\"test_analogsensor1\":0,\"test_analogsensor2\":1,\"test_analogsensor3\":0,\"test_analogsensor4\":0}]"; TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/info")); } From af9ad5d624c8bf2f267497b49a38461849767301 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:36:28 +0100 Subject: [PATCH 06/11] add test data for writing to analog sensor --- src/web/WebCustomizationService.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/web/WebCustomizationService.cpp b/src/web/WebCustomizationService.cpp index 3d1476bb7..dd056b801 100644 --- a/src/web/WebCustomizationService.cpp +++ b/src/web/WebCustomizationService.cpp @@ -391,7 +391,7 @@ void WebCustomizationService::test() { analog.offset = 0; analog.factor = 0.1; analog.uom = 17; - analog.type = 3; + analog.type = 3; // ADC webCustomization.analogCustomizations.push_back(analog); analog = AnalogCustomization(); @@ -400,7 +400,7 @@ void WebCustomizationService::test() { analog.offset = 0; analog.factor = 1; analog.uom = 0; - analog.type = 1; + analog.type = 1; // DIGITAL_IN webCustomization.analogCustomizations.push_back(analog); analog = AnalogCustomization(); @@ -412,6 +412,15 @@ void WebCustomizationService::test() { analog.type = 0; // disabled, not-used webCustomization.analogCustomizations.push_back(analog); + analog = AnalogCustomization(); + analog.gpio = 33; + analog.name = "test_analogsensor4"; + analog.offset = 0; + analog.factor = 1; + analog.uom = 0; + analog.type = 2; // COUNTER + webCustomization.analogCustomizations.push_back(analog); + // EMS entities, mark some as favorites webCustomization.entityCustomizations.clear(); auto emsEntity = EntityCustomization(); From 19572f313aa99e91692a8fdf248fde64e92c0828 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:36:45 +0100 Subject: [PATCH 07/11] don't build web in standalone native --- platformio.ini | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 99a5883e4..018c83ccf 100644 --- a/platformio.ini +++ b/platformio.ini @@ -200,6 +200,7 @@ build_flags = ; [env:native] platform = native +extra_scripts = build_flags = -DARDUINOJSON_ENABLE_ARDUINO_STRING=1 -DEMSESP_STANDALONE -DEMSESP_TEST @@ -233,11 +234,12 @@ lib_deps = ; unit tests ; The code is in ./test/test_api.* -; to run use `pio run -e native-test -t exec`. All tests should PASS. -; to update the test results, compile with -DEMSESP_UNITY_CREATE by uncommenting the line below -; then run and capture the output between "START - CUT HERE" and "END - CUT HERE" into the test_api.h file +; to run use `pio run -e native-test -t exec`. All tests should PASS. +; to update the test results, compile with -DEMSESP_UNITY_CREATE by uncommenting the line below +; then re-run and capture the output between "START - CUT HERE" and "END - CUT HERE" into the test_api.h file [env:native-test] platform = native +extra_scripts = test_build_src = true build_flags = -DARDUINOJSON_ENABLE_ARDUINO_STRING=1 From e484f11d128e524144c67e025acc7ba3309ddb4a Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:37:12 +0100 Subject: [PATCH 08/11] add test data and comments --- src/core/analogsensor.cpp | 6 +++++- src/core/analogsensor.h | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/core/analogsensor.cpp b/src/core/analogsensor.cpp index 20c5bbbb5..49ff30d79 100644 --- a/src/core/analogsensor.cpp +++ b/src/core/analogsensor.cpp @@ -640,6 +640,7 @@ bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int return true; // no sensors, return true } + // return all values if its an info and values command if (!strcmp(cmd, F_(info)) || !strcmp(cmd, F_(values))) { for (const auto & sensor : sensors_) { output[sensor.name()] = sensor.value(); @@ -647,6 +648,7 @@ bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int return true; } + // show all entity details of the command is entities if (!strcmp(cmd, F_(entities))) { for (const auto & sensor : sensors_) { get_value_json(output[sensor.name()].to(), sensor); @@ -654,7 +656,7 @@ bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int return true; } - // this is for a specific sensor + // this is for a specific sensor, return the value const char * attribute_s = Command::get_attribute(cmd); for (const auto & sensor : sensors_) { @@ -725,6 +727,7 @@ bool AnalogSensor::command_setvalue(const char * value, const int8_t gpio) { } val = b ? 1 : 0; } + for (auto & sensor : sensors_) { if (sensor.gpio() == gpio) { double oldoffset = sensor.offset(); @@ -791,6 +794,7 @@ bool AnalogSensor::command_setvalue(const char * value, const int8_t gpio) { return true; } } + return false; } diff --git a/src/core/analogsensor.h b/src/core/analogsensor.h index 96f239e0a..cc8317543 100644 --- a/src/core/analogsensor.h +++ b/src/core/analogsensor.h @@ -113,16 +113,16 @@ class AnalogSensor { ~AnalogSensor() = default; enum AnalogType : int8_t { - NOTUSED, // 0 - disabled - DIGITAL_IN, - COUNTER, - ADC, - TIMER, - RATE, - DIGITAL_OUT, - PWM_0, - PWM_1, - PWM_2 + NOTUSED = 0, // 0 = disabled + DIGITAL_IN = 1, + COUNTER = 2, + ADC = 3, + TIMER = 4, + RATE = 5, + DIGITAL_OUT = 6, + PWM_0 = 7, + PWM_1 = 8, + PWM_2 = 9 }; void start(); From cdd9acddfa39c50c423cc3a3c94b859021351179 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:37:37 +0100 Subject: [PATCH 09/11] remove obsolete return_not_found() --- src/core/command.cpp | 18 ++++++++++++++---- src/core/emsesp.cpp | 9 --------- src/core/emsesp.h | 2 -- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/core/command.cpp b/src/core/command.cpp index 72d4ae43c..463efe19a 100644 --- a/src/core/command.cpp +++ b/src/core/command.cpp @@ -298,6 +298,8 @@ const char * Command::get_attribute(const char * cmd) { return nullptr; } +// returns the attribute in the given JSON object as a key/value pair called api_data +// or errors if the attribute is not found bool Command::set_attribute(JsonObject output, const char * cmd, const char * attribute) { if (attribute == nullptr) { return true; @@ -309,7 +311,14 @@ bool Command::set_attribute(JsonObject output, const char * cmd, const char * at output["api_data"] = data; // always as a string return true; } - return EMSESP::return_not_found(output, attribute, cmd); // not found + + // not found + output.clear(); + + char error[100]; + snprintf(error, sizeof(error), "no %s in %s", attribute, cmd); + output["message"] = error; + return false; } // calls a command directly @@ -431,7 +440,8 @@ uint8_t Command::call(const uint8_t device_type, const char * command, const cha logger_.debug("%sCalled command %s", ro.c_str(), info_s); } else { if (id > 0) { - LOG_INFO(("%sCalled command %s with value %s and id %d on device 0x%02X"), ro.c_str(), info_s, value, id, device_id); + (device_id) ? LOG_INFO(("%sCalled command %s with value %s and id %d on device 0x%02X"), ro.c_str(), info_s, value, id, device_id) + : LOG_INFO(("%sCalled command %s with value %s and id %d"), ro.c_str(), info_s, value, id); } else { LOG_INFO(("%sCalled command %s with value %s"), ro.c_str(), info_s, value); } @@ -481,7 +491,7 @@ Command::CmdFunction * Command::find_command(const uint8_t device_type, const ui for (auto & cf : cmdfunctions_) { if (Helpers::toLower(cmd) == Helpers::toLower(cf.cmd_) && (cf.device_type_ == device_type) && (!device_id || cf.device_id_ == device_id) - && (flag == CommandFlag::CMD_FLAG_DEFAULT || (flag & 0x3F) == (cf.flags_ & 0x3F))) { + && (cf.device_type_ < EMSdevice::DeviceType::BOILER || flag == CommandFlag::CMD_FLAG_DEFAULT || (flag & 0x3F) == (cf.flags_ & 0x3F))) { return &cf; } } @@ -639,9 +649,9 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo shell.print('*'); } shell.print(COLOR_RESET); + shell.println(); } } - shell.println(); } } diff --git a/src/core/emsesp.cpp b/src/core/emsesp.cpp index a188bc74c..8e73d40b6 100644 --- a/src/core/emsesp.cpp +++ b/src/core/emsesp.cpp @@ -813,15 +813,6 @@ bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8 return false; // not found } -// sends JSON error message, used with API calls -bool EMSESP::return_not_found(JsonObject output, const char * msg, const char * cmd) { - output.clear(); - char error[100]; - snprintf(error, sizeof(error), "no %s in %s", msg, cmd); - output["message"] = error; - return false; -} - // search for recognized device_ids : Me, All, otherwise print hex value std::string EMSESP::device_tostring(const uint8_t device_id) { if ((device_id & 0x7F) == EMSbus::ems_bus_id()) { diff --git a/src/core/emsesp.h b/src/core/emsesp.h index 5f659bbd4..7ae4915d0 100644 --- a/src/core/emsesp.h +++ b/src/core/emsesp.h @@ -222,8 +222,6 @@ class EMSESP { static void scan_devices(); static void clear_all_devices(); - static bool return_not_found(JsonObject output, const char * msg, const char * cmd); - static std::deque> emsdevices; // services From f45ac9d0efd0de6fdd5c665b9be76811b54bcb14 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:37:55 +0100 Subject: [PATCH 10/11] 3.7.2-dev.22 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 33e42358e..4e00281da 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.2-dev.21" +#define EMSESP_APP_VERSION "3.7.2-dev.22" From eeccd076a0cd6a6c532247743ffa74d5364cfeea Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 22 Feb 2025 13:38:04 +0100 Subject: [PATCH 11/11] airbypass --- src/core/modbus_entity_parameters.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/modbus_entity_parameters.hpp b/src/core/modbus_entity_parameters.hpp index 509e6193a..26d16a6e7 100644 --- a/src/core/modbus_entity_parameters.hpp +++ b/src/core/modbus_entity_parameters.hpp @@ -573,6 +573,7 @@ const std::initializer_list Modbus::modbus_register_ma REGISTER_MAPPING(dt::VENTILATION, TAG_TYPE_DEVICE_DATA, FL_(ventMode), 6, 1), // ventmode REGISTER_MAPPING(dt::VENTILATION, TAG_TYPE_DEVICE_DATA, FL_(airquality), 7, 1), // airquality REGISTER_MAPPING(dt::VENTILATION, TAG_TYPE_DEVICE_DATA, FL_(airHumidity), 8, 1), // airhumidity + REGISTER_MAPPING(dt::VENTILATION, TAG_TYPE_DEVICE_DATA, FL_(airbypass), 9, 1), // bypass REGISTER_MAPPING(dt::WATER, TAG_TYPE_DHW, FL_(selRoomTemp), 0, 1), // seltemp REGISTER_MAPPING(dt::WATER, TAG_TYPE_DHW, FL_(wwTemp), 1, 1), // temp REGISTER_MAPPING(dt::WATER, TAG_TYPE_DHW, FL_(wwCurTemp2), 2, 1), // curtemp2