diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 5ce4cec3a..94b073686 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -15,6 +15,7 @@ - heatpump dhw stop temperatures [#1624](https://github.com/emsesp/EMS-ESP32/issues/1624) - reset history [#1695](https://github.com/emsesp/EMS-ESP32/issues/1695) - heatpump entities `fan` and `shutdown` [#1690](https://github.com/emsesp/EMS-ESP32/discussions/1690) +- mqtt HA-mode 3 for v3.6 compatible HA entities, set on update v3.6->v3.7 ## Fixed @@ -28,3 +29,4 @@ - store digital out states to nvs - Refresh UI - moving settings to one location [#1665](https://github.com/emsesp/EMS-ESP32/issues/1665) - rename DeviceValueTypes, add UINT32 for custom entities +- dynamic register dhw circuits for thermostat diff --git a/interface/package.json b/interface/package.json index b4120bd77..50ea589a7 100644 --- a/interface/package.json +++ b/interface/package.json @@ -32,10 +32,10 @@ "@table-library/react-table-library": "4.1.7", "@types/lodash-es": "^4.17.12", "@types/node": "^20.12.7", - "@types/react": "^18.2.79", - "@types/react-dom": "^18.2.25", + "@types/react": "^18.3.0", + "@types/react-dom": "^18.3.0", "@types/react-router-dom": "^5.3.3", - "alova": "2.19.2", + "alova": "^2.20.2", "async-validator": "^4.2.5", "history": "^5.3.0", "jwt-decode": "^4.0.0", @@ -45,7 +45,7 @@ "react-dom": "latest", "react-dropzone": "^14.2.3", "react-icons": "^5.1.0", - "react-router-dom": "^6.22.3", + "react-router-dom": "^6.23.0", "react-toastify": "^10.0.5", "typesafe-i18n": "^5.26.2", "typescript": "^5.4.5" @@ -56,13 +56,13 @@ "@preact/preset-vite": "^2.8.2", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "concurrently": "^8.2.2", - "eslint": "^9.1.0", + "eslint": "^9.1.1", "eslint-config-prettier": "^9.1.0", "preact": "^10.20.2", "prettier": "^3.2.5", "rollup-plugin-visualizer": "^5.12.0", - "terser": "^5.30.3", - "typescript-eslint": "^7.7.0", + "terser": "^5.30.4", + "typescript-eslint": "^7.7.1", "vite": "^5.2.10", "vite-plugin-imagemin": "^0.6.1", "vite-tsconfig-paths": "^4.3.2" diff --git a/interface/src/api/system.ts b/interface/src/api/system.ts index 866545ee6..f9ad2d838 100644 --- a/interface/src/api/system.ts +++ b/interface/src/api/system.ts @@ -52,7 +52,6 @@ export const uploadFile = (file: File) => { const formData = new FormData(); formData.append('file', file); return alovaInstance.Post('/rest/uploadFile', formData, { - timeout: 60000, // override timeout for uploading firmware - 1 minute - enableUpload: true // can be removed with Alova 2.20+ + timeout: 60000 // override timeout for uploading firmware - 1 minute }); }; diff --git a/interface/src/framework/mqtt/MqttSettings.tsx b/interface/src/framework/mqtt/MqttSettings.tsx index 90ad3f61d..ce59362c5 100644 --- a/interface/src/framework/mqtt/MqttSettings.tsx +++ b/interface/src/framework/mqtt/MqttSettings.tsx @@ -374,6 +374,12 @@ const MqttSettings: FC = () => { select > {LL.MQTT_ENTITY_FORMAT_0()} + + {LL.MQTT_ENTITY_FORMAT_1()} (v3.6) + + + {LL.MQTT_ENTITY_FORMAT_2()} (v3.6) + {LL.MQTT_ENTITY_FORMAT_1()} {LL.MQTT_ENTITY_FORMAT_2()} diff --git a/interface/yarn.lock b/interface/yarn.lock index 11035c751..b0cc0999b 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1231,10 +1231,10 @@ __metadata: languageName: node linkType: hard -"@remix-run/router@npm:1.15.3": - version: 1.15.3 - resolution: "@remix-run/router@npm:1.15.3" - checksum: 10/43d402b4ad3dff6dee5c1bc0822aeeb4d885d11c74c45fca7f2f4d7e57853fddbbb813c372919bb3fcc63f95fbcffdd1d4ac1c406857ea07b9d09a09d0562c8e +"@remix-run/router@npm:1.16.0": + version: 1.16.0 + resolution: "@remix-run/router@npm:1.16.0" + checksum: 10/51f5805ec172d8ec038f8eebb5af51cac11e8dc419116c23c3765eaf1d4381390da4ab1cd04874e9126c1ec8ec7283c97efdcaf338095130439111d5218aeed0 languageName: node linkType: hard @@ -1556,12 +1556,12 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:^18.2.25": - version: 18.2.25 - resolution: "@types/react-dom@npm:18.2.25" +"@types/react-dom@npm:^18.3.0": + version: 18.3.0 + resolution: "@types/react-dom@npm:18.3.0" dependencies: "@types/react": "npm:*" - checksum: 10/0e45856a2fdbf09e74632b132b3af773c6b18fc2ab0bd04595c9f2bcc0bb04d5e732ac8156d145b712dedab7484a8fe9dce5cf720a5437b5d26099c7060c7ba4 + checksum: 10/6ff53f5a7b7fba952a68e114d3b542ebdc1e87a794234785ebab0bcd9bde7fb4885f21ebaf93d26dc0a1b5b93287f42cad68b78ae04dddf6b20da7aceff0beaf languageName: node linkType: hard @@ -1606,13 +1606,13 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:^18.2.79": - version: 18.2.79 - resolution: "@types/react@npm:18.2.79" +"@types/react@npm:^18.3.0": + version: 18.3.0 + resolution: "@types/react@npm:18.3.0" dependencies: "@types/prop-types": "npm:*" csstype: "npm:^3.0.2" - checksum: 10/2ef833e7d0a5c226beddbbe090811582371f6ae5e2f092a3d9f47cc6087c8bce0b96ee33e351de6d1d470f0a0ec5892d971933f841ef31538c1821681fc6569e + checksum: 10/2444294740016d61721df9adeb8635658c660c13b0782df9f067260ac6b0a4b71e68245089814ab53264843eb75f81d90f770253b94a13955cc1ddccf3593301 languageName: node linkType: hard @@ -1648,15 +1648,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.7.0" +"@typescript-eslint/eslint-plugin@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/eslint-plugin@npm:7.7.1" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.7.0" - "@typescript-eslint/type-utils": "npm:7.7.0" - "@typescript-eslint/utils": "npm:7.7.0" - "@typescript-eslint/visitor-keys": "npm:7.7.0" + "@typescript-eslint/scope-manager": "npm:7.7.1" + "@typescript-eslint/type-utils": "npm:7.7.1" + "@typescript-eslint/utils": "npm:7.7.1" + "@typescript-eslint/visitor-keys": "npm:7.7.1" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" @@ -1669,44 +1669,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/9e6b6fbb9920581813c01daaa2f89419c3476e42823755c0627f4491640cfaffaebeb0592231ed4f318eefadfcdd4560b77b2903d66ab4e0c8df746a7037a603 + checksum: 10/54064fe466edcebece50cf4cfc4cb18753bcba7da0e3f0db29bf628586716b14945cadf01529ebc3d823e35bc62debf21aa636ae1f5e4fa92670dce65b3dec8c languageName: node linkType: hard -"@typescript-eslint/parser@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/parser@npm:7.7.0" +"@typescript-eslint/parser@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/parser@npm:7.7.1" dependencies: - "@typescript-eslint/scope-manager": "npm:7.7.0" - "@typescript-eslint/types": "npm:7.7.0" - "@typescript-eslint/typescript-estree": "npm:7.7.0" - "@typescript-eslint/visitor-keys": "npm:7.7.0" + "@typescript-eslint/scope-manager": "npm:7.7.1" + "@typescript-eslint/types": "npm:7.7.1" + "@typescript-eslint/typescript-estree": "npm:7.7.1" + "@typescript-eslint/visitor-keys": "npm:7.7.1" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10/9f8c53ca29af09cd366e37420410319c8f69e9f4a676513ecd91f5e6d822b9935b6a8ad7ec931d604fc4a0ecd93d51063d0c93227f78f2380196c8a7fa6970d1 + checksum: 10/39cd5c686e9f7e86da669fc3622b203e1025f162d42c4f45373e827c659b8823535fe4ea62ccb5e672ef999f8491d74c8c5c4c497367c884672fc835497ea180 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/scope-manager@npm:7.7.0" +"@typescript-eslint/scope-manager@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/scope-manager@npm:7.7.1" dependencies: - "@typescript-eslint/types": "npm:7.7.0" - "@typescript-eslint/visitor-keys": "npm:7.7.0" - checksum: 10/c8890aaf99b57543774e50549c5b178c13695b21a6b30c65292268137fe5e6856cc0e050c118b47b5835dd8a48c96e042fc75891a7f6093a0b94b6b3b251afd9 + "@typescript-eslint/types": "npm:7.7.1" + "@typescript-eslint/visitor-keys": "npm:7.7.1" + checksum: 10/7823cd15e7205d2c0d9e69432717c385b2ecd7559d5edba79113c2e97c6c5e8ca3dae9343a734bc740be97e096bfcb9dfb81a3da697f9fbf5600a56a42cf70e9 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/type-utils@npm:7.7.0" +"@typescript-eslint/type-utils@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/type-utils@npm:7.7.1" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.7.0" - "@typescript-eslint/utils": "npm:7.7.0" + "@typescript-eslint/typescript-estree": "npm:7.7.1" + "@typescript-eslint/utils": "npm:7.7.1" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" peerDependencies: @@ -1714,23 +1714,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/a3f5358b4b7046458ea573607f3d6ea7f48e16524390b24c9360bdf8b03cc89fc6eb5da31b3e541e7f1e5f6958194ecaad5b644ca9b0d90c9a7b182f345451aa + checksum: 10/c64dfd3e535741270012d289d1327e487df877adfa8a9920b1f8d6616f3b7159ef8ee1d6b62e866b6a5c64d675c5008e87f4ea20b5fc032e95f197a749d38ae6 languageName: node linkType: hard -"@typescript-eslint/types@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/types@npm:7.7.0" - checksum: 10/d54ff9eeea168188fcbf1c8efe42892d1646ead801ea0a0f1312c80cfb74ee5dd61a145bc982919fb396683fb4578f98f7ad90e5d466d7aa1ca593e4338e1a2e +"@typescript-eslint/types@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/types@npm:7.7.1" + checksum: 10/a1ecbaf3b8a5243394d421644f2b3eb164feea645e36dd07f1afb5008598201f19c7988141fc162c647f380dda7cf571017c0eabbbc4c5432b0143383853e134 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/typescript-estree@npm:7.7.0" +"@typescript-eslint/typescript-estree@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/typescript-estree@npm:7.7.1" dependencies: - "@typescript-eslint/types": "npm:7.7.0" - "@typescript-eslint/visitor-keys": "npm:7.7.0" + "@typescript-eslint/types": "npm:7.7.1" + "@typescript-eslint/visitor-keys": "npm:7.7.1" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -1740,34 +1740,34 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/40af26b3edb07af439f99728aa149bbc8668dae4a700a128abaf98d7f9bc0d5d31f8027aa1d13d6a55b22c20738d7cab84a3046a56417a2551de58671b39dbdf + checksum: 10/df5fe6c573b15e8058b88d1535eeca11115118adc54225f511d2762d74e2d453205ba27e63f6666cb5f3dc73d639208a183fb05db1f75063b115d52b1fae3e20 languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/utils@npm:7.7.0" +"@typescript-eslint/utils@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/utils@npm:7.7.1" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" "@types/json-schema": "npm:^7.0.15" "@types/semver": "npm:^7.5.8" - "@typescript-eslint/scope-manager": "npm:7.7.0" - "@typescript-eslint/types": "npm:7.7.0" - "@typescript-eslint/typescript-estree": "npm:7.7.0" + "@typescript-eslint/scope-manager": "npm:7.7.1" + "@typescript-eslint/types": "npm:7.7.1" + "@typescript-eslint/typescript-estree": "npm:7.7.1" semver: "npm:^7.6.0" peerDependencies: eslint: ^8.56.0 - checksum: 10/4223233ee022460a74f389302b50779537dfbb3bd414486dca356d2628a08d5b2c4c6002bae3bdffad92b368569024faf25faee9be739340d9459c23549a866f + checksum: 10/5a352c3a849300b5d676bf5f451418a2fb0cd3ab515f3733521ad03cf047849c52c76f6e5d2406e08f6d0dbad3a4708b490f909c91a1a9e3d73060a750b3bca2 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.7.0": - version: 7.7.0 - resolution: "@typescript-eslint/visitor-keys@npm:7.7.0" +"@typescript-eslint/visitor-keys@npm:7.7.1": + version: 7.7.1 + resolution: "@typescript-eslint/visitor-keys@npm:7.7.1" dependencies: - "@typescript-eslint/types": "npm:7.7.0" + "@typescript-eslint/types": "npm:7.7.1" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10/9f03591ab60b0b164f6bb222b5d5ae75f73fbe7f264be9318f770be9dc5dff8138d34701928940ffc18924058ae80754a738a1e623912a297d57a8a59cdfb41d + checksum: 10/dcc5748b10bb1b169516b33e87b6d86b562e25725a95e5ac515cb197589d9667aaa7cfffa93234095a73c80addb6dd88e2a9ab01d2be0c274254b5be1ca4057a languageName: node linkType: hard @@ -1789,13 +1789,13 @@ __metadata: "@trivago/prettier-plugin-sort-imports": "npm:^4.3.0" "@types/lodash-es": "npm:^4.17.12" "@types/node": "npm:^20.12.7" - "@types/react": "npm:^18.2.79" - "@types/react-dom": "npm:^18.2.25" + "@types/react": "npm:^18.3.0" + "@types/react-dom": "npm:^18.3.0" "@types/react-router-dom": "npm:^5.3.3" - alova: "npm:2.19.2" + alova: "npm:^2.20.2" async-validator: "npm:^4.2.5" concurrently: "npm:^8.2.2" - eslint: "npm:^9.1.0" + eslint: "npm:^9.1.1" eslint-config-prettier: "npm:^9.1.0" history: "npm:^5.3.0" jwt-decode: "npm:^4.0.0" @@ -1807,13 +1807,13 @@ __metadata: react-dom: "npm:latest" react-dropzone: "npm:^14.2.3" react-icons: "npm:^5.1.0" - react-router-dom: "npm:^6.22.3" + react-router-dom: "npm:^6.23.0" react-toastify: "npm:^10.0.5" rollup-plugin-visualizer: "npm:^5.12.0" - terser: "npm:^5.30.3" + terser: "npm:^5.30.4" typesafe-i18n: "npm:^5.26.2" typescript: "npm:^5.4.5" - typescript-eslint: "npm:^7.7.0" + typescript-eslint: "npm:^7.7.1" vite: "npm:^5.2.10" vite-plugin-imagemin: "npm:^0.6.1" vite-tsconfig-paths: "npm:^4.3.2" @@ -1876,10 +1876,10 @@ __metadata: languageName: node linkType: hard -"alova@npm:2.19.2": - version: 2.19.2 - resolution: "alova@npm:2.19.2" - checksum: 10/8790c82dd5c1345397d4074c9730eb2ccf3363cffa64009943531fc36091170287de7271531262d5d096c88bcaebe0ebdc7efca5f52cc60aa438abc0818d6cee +"alova@npm:^2.20.2": + version: 2.20.2 + resolution: "alova@npm:2.20.2" + checksum: 10/355350451828e9ce473ba1eafeb7a93dc3177cb768cb7734ecb7f42aeda1440ba19aecb22b6d896f4f314235e1c18c55267251fbb9f2c47f79ace5f11d947644 languageName: node linkType: hard @@ -3282,9 +3282,9 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^9.1.0": - version: 9.1.0 - resolution: "eslint@npm:9.1.0" +"eslint@npm:^9.1.1": + version: 9.1.1 + resolution: "eslint@npm:9.1.1" dependencies: "@eslint-community/eslint-utils": "npm:^4.2.0" "@eslint-community/regexpp": "npm:^4.6.1" @@ -3322,7 +3322,7 @@ __metadata: text-table: "npm:^0.2.0" bin: eslint: bin/eslint.js - checksum: 10/8a8902a9aed9113f13638b78794cbe2a711b44300cc0ec05b00e017d52d94b209cf1af81caaaad8cfb4087870f850d7da8e3a892d186c657fb5a21cb1b802379 + checksum: 10/d0bf8c6335b26a489935df10b74505c0b43ba16a333d938c820ffd097faec05cc0aa27006f5e4091d2c3d10367da3aab01a37bace59d61932976bd7af6dcb99c languageName: node linkType: hard @@ -5904,27 +5904,27 @@ __metadata: languageName: node linkType: hard -"react-router-dom@npm:^6.22.3": - version: 6.22.3 - resolution: "react-router-dom@npm:6.22.3" +"react-router-dom@npm:^6.23.0": + version: 6.23.0 + resolution: "react-router-dom@npm:6.23.0" dependencies: - "@remix-run/router": "npm:1.15.3" - react-router: "npm:6.22.3" + "@remix-run/router": "npm:1.16.0" + react-router: "npm:6.23.0" peerDependencies: react: ">=16.8" react-dom: ">=16.8" - checksum: 10/868a530c3167e1903f170818c0162760b8fbe9b10a7a7a79e5998990df341cd7127ba7819af4a9105af72c13453c7c4d76b2b07a70b56fff012fa0508b51940e + checksum: 10/8825c9b5d5731cb8ecf39e927949cb24474d0f3aff4ffc75b2c236c5678c4970eada98160c6fef3a99c0bdb59ce25d8951da9fdc4ac103135e450f200426c778 languageName: node linkType: hard -"react-router@npm:6.22.3": - version: 6.22.3 - resolution: "react-router@npm:6.22.3" +"react-router@npm:6.23.0": + version: 6.23.0 + resolution: "react-router@npm:6.23.0" dependencies: - "@remix-run/router": "npm:1.15.3" + "@remix-run/router": "npm:1.16.0" peerDependencies: react: ">=16.8" - checksum: 10/df3948afd6500faf4b82a72375b9177536d878d54cad18e20a175efcbfdd0d94852aac59660d786946636ed325284d94a8f46652d898df304d6a29c9a3932afd + checksum: 10/1b5228bec63147b3cf5c645ed7eac5eeca5561c70f348b61ed3af9acf86b1a181ec4af28320419eadad626c6e725defd7eb8d7418cc6080384fc7956e0325947 languageName: node linkType: hard @@ -6785,9 +6785,9 @@ __metadata: languageName: node linkType: hard -"terser@npm:^5.30.3": - version: 5.30.3 - resolution: "terser@npm:5.30.3" +"terser@npm:^5.30.4": + version: 5.30.4 + resolution: "terser@npm:5.30.4" dependencies: "@jridgewell/source-map": "npm:^0.3.3" acorn: "npm:^8.8.2" @@ -6795,7 +6795,7 @@ __metadata: source-map-support: "npm:~0.5.20" bin: terser: bin/terser - checksum: 10/f4ee378065a327c85472f351ac232fa47ec84d4f15df7ec58c044b41e3c063cf11aaedd90dcfe9c7f2a6ef01d4aab23deb61622301170dc77d0a8b6a6a83cf5e + checksum: 10/79459106281fccb2ff4243ba1553e4aa67a71b336bb8c091b131bb26347fcf03791c6abf6870bd17fe4a210256e08910207cf5733c0d6ba840289e67d5aa84d3 languageName: node linkType: hard @@ -6934,19 +6934,19 @@ __metadata: languageName: node linkType: hard -"typescript-eslint@npm:^7.7.0": - version: 7.7.0 - resolution: "typescript-eslint@npm:7.7.0" +"typescript-eslint@npm:^7.7.1": + version: 7.7.1 + resolution: "typescript-eslint@npm:7.7.1" dependencies: - "@typescript-eslint/eslint-plugin": "npm:7.7.0" - "@typescript-eslint/parser": "npm:7.7.0" - "@typescript-eslint/utils": "npm:7.7.0" + "@typescript-eslint/eslint-plugin": "npm:7.7.1" + "@typescript-eslint/parser": "npm:7.7.1" + "@typescript-eslint/utils": "npm:7.7.1" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10/1ffb650b25f52bb5b541a0669d0cd569175ae5c02aec39687b8401c373ab5fbf4bce2d1b110c665e3b19d1afc4857f58db52e161aa0208468b5da5339283d89d + checksum: 10/fd77c7b31b66438164edc2ad3eb79a14f8621162994af04e7e9a8b93a863bfcb25476bb339b8891044b56f7c42355b74ecc4b47e3fb4a848821d14ee38c4af26 languageName: node linkType: hard diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 338fe5dfb..b0056f5f6 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -1755,19 +1755,15 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr telegram) { } // data: displaycode(2), errornumber(2), year, month, hour, day, minute, duration(2), src-addr static uint32_t lastCodeDate_ = 0; // last code date - char code[3] = {0}; - uint16_t codeNo = EMS_VALUE_INT16_NOTSET; - code[0] = telegram->message_data[0]; - code[1] = telegram->message_data[1]; - code[2] = 0; - telegram->read_value(codeNo, 2); - uint16_t year = (telegram->message_data[4] & 0x7F) + 2000; - uint8_t month = telegram->message_data[5]; - uint8_t day = telegram->message_data[7]; - uint8_t hour = telegram->message_data[6]; - uint8_t min = telegram->message_data[8]; - uint16_t duration = telegram->message_data[9]; - uint32_t date = (year - 2000) * 535680UL + month * 44640UL + day * 1440UL + hour * 60 + min + duration; + char code[3] = {telegram->message_data[0], telegram->message_data[1], 0}; + uint16_t codeNo = telegram->message_data[2] * 256 + telegram->message_data[3]; + uint16_t year = (telegram->message_data[4] & 0x7F) + 2000; + uint8_t month = telegram->message_data[5]; + uint8_t day = telegram->message_data[7]; + uint8_t hour = telegram->message_data[6]; + uint8_t min = telegram->message_data[8]; + uint16_t duration = telegram->message_data[9] * 256 + telegram->message_data[10]; + uint32_t date = (year - 2000) * 535680UL + month * 44640UL + day * 1440UL + hour * 60 + min + duration; // store only the newest code from telegrams 10 and 11 if (date > lastCodeDate_ && lastCodeDate_) { lastCodeDate_ = date; diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 59a2049d6..72b8c4fe0 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -164,7 +164,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i register_telegram_type(hpmode_typeids[i], "HPMode", true, MAKE_PF_CB(process_HPMode)); } register_telegram_type(0x2F5, "RC300WWmode", true, MAKE_PF_CB(process_RC300WWmode)); - register_telegram_type(0x2F6, "RC300WW2mode", true, MAKE_PF_CB(process_RC300WW2mode)); + register_telegram_type(0x2F6, "RC300WW2mode", true, MAKE_PF_CB(process_RC300WWmode)); register_telegram_type(0x31B, "RC300WWtemp", true, MAKE_PF_CB(process_RC300WWtemp)); register_telegram_type(0x31D, "RC300WWmode2", false, MAKE_PF_CB(process_RC300WWmode2)); register_telegram_type(0x31E, "RC300WWmode2", false, MAKE_PF_CB(process_RC300WWmode2)); @@ -223,9 +223,9 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i // returns the heating circuit object based on the hc number // of nullptr if it doesn't exist yet -std::shared_ptr Thermostat::heating_circuit(const uint8_t hc_num) { +std::shared_ptr Thermostat::heating_circuit(const int8_t id) { // if hc_num is 0 then return the first existing hc in the list - if (hc_num == AUTO_HEATING_CIRCUIT) { + if (id == AUTO_HEATING_CIRCUIT) { for (const auto & heating_circuit : heating_circuits_) { if (heating_circuit->is_active()) { return heating_circuit; @@ -234,6 +234,7 @@ std::shared_ptr Thermostat::heating_circuit(const ui } // otherwise find a match + uint8_t hc_num = (uint8_t)id; for (const auto & heating_circuit : heating_circuits_) { if ((heating_circuit->hc_num() == hc_num) && heating_circuit->is_active()) { return heating_circuit; @@ -557,6 +558,25 @@ uint8_t Thermostat::HeatingCircuit::get_mode_type() const { return HeatingCircuit::Mode::DAY; } +std::shared_ptr Thermostat::dhw_circuit(const uint8_t offset, const uint8_t dhw_num, const bool create) { + // check for existing circuit + for (const auto & dhw_circuit : dhw_circuits_) { + if (dhw_circuit->dhw() == dhw_num - 1 || dhw_circuit->offset() == offset) { + return dhw_circuit; + } + } + if (!create) { + return nullptr; + } + // create a new circuit object and add to the list + auto new_dhw = std::make_shared(offset, dhw_num); + dhw_circuits_.push_back(new_dhw); + // register the device values + register_device_values_dhw(new_dhw); + + return new_dhw; // return back point to new HC object +} + // type 0xB1 - data from the RC10 thermostat (0x17) // Data: 04 23 00 BA 00 00 00 BA void Thermostat::process_RC10Monitor(std::shared_ptr telegram) { @@ -581,9 +601,10 @@ void Thermostat::process_RC10Set(std::shared_ptr telegram) { if (hc == nullptr) { return; } + auto dhw = dhw_circuit(0, 1, true); has_update(telegram, ibaCalIntTemperature_, 0); has_update(telegram, backlight_, 1); - has_update(telegram, wwMode_, 2); + has_update(telegram, dhw->wwMode_, 2); has_update(telegram, hc->nighttemp, 3); has_update(telegram, hc->daytemp, 4); has_update(telegram, hc->reducehours, 5); @@ -652,7 +673,7 @@ void Thermostat::process_RC20Timer(std::shared_ptr telegram) { uint8_t time = telegram->message_data[1]; // we use EN settings for the day abbreviation - auto sday = (FL_(enum_dayOfWeek)[day][0]); + auto sday = FL_(enum_dayOfWeek)[day][0]; if (day == 7) { snprintf(data, sizeof(data), "%02d not_set", no); @@ -856,37 +877,40 @@ void Thermostat::process_IBASettings(std::shared_ptr telegram) { // Settings WW 0x37 - RC35 void Thermostat::process_RC35wwSettings(std::shared_ptr telegram) { - has_update(telegram, wwProgMode_, 0); // 0-like hc, 0xFF own prog - has_update(telegram, wwCircProg_, 1); // 0-like hc, 0xFF own prog - has_update(telegram, wwMode_, 2); // 0-off, 1-on, 2-auto - has_update(telegram, wwCircMode_, 3); // 0-off, 1-on, 2-auto - has_update(telegram, wwDisinfecting_, 4); // 0-off, 0xFF on - has_update(telegram, wwDisinfectDay_, 5); // 0-6 Day of week, 7 every day - has_update(telegram, wwDisinfectHour_, 6); - has_update(telegram, wwMaxTemp_, 8); // Limiter 60 degrees - has_update(telegram, wwOneTimeKey_, 9); // 0-off, 0xFF on + auto dhw = dhw_circuit(0, 1, true); + has_update(telegram, dhw->wwProgMode_, 0); // 0-like hc, 0xFF own prog + has_update(telegram, dhw->wwCircProg_, 1); // 0-like hc, 0xFF own prog + has_update(telegram, dhw->wwMode_, 2); // 0-off, 1-on, 2-auto + has_update(telegram, dhw->wwCircMode_, 3); // 0-off, 1-on, 2-auto + has_update(telegram, dhw->wwDisinfecting_, 4); // 0-off, 0xFF on + has_update(telegram, dhw->wwDisinfectDay_, 5); // 0-6 Day of week, 7 every day + has_update(telegram, dhw->wwDisinfectHour_, 6); + has_update(telegram, dhw->wwMaxTemp_, 8); // Limiter 60 degrees + has_update(telegram, dhw->wwOneTimeKey_, 9); // 0-off, 0xFF on } // Settings WW 0x3A - RC30 void Thermostat::process_RC30wwSettings(std::shared_ptr telegram) { - has_update(telegram, wwMode_, 0); // 0-on, 1-off, 2-auto - has_update(telegram, wwWhenModeOff_, 1); // 0-off, 0xFF on - has_update(telegram, wwDisinfecting_, 2); // 0-off, 0xFF on - has_update(telegram, wwDisinfectDay_, 3); // 0-6 Day of week, 7 every day - has_update(telegram, wwDisinfectHour_, 4); + auto dhw = dhw_circuit(0, 1, true); + has_update(telegram, dhw->wwMode_, 0); // 0-on, 1-off, 2-auto + has_update(telegram, dhw->wwWhenModeOff_, 1); // 0-off, 0xFF on + has_update(telegram, dhw->wwDisinfecting_, 2); // 0-off, 0xFF on + has_update(telegram, dhw->wwDisinfectDay_, 3); // 0-6 Day of week, 7 every day + has_update(telegram, dhw->wwDisinfectHour_, 4); } // type 0x38 (ww) and 0x39 (circ) void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { + auto dhw = dhw_circuit(0, 1, true); if ((telegram->message_length == 2 && telegram->offset < 83 && !(telegram->offset & 1)) - || (!telegram->offset && telegram->type_id == 0x38 && !strlen(wwSwitchTime_) && telegram->message_length > 1) - || (!telegram->offset && telegram->type_id == 0x39 && !strlen(wwCircSwitchTime_) && telegram->message_length > 1)) { + || (!telegram->offset && telegram->type_id == 0x38 && !strlen(dhw->wwSwitchTime_) && telegram->message_length > 1) + || (!telegram->offset && telegram->type_id == 0x39 && !strlen(dhw->wwCircSwitchTime_) && telegram->message_length > 1)) { uint8_t no = telegram->offset / 2; uint8_t day = telegram->message_data[0] >> 5; uint8_t on = telegram->message_data[0] & 1; uint8_t time = telegram->message_data[1]; - char data[sizeof(wwSwitchTime_)]; + char data[sizeof(dhw->wwSwitchTime_)]; // we use EN settings for the day abbreviation auto sday = (FL_(enum_dayOfWeek)[day][0]); if (day == 7) { @@ -895,9 +919,9 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { snprintf(data, sizeof(data), "%02d %s %02d:%02d %s", no, sday, time / 6, 10 * (time % 6), on ? "on" : "off"); } if (telegram->type_id == 0x38) { - has_update(wwSwitchTime_, data, sizeof(wwSwitchTime_)); + has_update(dhw->wwSwitchTime_, data, sizeof(dhw->wwSwitchTime_)); } else { - has_update(wwCircSwitchTime_, data, sizeof(wwCircSwitchTime_)); + has_update(dhw->wwCircSwitchTime_, data, sizeof(dhw->wwCircSwitchTime_)); } if (is_fetch(telegram->type_id)) { toggle_fetch(telegram->type_id, false); // dont fetch again @@ -910,7 +934,7 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { } if (telegram->message_length + telegram->offset >= 92 && telegram->offset <= 87) { - char data[sizeof(wwVacation_)]; + char data[sizeof(dhw->wwVacation_)]; snprintf(data, sizeof(data), "%02d.%02d.%04d-%02d.%02d.%04d", @@ -920,11 +944,11 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { telegram->message_data[90 - telegram->offset], telegram->message_data[91 - telegram->offset], telegram->message_data[92 - telegram->offset] + 2000); - has_update(wwVacation_, data, sizeof(wwVacation_)); + has_update(dhw->wwVacation_, data, sizeof(dhw->wwVacation_)); } if (telegram->message_length + telegram->offset >= 98 && telegram->offset <= 93) { - char data[sizeof(wwHoliday_)]; + char data[sizeof(dhw->wwHoliday_)]; snprintf(data, sizeof(data), "%02d.%02d.%04d-%02d.%02d.%04d", @@ -934,7 +958,7 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { telegram->message_data[96 - telegram->offset], telegram->message_data[97 - telegram->offset], telegram->message_data[98 - telegram->offset] + 2000); - has_update(wwHoliday_, data, sizeof(wwHoliday_)); + has_update(dhw->wwHoliday_, data, sizeof(dhw->wwHoliday_)); } } @@ -990,7 +1014,8 @@ void Thermostat::process_JunkersSetMixer(std::shared_ptr telegra } void Thermostat::process_JunkersWW(std::shared_ptr telegram) { - has_bitupdate(telegram, wwCharge_, 0, 3); + auto dhw = dhw_circuit(0, 1, true); + has_bitupdate(telegram, dhw->wwCharge_, 0, 3); } // type 0x02A5 - data from Worchester CRF200 @@ -1169,82 +1194,57 @@ void Thermostat::process_RC300Curve(std::shared_ptr telegram) { } } -// types 0x31B (and 0x31C?) +// types 0x31B void Thermostat::process_RC300WWtemp(std::shared_ptr telegram) { - has_update(telegram, wwSetTemp_, 0); - has_update(telegram, wwSetTempLow_, 1); + auto dhw = dhw_circuit(0, 1, true); + has_update(telegram, dhw->wwSetTemp_, 0); + has_update(telegram, dhw->wwSetTempLow_, 1); } // type 02F5 // RC300WWmode(0x2F5), data: 01 FF 04 00 00 00 08 05 00 08 04 00 00 00 00 00 00 00 00 00 01 -void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { - // circulation pump see: https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20der%20Bedieneinheit%20RC310.md - has_update(telegram, wwCircPump_, 1); // FF=off, 0=on ? - - if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) { - const uint8_t modes[] = {0, 5, 1, 2, 4}; // off, eco+, eco, comfort, auto - uint8_t wwmode = wwMode_ < sizeof(modes) ? modes[wwMode_] : EMS_VALUE_UINT8_NOTSET; - telegram->read_value(wwmode, 2); - const uint8_t modes1[] = {0, 2, 3, 0, 4, 1}; - has_update(wwMode_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET); - } else { - has_update(telegram, wwMode_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog - } - has_update(telegram, wwCircMode_, 3); // 0=off, 1=on, 2=auto, 4=own? - has_update(telegram, wwChargeDuration_, 10); // value in steps of 15 min - has_update(telegram, wwCharge_, 11); // bool 0xFF on - has_update(telegram, wwDisinfecting_, 5); // 0-off, 0xFF on - has_update(telegram, wwDisinfectHour_, 6); // value in steps of 15 min - has_update(telegram, wwDisinfectDay_, 7); // 0-6 Day of week, 7 every day - has_update(telegram, wwDailyHeating_, 8); // 0-off, 0xFF on - has_update(telegram, wwDailyHeatTime_, 9); // value in steps of 15 min -} - -// type 02F6 // RC300WWmode(0x2F6), data: 02 FF 04 00 00 00 08 05 00 08 04 00 00 00 00 00 00 00 00 00 01 -void Thermostat::process_RC300WW2mode(std::shared_ptr telegram) { - telegram->read_value(wwCircuit2_, 0); - if (wwCircuit2_ == 0) { - toggle_fetch(telegram->type_id, false); +void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { + uint8_t circuit = 0; + telegram->read_value(circuit, 0); + if (!circuit) { return; } - toggle_fetch(telegram->type_id, true); - has_update(telegram, wwCircPump2_, 1); // FF=off, 0=on ? + auto dhw = dhw_circuit(telegram->type_id - 0x2F5, circuit, true); + // circulation pump see: https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20der%20Bedieneinheit%20RC310.md + has_update(telegram, dhw->wwCircPump_, 1); // FF=off, 0=on ? if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) { const uint8_t modes[] = {0, 5, 1, 2, 4}; // off, eco+, eco, comfort, auto - uint8_t wwmode = wwMode_ < sizeof(modes) ? modes[wwMode2_] : EMS_VALUE_UINT8_NOTSET; + uint8_t wwmode = dhw->wwMode_ < sizeof(modes) ? modes[dhw->wwMode_] : EMS_VALUE_UINT8_NOTSET; telegram->read_value(wwmode, 2); const uint8_t modes1[] = {0, 2, 3, 0, 4, 1}; - has_update(wwMode2_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET); + has_update(dhw->wwMode_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET); } else { - has_update(telegram, wwMode2_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog + has_update(telegram, dhw->wwMode_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog } - has_update(telegram, wwCircMode2_, 3); // 0=off, 1=on, 2=auto, 4=own? - has_update(telegram, wwChargeDuration2_, 10); // value in steps of 15 min - has_update(telegram, wwCharge2_, 11); // bool 0xFF on - has_update(telegram, wwDisinfecting2_, 5); // 0-off, 0xFF on - has_update(telegram, wwDisinfectHour2_, 6); // value in steps of 15 min - has_update(telegram, wwDisinfectDay2_, 7); // 0-6 Day of week, 7 every day - has_update(telegram, wwDailyHeating2_, 8); // 0-off, 0xFF on - has_update(telegram, wwDailyHeatTime2_, 9); // value in steps of 15 min + has_update(telegram, dhw->wwCircMode_, 3); // 0=off, 1=on, 2=auto, 4=own? + has_update(telegram, dhw->wwChargeDuration_, 10); // value in steps of 15 min + has_update(telegram, dhw->wwCharge_, 11); // bool 0xFF on + has_update(telegram, dhw->wwDisinfecting_, 5); // 0-off, 0xFF on + has_update(telegram, dhw->wwDisinfectHour_, 6); // value in steps of 15 min + has_update(telegram, dhw->wwDisinfectDay_, 7); // 0-6 Day of week, 7 every day + has_update(telegram, dhw->wwDailyHeating_, 8); // 0-off, 0xFF on + has_update(telegram, dhw->wwDailyHeatTime_, 9); // value in steps of 15 min } // types 0x31D and 0x31E // RC300WWmode2(0x31D), data: 00 00 09 07 void Thermostat::process_RC300WWmode2(std::shared_ptr telegram) { - if (telegram->type_id == 0x31E && wwCircuit2_ == 0) { + auto dhw = dhw_circuit(telegram->type_id - 0x31D); + if (dhw == nullptr) { return; } // 0x31D for WW system 1, 0x31E for WW system 2 // pos 1 = holiday mode // pos 2 = current status of DHW setpoint // pos 3 = current status of DHW circulation pump - if (telegram->type_id == 0x031D) { - has_update(telegram, wwExtra1_, 0); // 0=no, 1=yes - } else { - has_update(telegram, wwExtra2_, 0); // 0=no, 1=yes - } + has_update(telegram, dhw->wwExtra_, 0); // 0=no, 1=yes } // 0x23A damped outdoor temp @@ -1263,7 +1263,7 @@ void Thermostat::process_RC300Settings(std::shared_ptr telegram) // 0x2CC - e.g. wwprio for RC310 hcx parameter void Thermostat::process_RC300Set2(std::shared_ptr telegram) { - // typeids are not in a raw. hc:0x2CC, hc2: 0x2CE for RC310 + // typeids are not in a row. hc:0x2CC, hc2: 0x2CE for RC310 // telegram is either offset 3 with data length of 1 and values 0/1 (radiators) - 10 0B FF 03 01 CC 01 F6 // or offset 0 with data length of 6 bytes - offset 3 values are 0x00 or 0xFF - 10 0B FF 00 01 CE FF 13 0A FF 1E 00 20 @@ -1621,8 +1621,7 @@ void Thermostat::process_RCErrorMessage(std::shared_ptr telegram // hp mode RC300 bool Thermostat::set_roomtempdiff(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -1634,8 +1633,7 @@ bool Thermostat::set_roomtempdiff(const char * value, const int8_t id) { return false; } bool Thermostat::set_dewoffset(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -1648,8 +1646,7 @@ bool Thermostat::set_dewoffset(const char * value, const int8_t id) { } bool Thermostat::set_hpminflowtemp(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -1662,8 +1659,7 @@ bool Thermostat::set_hpminflowtemp(const char * value, const int8_t id) { } bool Thermostat::set_hpmode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -1855,8 +1851,7 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) { return false; } - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -1881,6 +1876,7 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) { } else { hc->remotetemp = EMS_VALUE_INT16_NOTSET; Roomctrl::set_remotetemp(0, hc->hc(), EMS_VALUE_INT16_NOTSET); // unknown remote set, switch off + return false; } } @@ -1893,8 +1889,7 @@ bool Thermostat::set_remotehum(const char * value, const int8_t id) { return false; } - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -1984,8 +1979,7 @@ bool Thermostat::set_language(const char * value, const int8_t id) { // Set the control-mode for hc 0-off, 1-RC20, 2-RC3x bool Thermostat::set_control(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2024,8 +2018,7 @@ bool Thermostat::set_control(const char * value, const int8_t id) { // Set sensor for Junkers, 1-external (from remote), 2-internal, 3-minimum value from int/ext bool Thermostat::set_roomsensor(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2042,7 +2035,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) { // sets the thermostat ww working mode, where mode is a string, ems and ems+ bool Thermostat::set_wwmode(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; uint8_t set; if (model() == EMSdevice::EMS_DEVICE_FLAG_RC10) { @@ -2114,7 +2107,7 @@ bool Thermostat::set_wwtemplow(const char * value, const int8_t id) { // Set ww charge RC300, ems+ bool Thermostat::set_wwcharge(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; bool b; if (!Helpers::value2bool(value, b)) { return false; @@ -2131,7 +2124,7 @@ bool Thermostat::set_wwcharge(const char * value, const int8_t id) { // Set ww charge duration in steps of 15 min, ems+ bool Thermostat::set_wwchargeduration(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; int t; if (!Helpers::value2number(value, t)) { return false; @@ -2144,8 +2137,7 @@ bool Thermostat::set_wwchargeduration(const char * value, const int8_t id) { // set ww prio bool Thermostat::set_wwprio(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2165,7 +2157,7 @@ bool Thermostat::set_wwprio(const char * value, const int8_t id) { // set cooling bool Thermostat::set_cooling(const char * value, const int8_t id) { - std::shared_ptr hc = heating_circuit((id == -1) ? AUTO_HEATING_CIRCUIT : id); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2180,7 +2172,7 @@ bool Thermostat::set_cooling(const char * value, const int8_t id) { // sets the thermostat ww circulation working mode, where mode is a string bool Thermostat::set_wwcircmode(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; uint8_t set; if ((model() == EMSdevice::EMS_DEVICE_FLAG_BC400) || (model() == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model() == EMSdevice::EMS_DEVICE_FLAG_RC100)) { @@ -2200,7 +2192,7 @@ bool Thermostat::set_wwcircmode(const char * value, const int8_t id) { } bool Thermostat::set_wwDailyHeating(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; bool b; if (!Helpers::value2bool(value, b)) { return false; @@ -2211,7 +2203,7 @@ bool Thermostat::set_wwDailyHeating(const char * value, const int8_t id) { } bool Thermostat::set_wwDailyHeatTime(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; int set; if (!Helpers::value2number(value, set)) { return false; @@ -2229,7 +2221,7 @@ bool Thermostat::set_wwDailyHeatTime(const char * value, const int8_t id) { } bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; bool b; if (!Helpers::value2bool(value, b)) { return false; @@ -2247,7 +2239,7 @@ bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) { } bool Thermostat::set_wwDisinfectDay(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; uint8_t set; if (!Helpers::value2enum(value, set, FL_(enum_dayOfWeek))) { return false; @@ -2265,7 +2257,7 @@ bool Thermostat::set_wwDisinfectDay(const char * value, const int8_t id) { } bool Thermostat::set_wwDisinfectHour(const char * value, const int8_t id) { - uint8_t dhw = (id == DeviceValueTAG::TAG_DHW2 - DeviceValueTAG::TAG_HC1 + 1) ? 1 : 0; + uint8_t dhw = id - DeviceValueTAG::TAG_DHW1; int set; if ((model() == EMSdevice::EMS_DEVICE_FLAG_BC400) || (model() == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model() == EMSdevice::EMS_DEVICE_FLAG_RC100)) { if (!Helpers::value2number(value, set, 0, 1431)) { @@ -2382,8 +2374,7 @@ bool Thermostat::set_wwCircProg(const char * value, const int8_t id) { // set the holiday or vacations as string dd.mm.yyyy-dd.mm.yyyy bool Thermostat::set_holiday(const char * value, const int8_t id, const bool vacation) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (value == nullptr) { return false; @@ -2427,8 +2418,7 @@ bool Thermostat::set_holiday(const char * value, const int8_t id, const bool vac // set pause in hours bool Thermostat::set_pause(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2448,8 +2438,7 @@ bool Thermostat::set_pause(const char * value, const int8_t id) { // set partymode in hours bool Thermostat::set_party(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; @@ -2531,8 +2520,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { // set RC300 roominfluence factor bool Thermostat::set_roominfl_factor(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2552,8 +2540,7 @@ bool Thermostat::set_roominfl_factor(const char * value, const int8_t id) { // set Junkers roominfluence mode bool Thermostat::set_roominfl_mode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2617,39 +2604,37 @@ bool Thermostat::set_mode(const char * value, const int8_t id) { } } - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; // heating circuit - // compare the english string auto mode = mode_list[enum_index][0]; if (!strcmp(mode, FL_(auto)[0])) { - return set_mode_n(HeatingCircuit::Mode::AUTO, hc_num); + return set_mode_n(HeatingCircuit::Mode::AUTO, id); } if (!strcmp(mode, FL_(off)[0])) { - return set_mode_n(HeatingCircuit::Mode::OFF, hc_num); + return set_mode_n(HeatingCircuit::Mode::OFF, id); } if (!strcmp(mode, FL_(manual)[0])) { - return set_mode_n(HeatingCircuit::Mode::MANUAL, hc_num); + return set_mode_n(HeatingCircuit::Mode::MANUAL, id); } if (!strcmp(mode, FL_(day)[0])) { - return set_mode_n(HeatingCircuit::Mode::DAY, hc_num); + return set_mode_n(HeatingCircuit::Mode::DAY, id); } if (!strcmp(mode, FL_(night)[0])) { - return set_mode_n(HeatingCircuit::Mode::NIGHT, hc_num); + return set_mode_n(HeatingCircuit::Mode::NIGHT, id); } if (!strcmp(mode, FL_(heat)[0])) { - return set_mode_n(HeatingCircuit::Mode::HEAT, hc_num); + return set_mode_n(HeatingCircuit::Mode::HEAT, id); } if (!strcmp(mode, FL_(nofrost)[0])) { - return set_mode_n(HeatingCircuit::Mode::NOFROST, hc_num); + return set_mode_n(HeatingCircuit::Mode::NOFROST, id); } if (!strcmp(mode, FL_(eco)[0])) { - return set_mode_n(HeatingCircuit::Mode::ECO, hc_num); + return set_mode_n(HeatingCircuit::Mode::ECO, id); } if (!strcmp(mode, FL_(holiday)[0])) { - return set_mode_n(HeatingCircuit::Mode::HOLIDAY, hc_num); + return set_mode_n(HeatingCircuit::Mode::HOLIDAY, id); } if (!strcmp(mode, FL_(comfort)[0])) { - return set_mode_n(HeatingCircuit::Mode::COMFORT, hc_num); + return set_mode_n(HeatingCircuit::Mode::COMFORT, id); } return false; // not found @@ -2657,9 +2642,8 @@ bool Thermostat::set_mode(const char * value, const int8_t id) { // Set the thermostat working mode // mode is HeatingCircuit::Mode -bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) { - // get hc based on number - std::shared_ptr hc = heating_circuit(hc_num); +bool Thermostat::set_mode_n(const uint8_t mode, const int8_t id) { + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2767,8 +2751,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) { // sets the thermostat summermode for RC300 bool Thermostat::set_summermode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2793,8 +2776,7 @@ bool Thermostat::set_summermode(const char * value, const int8_t id) { // Set fastheatupfactor, ems+ bool Thermostat::set_fastheatup(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2811,8 +2793,7 @@ bool Thermostat::set_fastheatup(const char * value, const int8_t id) { // Set holidaymode Junkers bool Thermostat::set_holidaymode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2832,8 +2813,7 @@ bool Thermostat::set_holidaymode(const char * value, const int8_t id) { // Set heatup mode Junkers bool Thermostat::set_heatup(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2849,8 +2829,7 @@ bool Thermostat::set_heatup(const char * value, const int8_t id) { // Set switchonoptimization RC310 bool Thermostat::set_switchonoptimization(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2871,8 +2850,7 @@ bool Thermostat::set_switchonoptimization(const char * value, const int8_t id) { } bool Thermostat::set_boost(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2885,8 +2863,7 @@ bool Thermostat::set_boost(const char * value, const int8_t id) { } bool Thermostat::set_boosttime(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2899,8 +2876,7 @@ bool Thermostat::set_boosttime(const char * value, const int8_t id) { } bool Thermostat::set_heatondelay(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2913,8 +2889,7 @@ bool Thermostat::set_heatondelay(const char * value, const int8_t id) { } bool Thermostat::set_heatoffdelay(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2927,8 +2902,7 @@ bool Thermostat::set_heatoffdelay(const char * value, const int8_t id) { } bool Thermostat::set_instantstart(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2942,8 +2916,7 @@ bool Thermostat::set_instantstart(const char * value, const int8_t id) { // sets the thermostat reducemode for RC35 and RC310 bool Thermostat::set_reducemode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2966,8 +2939,7 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) { // sets the thermostat reducemode for RC35 vacations bool Thermostat::set_vacreducemode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -2983,8 +2955,7 @@ bool Thermostat::set_vacreducemode(const char * value, const int8_t id) { // sets the thermostat nofrost mode for RC35, RC300/RC310 bool Thermostat::set_nofrostmode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3005,8 +2976,7 @@ bool Thermostat::set_nofrostmode(const char * value, const int8_t id) { // sets the thermostat heatingtype for RC35, RC300 bool Thermostat::set_heatingtype(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3034,8 +3004,7 @@ bool Thermostat::set_heatingtype(const char * value, const int8_t id) { // sets the thermostat controlmode for RC35, RC300 bool Thermostat::set_controlmode(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3073,8 +3042,7 @@ bool Thermostat::set_controlmode(const char * value, const int8_t id) { // sets the thermostat time for nightmode for RC10, telegram 0xB0 bool Thermostat::set_reducehours(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3223,8 +3191,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char // set switchtime for own1 program bool Thermostat::set_switchtime1(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3241,8 +3208,7 @@ bool Thermostat::set_switchtime1(const char * value, const int8_t id) { // set switchtime for own2 program bool Thermostat::set_switchtime2(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3258,11 +3224,15 @@ bool Thermostat::set_switchtime2(const char * value, const int8_t id) { } // sets a single switchtime in the thermostat dhw program for RC35 bool Thermostat::set_wwCircSwitchTime(const char * value, const int8_t id) { - char out[sizeof(wwCircSwitchTime_)] = {'\0'}; + auto dhw = dhw_circuit(255, id - DeviceValueTAG::TAG_DHW1 + 1); + if (dhw == nullptr) { + return false; + } + char out[sizeof(dhw->wwCircSwitchTime_)] = {'\0'}; if (set_switchtime(value, 0x39, out, sizeof(out))) { if (strlen(out)) { - has_update(wwCircSwitchTime_, out, sizeof(wwCircSwitchTime_)); + has_update(dhw->wwCircSwitchTime_, out, sizeof(dhw->wwCircSwitchTime_)); } return true; } @@ -3271,11 +3241,16 @@ bool Thermostat::set_wwCircSwitchTime(const char * value, const int8_t id) { // sets a single switchtime in the thermostat circulation program for RC35 bool Thermostat::set_wwSwitchTime(const char * value, const int8_t id) { - char out[sizeof(wwSwitchTime_)] = {'\0'}; + auto dhw = dhw_circuit(255, id - DeviceValueTAG::TAG_DHW1 + 1); + if (dhw != nullptr) { + return false; + } + char out[sizeof(dhw->wwSwitchTime_)] = {'\0'}; + if (set_switchtime(value, 0x38, out, sizeof(out))) { if (strlen(out)) { - has_update(wwSwitchTime_, out, sizeof(wwSwitchTime_)); + has_update(dhw->wwSwitchTime_, out, sizeof(dhw->wwSwitchTime_)); } return true; } @@ -3284,8 +3259,7 @@ bool Thermostat::set_wwSwitchTime(const char * value, const int8_t id) { // sets the thermostat program for RC35 and RC20 bool Thermostat::set_program(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3321,9 +3295,8 @@ bool Thermostat::set_program(const char * value, const int8_t id) { // Set the temperature of the thermostat // the id passed into this function is the heating circuit number -bool Thermostat::set_temperature(const float temperature, const uint8_t mode, const uint8_t hc_num) { - // get hc based on number - std::shared_ptr hc = heating_circuit(hc_num); +bool Thermostat::set_temperature(const float temperature, const uint8_t mode, const int8_t id) { + auto hc = heating_circuit(id); if (hc == nullptr) { return false; } @@ -3778,10 +3751,9 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co } bool Thermostat::set_temperature_value(const char * value, const int8_t id, const uint8_t mode, bool relative) { - float f; - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; + float f; if (Helpers::value2temperature(value, f, relative)) { - return set_temperature(f, mode, hc_num); + return set_temperature(f, mode, id); } return false; } @@ -3867,126 +3839,6 @@ void Thermostat::register_device_values() { DeviceValueUOM::DEGREES, MAKE_CF_CB(set_minexttemp)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaDamping_, DeviceValueType::BOOL, FL_(damping), DeviceValueUOM::NONE, MAKE_CF_CB(set_damping)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwSetTemp_, DeviceValueType::UINT8, FL_(wwSetTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwtemp)); - if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) { - register_device_value( - DeviceValueTAG::TAG_DHW1, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode4), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - register_device_value( - DeviceValueTAG::TAG_DHW2, &wwMode2_, DeviceValueType::ENUM, FL_(enum_wwMode4), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - - } else { - register_device_value( - DeviceValueTAG::TAG_DHW1, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - register_device_value( - DeviceValueTAG::TAG_DHW2, &wwMode2_, DeviceValueType::ENUM, FL_(enum_wwMode), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - } - register_device_value(DeviceValueTAG::TAG_DHW1, &wwSetTempLow_, DeviceValueType::UINT8, FL_(wwSetTempLow), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwtemplow)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircMode_, - DeviceValueType::ENUM, - FL_(enum_wwCircMode), - FL_(wwCircMode), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwcircmode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwChargeDuration_, - DeviceValueType::UINT8, - DeviceValueNumOp::DV_NUMOP_MUL15, - FL_(wwChargeDuration), - DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_wwchargeduration)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwCharge_, DeviceValueType::BOOL, FL_(wwCharge), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcharge)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwExtra1_, DeviceValueType::UINT8, FL_(wwExtra), DeviceValueUOM::DEGREES); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfecting_, - DeviceValueType::BOOL, - FL_(wwDisinfecting), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfect)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectDay_, - DeviceValueType::ENUM, - FL_(enum_dayOfWeek), - FL_(wwDisinfectDay), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectDay)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectHour_, - DeviceValueType::UINT8, - DeviceValueNumOp::DV_NUMOP_MUL15, - FL_(wwDisinfectTime), - DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_wwDisinfectHour), - 0, - 1431); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDailyHeating_, - DeviceValueType::BOOL, - FL_(wwDailyHeating), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDailyHeating)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDailyHeatTime_, - DeviceValueType::UINT8, - DeviceValueNumOp::DV_NUMOP_MUL15, - FL_(wwDailyHeatTime), - DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_wwDailyHeatTime), - 0, - 1431); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwCircMode2_, - DeviceValueType::ENUM, - FL_(enum_wwCircMode), - FL_(wwCircMode), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwcircmode)); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwChargeDuration2_, - DeviceValueType::UINT8, - DeviceValueNumOp::DV_NUMOP_MUL15, - FL_(wwChargeDuration), - DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_wwchargeduration)); - register_device_value(DeviceValueTAG::TAG_DHW2, &wwCharge2_, DeviceValueType::BOOL, FL_(wwCharge), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcharge)); - register_device_value(DeviceValueTAG::TAG_DHW2, &wwExtra2_, DeviceValueType::UINT8, FL_(wwExtra), DeviceValueUOM::DEGREES); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwDisinfecting2_, - DeviceValueType::BOOL, - FL_(wwDisinfecting), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfect)); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwDisinfectDay2_, - DeviceValueType::ENUM, - FL_(enum_dayOfWeek), - FL_(wwDisinfectDay), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectDay)); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwDisinfectHour2_, - DeviceValueType::UINT8, - DeviceValueNumOp::DV_NUMOP_MUL15, - FL_(wwDisinfectTime), - DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_wwDisinfectHour), - 0, - 1431); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwDailyHeating2_, - DeviceValueType::BOOL, - FL_(wwDailyHeating), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDailyHeating)); - register_device_value(DeviceValueTAG::TAG_DHW2, - &wwDailyHeatTime2_, - DeviceValueType::UINT8, - DeviceValueNumOp::DV_NUMOP_MUL15, - FL_(wwDailyHeatTime), - DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_wwDailyHeatTime), - 0, - 1431); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hybridStrategy_, DeviceValueType::ENUM, @@ -4067,7 +3919,6 @@ void Thermostat::register_device_values() { DeviceValueUOM::NONE, MAKE_CF_CB(set_heatingpid)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &backlight_, DeviceValueType::BOOL, FL_(backlight), DeviceValueUOM::NONE, MAKE_CF_CB(set_backlight)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode3), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); break; case EMSdevice::EMS_DEVICE_FLAG_RC20_N: case EMSdevice::EMS_DEVICE_FLAG_RC25: @@ -4125,48 +3976,6 @@ void Thermostat::register_device_values() { FL_(ibaCalIntTemperature), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_calinttemp)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode3), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwWhenModeOff_, - DeviceValueType::BOOL, - FL_(wwWhenModeOff), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwwhenmodeoff)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfecting_, - DeviceValueType::BOOL, - FL_(wwDisinfecting), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfect)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectDay_, - DeviceValueType::ENUM, - FL_(enum_dayOfWeek), - FL_(wwDisinfectDay), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectDay)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectHour_, - DeviceValueType::UINT8, - FL_(wwDisinfectHour), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectHour), - 0, - 23); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwHoliday_, - DeviceValueType::STRING, - FL_(tpl_holidays), - FL_(wwHolidays), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwHoliday)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwVacation_, - DeviceValueType::STRING, - FL_(tpl_holidays), - FL_(wwVacations), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwVacation)); break; case EMSdevice::EMS_DEVICE_FLAG_RC30_N: register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, FL_(dateTime), DeviceValueUOM::NONE); // can't set datetime @@ -4218,79 +4027,6 @@ void Thermostat::register_device_values() { FL_(ibaBuildingType), DeviceValueUOM::NONE, MAKE_CF_CB(set_building)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircMode_, - DeviceValueType::ENUM, - FL_(enum_wwMode2), - FL_(wwCircMode), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwcircmode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwProgMode_, - DeviceValueType::ENUM, - FL_(enum_wwProgMode), - FL_(wwProgMode), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwProgMode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircProg_, - DeviceValueType::ENUM, - FL_(enum_wwProgMode), - FL_(wwCircProg), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwCircProg)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfecting_, - DeviceValueType::BOOL, - FL_(wwDisinfecting), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfect)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectDay_, - DeviceValueType::ENUM, - FL_(enum_dayOfWeek), - FL_(wwDisinfectDay), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectDay)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectHour_, - DeviceValueType::UINT8, - FL_(wwDisinfectHour), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectHour), - 0, - 23); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwMaxTemp_, DeviceValueType::UINT8, FL_(wwMaxTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwOneTimeKey_, DeviceValueType::BOOL, FL_(wwOneTimeKey), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwOneTimeKey)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwSwitchTime_, - DeviceValueType::STRING, - FL_(tpl_switchtime), - FL_(wwswitchtime), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwSwitchTime)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircSwitchTime_, - DeviceValueType::STRING, - FL_(tpl_switchtime), - FL_(wwcircswitchtime), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwCircSwitchTime)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwHoliday_, - DeviceValueType::STRING, - FL_(tpl_holidays), - FL_(wwHolidays), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwHoliday)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwVacation_, - DeviceValueType::STRING, - FL_(tpl_holidays), - FL_(wwVacations), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwVacation)); break; case EMSdevice::EMS_DEVICE_FLAG_RC35: register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, @@ -4338,80 +4074,6 @@ void Thermostat::register_device_values() { FL_(ibaBuildingType), DeviceValueUOM::NONE, MAKE_CF_CB(set_building)); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircMode_, - DeviceValueType::ENUM, - FL_(enum_wwMode2), - FL_(wwCircMode), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwcircmode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwProgMode_, - DeviceValueType::ENUM, - FL_(enum_wwProgMode), - FL_(wwProgMode), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwProgMode)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircProg_, - DeviceValueType::ENUM, - FL_(enum_wwProgMode), - FL_(wwCircProg), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwCircProg)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfecting_, - DeviceValueType::BOOL, - FL_(wwDisinfecting), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfect)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectDay_, - DeviceValueType::ENUM, - FL_(enum_dayOfWeek), - FL_(wwDisinfectDay), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectDay)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwDisinfectHour_, - DeviceValueType::UINT8, - FL_(wwDisinfectHour), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwDisinfectHour), - 0, - 23); - register_device_value( - DeviceValueTAG::TAG_DHW1, &wwMaxTemp_, DeviceValueType::UINT8, FL_(wwMaxTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp), 60, 80); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwOneTimeKey_, DeviceValueType::BOOL, FL_(wwOneTimeKey), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwOneTimeKey)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwSwitchTime_, - DeviceValueType::STRING, - FL_(tpl_switchtime), - FL_(wwswitchtime), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwSwitchTime)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwCircSwitchTime_, - DeviceValueType::STRING, - FL_(tpl_switchtime), - FL_(wwcircswitchtime), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwCircSwitchTime)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwHoliday_, - DeviceValueType::STRING, - FL_(tpl_holidays), - FL_(wwHolidays), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwHoliday)); - register_device_value(DeviceValueTAG::TAG_DHW1, - &wwVacation_, - DeviceValueType::STRING, - FL_(tpl_holidays), - FL_(wwVacations), - DeviceValueUOM::NONE, - MAKE_CF_CB(set_wwVacation)); break; case EMSdevice::EMS_DEVICE_FLAG_JUNKERS: // FR100 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/536 @@ -4485,7 +4147,6 @@ void Thermostat::register_device_values() { MAKE_CF_CB(set_tempDiffBoiler), 1, 99); - register_device_value(DeviceValueTAG::TAG_DHW1, &wwCharge_, DeviceValueType::BOOL, FL_(wwCharge), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcharge)); break; case EMSdevice::EMS_DEVICE_FLAG_EASY: // Easy TC100 have no date/time, see issue #100, not sure about CT200, so leave it. @@ -4556,8 +4217,13 @@ void Thermostat::register_device_values_hc(std::shared_ptrmodetype, DeviceValueType::ENUM, FL_(enum_modetype), FL_(modetype), DeviceValueUOM::NONE); register_device_value( tag, &hc->nighttemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(ecotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_ecotemp)); - register_device_value( - tag, &hc->manualtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(manualtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_manualtemp)); + register_device_value(tag, + &hc->manualtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(manualtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_manualtemp)); register_device_value( tag, &hc->daytemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(comforttemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_comforttemp)); register_device_value(tag, &hc->summertemp, DeviceValueType::UINT8, FL_(summertemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_summertemp), 10, 30); @@ -4653,14 +4319,29 @@ void Thermostat::register_device_values_hc(std::shared_ptrmode, DeviceValueType::ENUM, FL_(enum_mode2), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); - register_device_value( - tag, &hc->manualtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(manualtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_manualtemp)); + register_device_value(tag, + &hc->manualtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(manualtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_manualtemp)); register_device_value( tag, &hc->nofrosttemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(offtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_offtemp)); - register_device_value( - tag, &hc->daylowtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daylowtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daylowtemp)); - register_device_value( - tag, &hc->daymidtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daymidtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daymidtemp)); + register_device_value(tag, + &hc->daylowtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(daylowtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_daylowtemp)); + register_device_value(tag, + &hc->daymidtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(daymidtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_daymidtemp)); register_device_value( tag, &hc->daytemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(dayhightemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp)); register_device_value( @@ -4735,14 +4416,29 @@ void Thermostat::register_device_values_hc(std::shared_ptrnighttemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(nighttemp2), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_nighttemp)); - register_device_value( - tag, &hc->daylowtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daylowtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daylowtemp)); - register_device_value( - tag, &hc->daymidtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daymidtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daymidtemp)); + register_device_value(tag, + &hc->daylowtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(daylowtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_daylowtemp)); + register_device_value(tag, + &hc->daymidtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(daymidtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_daymidtemp)); register_device_value( tag, &hc->daytemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(dayhightemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp)); - register_device_value( - tag, &hc->manualtemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(manualtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_manualtemp)); + register_device_value(tag, + &hc->manualtemp, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(manualtemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_manualtemp)); register_device_value( tag, &hc->nofrosttemp, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(offtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_offtemp)); break; @@ -4889,4 +4585,125 @@ void Thermostat::register_device_values_hc(std::shared_ptr dhw) { + uint8_t tag = DeviceValueTAG::TAG_DHW1 + dhw->dhw(); + switch (this->model()) { + case EMSdevice::EMS_DEVICE_FLAG_RC100: + case EMSdevice::EMS_DEVICE_FLAG_RC300: + case EMSdevice::EMS_DEVICE_FLAG_BC400: + register_device_value(tag, &dhw->wwSetTemp_, DeviceValueType::UINT8, FL_(wwSetTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwtemp)); + if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) { + register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode4), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); + } else { + register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); + } + register_device_value(tag, &dhw->wwSetTempLow_, DeviceValueType::UINT8, FL_(wwSetTempLow), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwtemplow)); + register_device_value(tag, &dhw->wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwCircMode), FL_(wwCircMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcircmode)); + register_device_value(tag, + &dhw->wwChargeDuration_, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_MUL15, + FL_(wwChargeDuration), + DeviceValueUOM::MINUTES, + MAKE_CF_CB(set_wwchargeduration)); + register_device_value(tag, &dhw->wwCharge_, DeviceValueType::BOOL, FL_(wwCharge), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcharge)); + register_device_value(tag, &dhw->wwExtra_, DeviceValueType::UINT8, FL_(wwExtra), DeviceValueUOM::DEGREES); + register_device_value(tag, &dhw->wwDisinfecting_, DeviceValueType::BOOL, FL_(wwDisinfecting), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfect)); + register_device_value( + tag, &dhw->wwDisinfectDay_, DeviceValueType::ENUM, FL_(enum_dayOfWeek), FL_(wwDisinfectDay), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectDay)); + register_device_value(tag, + &dhw->wwDisinfectHour_, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_MUL15, + FL_(wwDisinfectTime), + DeviceValueUOM::MINUTES, + MAKE_CF_CB(set_wwDisinfectHour), + 0, + 1431); + register_device_value(tag, &dhw->wwDailyHeating_, DeviceValueType::BOOL, FL_(wwDailyHeating), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDailyHeating)); + register_device_value(tag, + &dhw->wwDailyHeatTime_, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_MUL15, + FL_(wwDailyHeatTime), + DeviceValueUOM::MINUTES, + MAKE_CF_CB(set_wwDailyHeatTime), + 0, + 1431); + break; + case EMSdevice::EMS_DEVICE_FLAG_RC10: + register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode3), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); + break; + case EMSdevice::EMS_DEVICE_FLAG_RC20_N: + case EMSdevice::EMS_DEVICE_FLAG_RC25: + break; + case EMSdevice::EMS_DEVICE_FLAG_RC20: + break; + case EMSdevice::EMS_DEVICE_FLAG_RC30: + register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode3), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); + register_device_value(tag, &dhw->wwWhenModeOff_, DeviceValueType::BOOL, FL_(wwWhenModeOff), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwwhenmodeoff)); + register_device_value(tag, &dhw->wwDisinfecting_, DeviceValueType::BOOL, FL_(wwDisinfecting), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfect)); + register_device_value( + tag, &dhw->wwDisinfectDay_, DeviceValueType::ENUM, FL_(enum_dayOfWeek), FL_(wwDisinfectDay), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectDay)); + register_device_value(tag, &dhw->wwDisinfectHour_, DeviceValueType::UINT8, FL_(wwDisinfectHour), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectHour), 0, 23); + register_device_value(tag, &dhw->wwHoliday_, DeviceValueType::STRING, FL_(tpl_holidays), FL_(wwHolidays), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwHoliday)); + register_device_value(tag, &dhw->wwVacation_, DeviceValueType::STRING, FL_(tpl_holidays), FL_(wwVacations), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwVacation)); + break; + case EMSdevice::EMS_DEVICE_FLAG_RC30_N: + register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); + register_device_value(tag, &dhw->wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), FL_(wwCircMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcircmode)); + register_device_value(tag, &dhw->wwProgMode_, DeviceValueType::ENUM, FL_(enum_wwProgMode), FL_(wwProgMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwProgMode)); + register_device_value(tag, &dhw->wwCircProg_, DeviceValueType::ENUM, FL_(enum_wwProgMode), FL_(wwCircProg), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwCircProg)); + register_device_value(tag, &dhw->wwDisinfecting_, DeviceValueType::BOOL, FL_(wwDisinfecting), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfect)); + register_device_value( + tag, &dhw->wwDisinfectDay_, DeviceValueType::ENUM, FL_(enum_dayOfWeek), FL_(wwDisinfectDay), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectDay)); + register_device_value(tag, &dhw->wwDisinfectHour_, DeviceValueType::UINT8, FL_(wwDisinfectHour), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectHour), 0, 23); + register_device_value(tag, &dhw->wwMaxTemp_, DeviceValueType::UINT8, FL_(wwMaxTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp)); + register_device_value(tag, &dhw->wwOneTimeKey_, DeviceValueType::BOOL, FL_(wwOneTimeKey), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwOneTimeKey)); + register_device_value( + tag, &dhw->wwSwitchTime_, DeviceValueType::STRING, FL_(tpl_switchtime), FL_(wwswitchtime), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwSwitchTime)); + register_device_value(tag, + &dhw->wwCircSwitchTime_, + DeviceValueType::STRING, + FL_(tpl_switchtime), + FL_(wwcircswitchtime), + DeviceValueUOM::NONE, + MAKE_CF_CB(set_wwCircSwitchTime)); + register_device_value(tag, &dhw->wwHoliday_, DeviceValueType::STRING, FL_(tpl_holidays), FL_(wwHolidays), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwHoliday)); + register_device_value(tag, &dhw->wwVacation_, DeviceValueType::STRING, FL_(tpl_holidays), FL_(wwVacations), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwVacation)); + break; + case EMSdevice::EMS_DEVICE_FLAG_RC35: + register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); + register_device_value(tag, &dhw->wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), FL_(wwCircMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcircmode)); + register_device_value(tag, &dhw->wwProgMode_, DeviceValueType::ENUM, FL_(enum_wwProgMode), FL_(wwProgMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwProgMode)); + register_device_value(tag, &dhw->wwCircProg_, DeviceValueType::ENUM, FL_(enum_wwProgMode), FL_(wwCircProg), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwCircProg)); + register_device_value(tag, &dhw->wwDisinfecting_, DeviceValueType::BOOL, FL_(wwDisinfecting), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfect)); + register_device_value( + tag, &dhw->wwDisinfectDay_, DeviceValueType::ENUM, FL_(enum_dayOfWeek), FL_(wwDisinfectDay), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectDay)); + register_device_value(tag, &dhw->wwDisinfectHour_, DeviceValueType::UINT8, FL_(wwDisinfectHour), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwDisinfectHour), 0, 23); + register_device_value(tag, &dhw->wwMaxTemp_, DeviceValueType::UINT8, FL_(wwMaxTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp), 60, 80); + register_device_value(tag, &dhw->wwOneTimeKey_, DeviceValueType::BOOL, FL_(wwOneTimeKey), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwOneTimeKey)); + register_device_value( + tag, &dhw->wwSwitchTime_, DeviceValueType::STRING, FL_(tpl_switchtime), FL_(wwswitchtime), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwSwitchTime)); + register_device_value(tag, + &dhw->wwCircSwitchTime_, + DeviceValueType::STRING, + FL_(tpl_switchtime), + FL_(wwcircswitchtime), + DeviceValueUOM::NONE, + MAKE_CF_CB(set_wwCircSwitchTime)); + register_device_value(tag, &dhw->wwHoliday_, DeviceValueType::STRING, FL_(tpl_holidays), FL_(wwHolidays), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwHoliday)); + register_device_value(tag, &dhw->wwVacation_, DeviceValueType::STRING, FL_(tpl_holidays), FL_(wwVacations), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwVacation)); + break; + case EMSdevice::EMS_DEVICE_FLAG_JUNKERS: + register_device_value(tag, &dhw->wwCharge_, DeviceValueType::BOOL, FL_(wwCharge), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwcharge)); + break; + case EMSdevice::EMS_DEVICE_FLAG_EASY: + case EMSdevice::EMS_DEVICE_FLAG_CRF: + default: + break; + } +} + } // namespace emsesp diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 35654ea4c..fe09ce442 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -165,6 +165,48 @@ class Thermostat : public EMSdevice { uint8_t model_; // the model type }; + class DhwCircuit { + public: + DhwCircuit(const uint8_t offset, const uint8_t dhw_num) + : offset_(offset) + , dhw_num_(dhw_num) { + } + ~DhwCircuit() = default; + uint8_t wwExtra_; + uint8_t wwMode_; + uint8_t wwCircPump_; + uint8_t wwCircMode_; + uint8_t wwSetTemp_; + uint8_t wwSetTempLow_; + uint8_t wwCharge_; + uint8_t wwChargeDuration_; + uint8_t wwDisinfecting_; + uint8_t wwDisinfectDay_; + uint8_t wwDisinfectHour_; + uint8_t wwMaxTemp_; + uint8_t wwOneTimeKey_; + uint8_t wwProgMode_; + uint8_t wwCircProg_; + char wwSwitchTime_[20]; + char wwCircSwitchTime_[20]; + uint8_t wwDailyHeating_; + uint8_t wwDailyHeatTime_; + uint8_t wwWhenModeOff_; + char wwHoliday_[26]; + char wwVacation_[26]; + + uint8_t dhw() const { + return dhw_num_ - 1; + } + uint8_t offset() const { + return offset_; + } + + private: + uint8_t offset_; // telegram offset to base telegram + uint8_t dhw_num_; // dhw circuit number 1..10 + }; + private: static uuid::log::Logger logger_; @@ -190,7 +232,7 @@ class Thermostat : public EMSdevice { // standard for all thermostats char status_[20]; // online or offline - char dateTime_[25]; // date and time stamp + char dateTime_[30]; // date and time stamp char errorCode_[15]; // code from 0xA2 as string i.e. "A22(816)" uint16_t errorNumber_; // used internally to build error code char lastCode_[50]; // error log @@ -220,41 +262,6 @@ class Thermostat : public EMSdevice { uint8_t humidity_; uint8_t battery_; - uint8_t wwCircuit2_ = EMS_VALUE_UINT8_NOTSET; // not published, initialize here - uint8_t wwExtra1_; // wwExtra active for wwSystem 1 - uint8_t wwExtra2_; - uint8_t wwMode_; - uint8_t wwMode2_; - uint8_t wwCircPump_; - uint8_t wwCircPump2_; - uint8_t wwCircMode_; - uint8_t wwCircMode2_; - uint8_t wwSetTemp_; - uint8_t wwSetTempLow_; - uint8_t wwCharge_; - uint8_t wwCharge2_; - uint8_t wwChargeDuration_; - uint8_t wwChargeDuration2_; - uint8_t wwDisinfecting_; - uint8_t wwDisinfecting2_; - uint8_t wwDisinfectDay_; - uint8_t wwDisinfectHour_; - uint8_t wwDisinfectDay2_; - uint8_t wwDisinfectHour2_; - uint8_t wwMaxTemp_; - uint8_t wwOneTimeKey_; - uint8_t wwProgMode_; - uint8_t wwCircProg_; - char wwSwitchTime_[16]; - char wwCircSwitchTime_[16]; - uint8_t wwDailyHeating_; - uint8_t wwDailyHeatTime_; - uint8_t wwDailyHeating2_; - uint8_t wwDailyHeatTime2_; - uint8_t wwWhenModeOff_; - char wwHoliday_[26]; - char wwVacation_[26]; - // HybridHP uint8_t hybridStrategy_; // co2 = 1, cost = 2, temperature = 3, mix = 4 int8_t switchOverTemp_; // degrees @@ -270,6 +277,7 @@ class Thermostat : public EMSdevice { uint8_t pvLowerCool_; std::vector> heating_circuits_; // each thermostat can have multiple heating circuits + std::vector> dhw_circuits_; // each thermostat can have multiple dhw circuits // Generic Types static constexpr uint16_t EMS_TYPE_RCTime = 0x06; // time @@ -285,7 +293,7 @@ class Thermostat : public EMSdevice { static constexpr uint8_t EMS_OFFSET_RC20Set_mode = 23; // position of thermostat mode static constexpr uint8_t EMS_OFFSET_RC20Set_temp_off = 24; // position of thermostat setpoint mode:off static constexpr uint8_t EMS_OFFSET_RC20Set_temp_auto = 28; // position of thermostat setpoint temperature - static constexpr uint8_t EMS_OFFSET_RC20Set_temp_manual = 29; // position of thermostat setpoint temperature + static constexpr uint8_t EMS_OFFSET_RC20Set_temp_manual = 29; // position of thermostat setpoint manual static constexpr uint8_t EMS_OFFSET_RC20_2_Set_mode = 3; // ES72 - see https://github.com/emsesp/EMS-ESP/issues/334 static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_night = 1; // ES72 @@ -357,7 +365,7 @@ class Thermostat : public EMSdevice { static constexpr uint8_t EMS_OFFSET_JunkersSetMessage2_eco_temp = 6; static constexpr uint8_t EMS_OFFSET_JunkersSetMessage2_heat_temp = 7; - static constexpr uint8_t AUTO_HEATING_CIRCUIT = 0; + static constexpr int8_t AUTO_HEATING_CIRCUIT = -1; // id // Installation settings static constexpr uint8_t EMS_TYPE_IBASettings = 0xA5; // installation settings @@ -367,9 +375,11 @@ class Thermostat : public EMSdevice { static constexpr uint8_t EMS_TYPE_time = 0x06; // time std::shared_ptr heating_circuit(std::shared_ptr telegram); - std::shared_ptr heating_circuit(const uint8_t hc_num); + std::shared_ptr heating_circuit(const int8_t id); + std::shared_ptr dhw_circuit(const uint8_t offset = 0, const uint8_t dhw_num = 255, const bool create = false); void register_device_values_hc(std::shared_ptr hc); + void register_device_values_dhw(std::shared_ptr dhw); void add_ha_climate(std::shared_ptr hc) const; @@ -404,7 +414,6 @@ class Thermostat : public EMSdevice { void process_RC300Summer(std::shared_ptr telegram); void process_RC300Summer2(std::shared_ptr telegram); void process_RC300WWmode(std::shared_ptr telegram); - void process_RC300WW2mode(std::shared_ptr telegram); void process_RC300WWmode2(std::shared_ptr telegram); void process_RC300WWtemp(std::shared_ptr telegram); void process_RC300OutdoorTemp(std::shared_ptr telegram); @@ -428,10 +437,10 @@ class Thermostat : public EMSdevice { void process_HPMode(std::shared_ptr telegram); // internal helper functions - bool set_mode_n(const uint8_t mode, const uint8_t hc_num); + bool set_mode_n(const uint8_t mode, const int8_t id); bool set_temperature_value(const char * value, const int8_t id, const uint8_t mode, bool relative = false); - bool set_temperature(const float temperature, const uint8_t mode, const uint8_t hc_num); + bool set_temperature(const float temperature, const uint8_t mode, const int8_t id); bool set_switchtime(const char * value, const uint16_t type_id, char * out, size_t len); // set functions - these use the id/hc diff --git a/src/mqtt.cpp b/src/mqtt.cpp index dfdea6953..4a93e654a 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -847,6 +847,43 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev } else if (Mqtt::entity_format() == entityFormat::SINGLE_SHORT) { // shortname, no mqtt base. This is the default version. snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, entity_with_tag); + } else if (Mqtt::entity_format() == entityFormat::SINGLE_OLD) { + // shortname, remap to 3.6. + if (has_tag && (device_type == EMSdevice::DeviceType::BOILER || device_type == EMSdevice::DeviceType::THERMOSTAT) + && tag == DeviceValue::DeviceValueTAG::TAG_DHW1) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "ww%s", entity); + snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, entity_with_tag); + if (strcmp(entity, "nrgdhw") == 0) { // special case for tp1de #1714 + strcpy(uniq_id, "boiler_nrgww"); + strcpy(entity_with_tag, "nrgww"); + } + } else if (has_tag && device_type == EMSdevice::DeviceType::WATER && tag >= DeviceValue::DeviceValueTAG::TAG_DHW3) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, entity); + snprintf(uniq_id, sizeof(uniq_id), "solar_%s", entity_with_tag); + } else if (has_tag && device_type == EMSdevice::DeviceType::WATER && tag >= DeviceValue::DeviceValueTAG::TAG_DHW1) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, entity); + snprintf(uniq_id, sizeof(uniq_id), "mixer_%s", entity_with_tag); + } else { + snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, entity_with_tag); + } + } else if (Mqtt::entity_format() == entityFormat::MULTI_OLD) { + // shortname, remap to 3.6. + if (has_tag && (device_type == EMSdevice::DeviceType::BOILER || device_type == EMSdevice::DeviceType::THERMOSTAT) + && tag == DeviceValue::DeviceValueTAG::TAG_DHW1) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "ww%s", entity); + snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", mqtt_basename_.c_str(), device_name, entity_with_tag); + if (strcmp(entity, "nrgdhw") == 0) { // special case for tp1de #1714 + snprintf(uniq_id, sizeof(uniq_id), "%s_boiler_nrgww", mqtt_basename_.c_str()); + } + } else if (has_tag && device_type == EMSdevice::DeviceType::WATER && tag >= DeviceValue::DeviceValueTAG::TAG_DHW3) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, entity); + snprintf(uniq_id, sizeof(uniq_id), "%s_solar_%s", mqtt_basename_.c_str(), entity_with_tag); + } else if (has_tag && device_type == EMSdevice::DeviceType::WATER && tag >= DeviceValue::DeviceValueTAG::TAG_DHW1) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, entity); + snprintf(uniq_id, sizeof(uniq_id), "%s_mixer_%s", mqtt_basename_.c_str(), entity_with_tag); + } else { + snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", mqtt_basename_.c_str(), device_name, entity_with_tag); + } } else { // entity_format is 0, the old v3.4 style // take en_name and replace all spaces @@ -854,7 +891,17 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev strlcpy(uniq_s, en_name, sizeof(uniq_s)); Helpers::replace_char(uniq_s, ' ', '_'); Helpers::replace_char(uniq_s, '+', '2'); //changes 'eco+_switch_off' to 'eco2_switch_off' (HA ignores '+') - if (has_tag) { + if (has_tag && (device_type == EMSdevice::DeviceType::BOILER || device_type == EMSdevice::DeviceType::THERMOSTAT) + && tag == DeviceValue::DeviceValueTAG::TAG_DHW1) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "ww%s", entity); + snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, Helpers::toLower(uniq_s).c_str()); + } else if (has_tag && device_type == EMSdevice::DeviceType::WATER && tag >= DeviceValue::DeviceValueTAG::TAG_DHW3) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, entity); + snprintf(uniq_id, sizeof(uniq_id), "solar_wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, Helpers::toLower(uniq_s).c_str()); + } else if (has_tag && device_type == EMSdevice::DeviceType::WATER && tag >= DeviceValue::DeviceValueTAG::TAG_DHW1) { + snprintf(entity_with_tag, sizeof(entity_with_tag), "wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, entity); + snprintf(uniq_id, sizeof(uniq_id), "mixer_wwc%d_%s", tag - DeviceValue::DeviceValueTAG::TAG_DHW1 + 1, Helpers::toLower(uniq_s).c_str()); + } else if (has_tag) { snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", device_name, DeviceValue::DeviceValueTAG_s[tag][0], Helpers::toLower(uniq_s).c_str()); } else { snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, Helpers::toLower(uniq_s).c_str()); @@ -1022,10 +1069,10 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev char val_obj[100]; char val_cond[200]; if (is_nested() && tag >= DeviceValueTAG::TAG_HC1) { - snprintf(val_obj, sizeof(val_obj), "value_json.%s.%s", EMSdevice::tag_to_mqtt(tag), entity); + snprintf(val_obj, sizeof(val_obj), "value_json.%s['%s']", EMSdevice::tag_to_mqtt(tag), entity); snprintf(val_cond, sizeof(val_cond), "value_json.%s is defined and %s is defined", EMSdevice::tag_to_mqtt(tag), val_obj); } else { - snprintf(val_obj, sizeof(val_obj), "value_json.%s", entity); + snprintf(val_obj, sizeof(val_obj), "value_json['%s']", entity); snprintf(val_cond, sizeof(val_cond), "%s is defined", val_obj); } diff --git a/src/mqtt.h b/src/mqtt.h index a50b23ff9..6ea9c4c9e 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -36,7 +36,7 @@ using mqtt_sub_function_p = std::function; class Mqtt { public: enum discoveryType : uint8_t { HOMEASSISTANT, DOMOTICZ, DOMOTICZ_LATEST }; - enum entityFormat : uint8_t { SINGLE_LONG, SINGLE_SHORT, MULTI_SHORT }; + enum entityFormat : uint8_t { SINGLE_LONG, SINGLE_SHORT, MULTI_SHORT, SINGLE_OLD, MULTI_OLD }; void loop(); void start(); diff --git a/src/system.cpp b/src/system.cpp index 743ab1a47..17ddf77ef 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -1120,7 +1120,7 @@ bool System::check_upgrade(bool factory_settings) { missing_version = (settingsVersion.empty() || (settingsVersion.length() < 5)); if (missing_version) { LOG_WARNING("No version information found (%s)", settingsVersion.c_str()); - settingsVersion = "3.6.4"; // this was the last stable version + settingsVersion = "3.5.0"; // this was the last stable version without version info } } @@ -1154,6 +1154,18 @@ bool System::check_upgrade(bool factory_settings) { mqttSettings.entity_format = 0; // use old Entity ID format from v3.4 return StateUpdateResult::CHANGED; }); + } else if (settings_version.major() == 3 && settings_version.minor() <= 6) { + LOG_INFO("Setting MQTT Entity ID format to v3.6 format"); + EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) { + if (mqttSettings.entity_format == 1) { + mqttSettings.entity_format = 3; // use old Entity ID format from v3.6 + return StateUpdateResult::CHANGED; + } else if (mqttSettings.entity_format == 2) { + mqttSettings.entity_format = 4; // use old Entity ID format from v3.6 + return StateUpdateResult::CHANGED; + } + return StateUpdateResult::UNCHANGED; + }); } // Network Settings Wifi tx_power is now using the value * 4. diff --git a/src/temperaturesensor.cpp b/src/temperaturesensor.cpp index 70fa5cdab..56c61631a 100644 --- a/src/temperaturesensor.cpp +++ b/src/temperaturesensor.cpp @@ -499,8 +499,9 @@ void TemperatureSensor::publish_values(const bool force) { } else if (!sensor.ha_registered || force) { LOG_DEBUG("Recreating HA config for sensor ID %s", sensor.id().c_str()); - JsonDocument config; // this needs to be large because of all the copying in add_ha_sections_to_doc() - config["dev_cla"] = "temperature"; + JsonDocument config; + config["dev_cla"] = "temperature"; + config["stat_cla"] = "measurement"; char stat_t[50]; snprintf(stat_t, sizeof(stat_t), "%s/%s_data", Mqtt::base().c_str(), F_(temperaturesensor)); // use base path diff --git a/src/version.h b/src/version.h index 702d461f9..b2172a0a9 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.0-dev.4" +#define EMSESP_APP_VERSION "3.7.0-dev.5" diff --git a/src/web/WebSchedulerService.cpp b/src/web/WebSchedulerService.cpp index 1dd23adc6..a1a8bec2a 100644 --- a/src/web/WebSchedulerService.cpp +++ b/src/web/WebSchedulerService.cpp @@ -366,7 +366,7 @@ bool WebSchedulerService::command(const char * cmd, const char * data) { snprintf(error, sizeof(error), "Scheduled command %s failed with error code (%s)", cmd, Command::return_code_string(return_code).c_str()); } - emsesp::EMSESP::logger().err(error); + emsesp::EMSESP::logger().warning(error); return false; }