From 8c4e8f5fa65370d6c191402f15a654bbd35ebf34 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 23 Jun 2024 11:35:55 +0200 Subject: [PATCH 01/13] add /rest test --- test/api_test.http | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/api_test.http b/test/api_test.http index 04d447f88..8af1807e8 100755 --- a/test/api_test.http +++ b/test/api_test.http @@ -65,6 +65,14 @@ GET {{host}}/api/temperaturesensor/info ### +GET {{host}}/rest/deviceData?id=3 +Content-Type: application/json +Authorization: Bearer {{token}} + +### + +GET {{host}}/api/boiler/commands + # # Test on dev # From 9d426845919f2d62c8db8bc9ce1e555a5075aca0 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 23 Jun 2024 11:36:02 +0200 Subject: [PATCH 02/13] formatting --- interface/src/project/SchedulerDialog.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/src/project/SchedulerDialog.tsx b/interface/src/project/SchedulerDialog.tsx index b629e99ce..a336fb731 100644 --- a/interface/src/project/SchedulerDialog.tsx +++ b/interface/src/project/SchedulerDialog.tsx @@ -297,7 +297,7 @@ const SchedulerDialog = ({ name="time" label={isCondition ? 'Condition' : 'On Change Value'} fullWidth - value={editItem.time == "00:00" ? editItem.time = "" : editItem.time} + value={editItem.time == '00:00' ? (editItem.time = '') : editItem.time} margin="normal" onChange={updateFormValue} /> @@ -307,7 +307,9 @@ const SchedulerDialog = ({ name="time" type="time" label={isTimer ? LL.TIMER(1) : LL.TIME(1)} - value={editItem.time == "" ? editItem.time = "00:00" : editItem.time} + value={ + editItem.time == '' ? (editItem.time = '00:00') : editItem.time + } margin="normal" onChange={updateFormValue} /> From 79e784239be36b4d9e76217fe12cfa80519ac427 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 23 Jun 2024 11:36:38 +0200 Subject: [PATCH 03/13] fix duration conversion from ms #1801 --- src/shower.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shower.cpp b/src/shower.cpp index 5c90aa0c1..729ee2dfc 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -100,12 +100,12 @@ void Shower::loop() { // it is over the wait period, so assume that the shower has finished and calculate the total time and publish // because its unsigned long, can't have negative so check if length is less than OFFSET_TIME if ((timer_pause_ - timer_start_) > SHOWER_OFFSET_TIME) { - duration_ = (timer_pause_ - timer_start_ - SHOWER_OFFSET_TIME); + duration_ = (timer_pause_ - timer_start_ - SHOWER_OFFSET_TIME); // duration in seconds if (duration_ > shower_min_duration_) { JsonDocument doc; // duration in seconds - doc["duration"] = (duration_ / 1000UL); // seconds + doc["duration"] = duration_; // seconds time_t now = time(nullptr); // if NTP enabled, publish timestamp if (now > 1576800000) { // year 2020 @@ -114,9 +114,9 @@ void Shower::loop() { char dt[25]; strftime(dt, sizeof(dt), "%FT%T%z", tm_); doc["timestamp"] = dt; - LOG_INFO("shower finished %s (duration %lu s)", dt, duration_ / 1000UL); + LOG_INFO("shower finished %s (duration %lu s)", dt, duration_); } else { - LOG_INFO("shower finished (duration %lu s)", duration_ / 1000UL); + LOG_INFO("shower finished (duration %lu s)", duration_); } Mqtt::queue_publish("shower_data", doc.as()); } From ef4588e3de7fceef64570374725740d405220bb9 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 23 Jun 2024 11:38:37 +0200 Subject: [PATCH 04/13] auto formatting --- src/roomcontrol.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/roomcontrol.h b/src/roomcontrol.h index 4dfe948ec..7aa682c79 100644 --- a/src/roomcontrol.h +++ b/src/roomcontrol.h @@ -37,8 +37,8 @@ class Roomctrl { static void set_timeout(uint8_t t); private: - static constexpr uint32_t SEND_INTERVAL = 15000; // 15 sec - static constexpr uint8_t HCS = 4; // max 4 heating circuits + static constexpr uint32_t SEND_INTERVAL = 15000; // 15 sec + static constexpr uint8_t HCS = 4; // max 4 heating circuits enum SendType : uint8_t { TEMP, HUMI }; static uint8_t get_hc(const uint8_t addr); From 03933edcaeb8bd62454252876d3c855be87b11be Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 24 Jun 2024 21:48:21 +0200 Subject: [PATCH 05/13] update packages --- interface/package.json | 6 +- interface/yarn.lock | 159 +++++++++++++++++++++-------------------- 2 files changed, 83 insertions(+), 82 deletions(-) diff --git a/interface/package.json b/interface/package.json index c23ef06f2..0a23a98d3 100644 --- a/interface/package.json +++ b/interface/package.json @@ -44,7 +44,7 @@ "react-dom": "latest", "react-dropzone": "^14.2.3", "react-icons": "^5.2.1", - "react-router-dom": "^6.23.1", + "react-router-dom": "^6.24.0", "react-toastify": "^10.0.5", "typesafe-i18n": "^5.26.2", "typescript": "^5.5.2" @@ -53,7 +53,7 @@ "@babel/core": "^7.24.7", "@eslint/js": "^9.5.0", "@preact/compat": "^17.1.2", - "@preact/preset-vite": "^2.8.2", + "@preact/preset-vite": "^2.8.3", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/babel__core": "^7", "concurrently": "^8.2.2", @@ -63,7 +63,7 @@ "prettier": "^3.3.2", "rollup-plugin-visualizer": "^5.12.0", "terser": "^5.31.1", - "typescript-eslint": "^7.13.1", + "typescript-eslint": "^7.14.1", "vite": "^5.3.1", "vite-plugin-imagemin": "^0.6.1", "vite-tsconfig-paths": "^4.3.2" diff --git a/interface/yarn.lock b/interface/yarn.lock index 168e6e573..63e34c2ac 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1341,10 +1341,11 @@ __metadata: languageName: node linkType: hard -"@preact/preset-vite@npm:^2.8.2": - version: 2.8.2 - resolution: "@preact/preset-vite@npm:2.8.2" +"@preact/preset-vite@npm:^2.8.3": + version: 2.8.3 + resolution: "@preact/preset-vite@npm:2.8.3" dependencies: + "@babel/code-frame": "npm:^7.22.13" "@babel/plugin-transform-react-jsx": "npm:^7.22.15" "@babel/plugin-transform-react-jsx-development": "npm:^7.22.5" "@prefresh/vite": "npm:^2.4.1" @@ -1360,7 +1361,7 @@ __metadata: peerDependencies: "@babel/core": 7.x vite: 2.x || 3.x || 4.x || 5.x - checksum: 10c0/79a26f70ae7a129bbaf3c1969f78df2013c64202184c47e19a44e255d00e7e52b7f8071017da77c8f587121e1df02e9097a03a0791acb1bc8c52b689ac8287a4 + checksum: 10c0/984b47d24491d20ea9f0787adbef3515c3bd4cdfd77154cdb84e9038fabb5db09a0c76237557aff88b3da26cff6146ac616c2375579143fc511afcf7baf63927 languageName: node linkType: hard @@ -1403,10 +1404,10 @@ __metadata: languageName: node linkType: hard -"@remix-run/router@npm:1.16.1": - version: 1.16.1 - resolution: "@remix-run/router@npm:1.16.1" - checksum: 10c0/5f1b0aef4924830eeab9c86dcaa5af8157066e5de65b449e7fdf406532b2384828a46a447c31b0735fd713a06938dd88bfd4e566d9989be70c770457dda16c92 +"@remix-run/router@npm:1.17.0": + version: 1.17.0 + resolution: "@remix-run/router@npm:1.17.0" + checksum: 10c0/6f39cb81c5dec3d3cb901cfc05ef1c745d23192def7d83e6d1a53c43cbb5d7ff488055fd1418ac72f904ff41b3d3ca339d223677994150f276c648123ce166f7 languageName: node linkType: hard @@ -1860,15 +1861,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/eslint-plugin@npm:7.13.1" +"@typescript-eslint/eslint-plugin@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/eslint-plugin@npm:7.14.1" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.13.1" - "@typescript-eslint/type-utils": "npm:7.13.1" - "@typescript-eslint/utils": "npm:7.13.1" - "@typescript-eslint/visitor-keys": "npm:7.13.1" + "@typescript-eslint/scope-manager": "npm:7.14.1" + "@typescript-eslint/type-utils": "npm:7.14.1" + "@typescript-eslint/utils": "npm:7.14.1" + "@typescript-eslint/visitor-keys": "npm:7.14.1" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" natural-compare: "npm:^1.4.0" @@ -1879,44 +1880,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/6677f9c090a25978e4e20c24d67365ad89ca1208ebd2bb103d3f1e15a7deea22dea538e9f61f3a3d4f03a741179acf58c02ad7d03f805aceabb78929a8dc1908 + checksum: 10c0/7c2b9b98a38d78326b0ff7348fe001203eda10817ca7834a7a01f492ae7c2508469bbafaa933208d6459f8ff6685277685983cf6f6843e556a6ab2aa5c05080c languageName: node linkType: hard -"@typescript-eslint/parser@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/parser@npm:7.13.1" +"@typescript-eslint/parser@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/parser@npm:7.14.1" dependencies: - "@typescript-eslint/scope-manager": "npm:7.13.1" - "@typescript-eslint/types": "npm:7.13.1" - "@typescript-eslint/typescript-estree": "npm:7.13.1" - "@typescript-eslint/visitor-keys": "npm:7.13.1" + "@typescript-eslint/scope-manager": "npm:7.14.1" + "@typescript-eslint/types": "npm:7.14.1" + "@typescript-eslint/typescript-estree": "npm:7.14.1" + "@typescript-eslint/visitor-keys": "npm:7.14.1" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/455d067bfb81fa3d133c75ebc4d8d7f2de5001441585f5b58dc8b0d4380d7397dc3745e11a9299d596dfa581265fdcdea6c28b2ddd2d3b542869c851ecd52fcd + checksum: 10c0/db3169d4852685cfb27db741c557f58a3e52104bfacc7621beb7c94ec36ac2a08d4e410ac86745db52f482fbfc87e99fa0a26c1d7a10d37a215cce85e1661f0e languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/scope-manager@npm:7.13.1" +"@typescript-eslint/scope-manager@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/scope-manager@npm:7.14.1" dependencies: - "@typescript-eslint/types": "npm:7.13.1" - "@typescript-eslint/visitor-keys": "npm:7.13.1" - checksum: 10c0/3d8770bf9c89e7a07e54efbc3dac6df02c0ce49d49575076111ac663566c90cbb852f06c94a311db7c0aec1fab0417f3ef6e601b3852aa30bed75c65f4f076f4 + "@typescript-eslint/types": "npm:7.14.1" + "@typescript-eslint/visitor-keys": "npm:7.14.1" + checksum: 10c0/f8c05a0d6f8de4cc19b90a4da308817c66e53f36f7ec48f6cc23e93c7399bc418643d8135933aaf5fc013199cbef0e1ea4223f5147db5ca401b239eaf087011e languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/type-utils@npm:7.13.1" +"@typescript-eslint/type-utils@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/type-utils@npm:7.14.1" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.13.1" - "@typescript-eslint/utils": "npm:7.13.1" + "@typescript-eslint/typescript-estree": "npm:7.14.1" + "@typescript-eslint/utils": "npm:7.14.1" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" peerDependencies: @@ -1924,23 +1925,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/c02305dccb0b2c7dcc9249230078c83e851ee589f93e08eb6cdc0b4c38d78d85ef4996631ac427836ee9d0a868ac031417feb74a6e4d0600096f41ca3c0e99a0 + checksum: 10c0/bd1c4a8db6273e24156fb10da2cbeb52b4eb03f819da193d4b6bd5a95db3b5524c6fe00d088308d8855b9ae60a3b82afa3a06e89982a09a8573561da960758fd languageName: node linkType: hard -"@typescript-eslint/types@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/types@npm:7.13.1" - checksum: 10c0/38a01004e11259e457ae2fd02300ef362a3268a8fc70addfbf1508e2edcaca72da2f0f8771e42c1cb9f191c1f754af583cdcaebd830c8e3c3f796dcf30d3c3a8 +"@typescript-eslint/types@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/types@npm:7.14.1" + checksum: 10c0/5b7bda83c47a9b386482e63447c6b0ed7bd4e82eb43f11a180c6e2f3d2e7a2828f57bcbed82196ad761c49e363cccf4c81a89f1fc976e9f5f0a79dcc928fa2d2 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/typescript-estree@npm:7.13.1" +"@typescript-eslint/typescript-estree@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/typescript-estree@npm:7.14.1" dependencies: - "@typescript-eslint/types": "npm:7.13.1" - "@typescript-eslint/visitor-keys": "npm:7.13.1" + "@typescript-eslint/types": "npm:7.14.1" + "@typescript-eslint/visitor-keys": "npm:7.14.1" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -1950,31 +1951,31 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/bd5c8951ae79e8eacd05ff100def02926c633045a1a54426f98f20b4ca31c485968af3226dd7939934dfaf36a6b5fcb3386948e2a7d763ddee2db905ac187ebc + checksum: 10c0/a8da9bcc4de3334a225424946abd99374de05c42098455419224bc0f46bb1b66115f8bd6ae268461294b90943ed4a407bcd255c0fa60eb76ba4cdc5fc7c20855 languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/utils@npm:7.13.1" +"@typescript-eslint/utils@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/utils@npm:7.14.1" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.13.1" - "@typescript-eslint/types": "npm:7.13.1" - "@typescript-eslint/typescript-estree": "npm:7.13.1" + "@typescript-eslint/scope-manager": "npm:7.14.1" + "@typescript-eslint/types": "npm:7.14.1" + "@typescript-eslint/typescript-estree": "npm:7.14.1" peerDependencies: eslint: ^8.56.0 - checksum: 10c0/d2f6be42a80608ed265b34a5f6a0c97dc0b627d53b91e83d87c7d67541cb5b3c038e7320026b4ad8dfafe1ac07a0554efa8fe7673f54d74b68c253d6f9519bb6 + checksum: 10c0/c7f635a3c2c6c085e1d51a52088e55cad9d7e1257b1f60378e5eeb6eb0871db027d42747e9ef60a2f557cf9dd68b2ce014d488d795db8f771506290b164b0e5a languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.13.1": - version: 7.13.1 - resolution: "@typescript-eslint/visitor-keys@npm:7.13.1" +"@typescript-eslint/visitor-keys@npm:7.14.1": + version: 7.14.1 + resolution: "@typescript-eslint/visitor-keys@npm:7.14.1" dependencies: - "@typescript-eslint/types": "npm:7.13.1" + "@typescript-eslint/types": "npm:7.14.1" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10c0/23c1bb896173cadfb33e3801420a70aa2f0481384caa3b534b04f7920acdb9d8f7d635fcaf1f8c7fc78ebce71b8f2435391608d120091761ad2e2c00eb870832 + checksum: 10c0/39ac489990fcfdcee442f27658431a0eb44ccf694f701a45df2a108c47cea9582e0955bff0d449047549149385f72895a5d7e6c1622ece1fe32594b7cecb85f3 languageName: node linkType: hard @@ -1991,7 +1992,7 @@ __metadata: "@mui/icons-material": "npm:^5.15.20" "@mui/material": "npm:^5.15.20" "@preact/compat": "npm:^17.1.2" - "@preact/preset-vite": "npm:^2.8.2" + "@preact/preset-vite": "npm:^2.8.3" "@table-library/react-table-library": "npm:4.1.7" "@trivago/prettier-plugin-sort-imports": "npm:^4.3.0" "@types/babel__core": "npm:^7" @@ -2015,13 +2016,13 @@ __metadata: react-dom: "npm:latest" react-dropzone: "npm:^14.2.3" react-icons: "npm:^5.2.1" - react-router-dom: "npm:^6.23.1" + react-router-dom: "npm:^6.24.0" react-toastify: "npm:^10.0.5" rollup-plugin-visualizer: "npm:^5.12.0" terser: "npm:^5.31.1" typesafe-i18n: "npm:^5.26.2" typescript: "npm:^5.5.2" - typescript-eslint: "npm:^7.13.1" + typescript-eslint: "npm:^7.14.1" vite: "npm:^5.3.1" vite-plugin-imagemin: "npm:^0.6.1" vite-tsconfig-paths: "npm:^4.3.2" @@ -6102,27 +6103,27 @@ __metadata: languageName: node linkType: hard -"react-router-dom@npm:^6.23.1": - version: 6.23.1 - resolution: "react-router-dom@npm:6.23.1" +"react-router-dom@npm:^6.24.0": + version: 6.24.0 + resolution: "react-router-dom@npm:6.24.0" dependencies: - "@remix-run/router": "npm:1.16.1" - react-router: "npm:6.23.1" + "@remix-run/router": "npm:1.17.0" + react-router: "npm:6.24.0" peerDependencies: react: ">=16.8" react-dom: ">=16.8" - checksum: 10c0/01b954d7d0ff4c53bb2edbc816458f3fad1ce9ee49a4dfdc5c866065c23026c9cce429b46b754cbaebb83b22cfe5f605bbf441acf515e3c377cbdf021b0bec4c + checksum: 10c0/2cb41120c1ff58fd1e187807214cf581e78e2845e5f411aa6a04f4748bd100431fd1ac5f8a45db281ea03d0d2354b66896b938c0b77adf7b343a6c1be52411de languageName: node linkType: hard -"react-router@npm:6.23.1": - version: 6.23.1 - resolution: "react-router@npm:6.23.1" +"react-router@npm:6.24.0": + version: 6.24.0 + resolution: "react-router@npm:6.24.0" dependencies: - "@remix-run/router": "npm:1.16.1" + "@remix-run/router": "npm:1.17.0" peerDependencies: react: ">=16.8" - checksum: 10c0/091949805745136350ab049b2a96281bf38742c9d3651019fb48ea79c5eafbfb0379f1d3e636602dd56b0ef278389e8fd25be983dc2c0ffd1103d06dfa8019f3 + checksum: 10c0/ad9c924d16dc4f5c90dff588e9a69d37488d2ad537de1ddbdf3b68561658c6e3fd1b8b12d16d50f19177f6547748c54e948d477e921f9230799ac71acfec24cf languageName: node linkType: hard @@ -7139,19 +7140,19 @@ __metadata: languageName: node linkType: hard -"typescript-eslint@npm:^7.13.1": - version: 7.13.1 - resolution: "typescript-eslint@npm:7.13.1" +"typescript-eslint@npm:^7.14.1": + version: 7.14.1 + resolution: "typescript-eslint@npm:7.14.1" dependencies: - "@typescript-eslint/eslint-plugin": "npm:7.13.1" - "@typescript-eslint/parser": "npm:7.13.1" - "@typescript-eslint/utils": "npm:7.13.1" + "@typescript-eslint/eslint-plugin": "npm:7.14.1" + "@typescript-eslint/parser": "npm:7.14.1" + "@typescript-eslint/utils": "npm:7.14.1" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/b929e865cdbf2b8b5dd417d40a6af2d76bb87a8ad3879dcde9a0f66b478906247ec3378aa7ab4c0659ddae73ba4bb15167053ff20a552e192f352797e94bee46 + checksum: 10c0/93439aa50a814a2d7e117c7d9b54982292986e3c090950961d13dcb07b804ae31e43300e094fd5d27d1208c1647ebbb95fda4bc89163b1c0b2e36e8a777a6800 languageName: node linkType: hard From 26eb2a3b296f7186b24ec1230fa810cc84b85949 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 24 Jun 2024 21:49:06 +0200 Subject: [PATCH 06/13] add button tooltip, also export json --- interface/src/project/Devices.tsx | 129 +++++++++++++++++++----------- 1 file changed, 84 insertions(+), 45 deletions(-) diff --git a/interface/src/project/Devices.tsx b/interface/src/project/Devices.tsx index be13882b1..a7d6e87e2 100644 --- a/interface/src/project/Devices.tsx +++ b/interface/src/project/Devices.tsx @@ -36,7 +36,11 @@ import { List, ListItem, ListItemText, - Typography + Tooltip, + type TooltipProps, + Typography, + styled, + tooltipClasses } from '@mui/material'; import { useRowSelect } from '@table-library/react-table-library/select'; @@ -234,6 +238,20 @@ const Devices: FC = () => { } ]); + const ButtonTooltip = styled(({ className, ...props }: TooltipProps) => ( + + ))(({ theme }) => ({ + [`& .${tooltipClasses.arrow}`]: { + color: theme.palette.success.main + }, + [`& .${tooltipClasses.tooltip}`]: { + backgroundColor: theme.palette.success.main, + color: 'rgba(0, 0, 0, 0.87)', + boxShadow: theme.shadows[1], + fontSize: 10 + } + })); + const getSortIcon = (state: State, sortKey: unknown) => { if (state.sortKey === sortKey && state.reverse) { return ; @@ -399,13 +417,22 @@ const Devices: FC = () => { '\r\n' ); - const csvFile = new Blob([csvData], { type: 'text/csv;charset:utf-8' }); - const downloadLink = document.createElement('a'); - downloadLink.download = filename; - downloadLink.href = window.URL.createObjectURL(csvFile); - document.body.appendChild(downloadLink); - downloadLink.click(); - document.body.removeChild(downloadLink); + const downloadBlob = (blob: Blob) => { + const downloadLink = document.createElement('a'); + downloadLink.download = filename; + downloadLink.href = window.URL.createObjectURL(blob); + document.body.appendChild(downloadLink); + downloadLink.click(); + document.body.removeChild(downloadLink); + }; + + downloadBlob( + new Blob([JSON.stringify(deviceData, null, 2)], { + type: 'text;charset:utf-8' + }) + ); + + downloadBlob(new Blob([csvData], { type: 'text/csv;charset:utf-8' })); }; useEffect(() => { @@ -608,11 +635,11 @@ const Devices: FC = () => { backgroundColor: 'black', position: 'absolute', left: () => leftOffset(), - right: 16, + right: 0, bottom: 0, - top: 128, + top: 64, zIndex: 'modal', - maxHeight: () => size[1] - 189, + maxHeight: () => size[1] - 126, border: '1px solid #177ac9' }} > @@ -631,53 +658,65 @@ const Devices: FC = () => { coreData.devices[deviceIndex].e + ' ' + LL.ENTITIES(shown_data.length)} - setShowDeviceInfo(true)}> - - - {me.admin && ( - - + setShowDeviceInfo(true)}> + + + {me.admin && ( + + + + + )} - - - - setOnlyFav(!onlyFav)}> - {onlyFav ? ( - + + - ) : ( - + + + setOnlyFav(!onlyFav)}> + {onlyFav ? ( + + ) : ( + + )} + + + + + - )} - - - - + + - - - + + + + + From 5f08e218ec5a38568ff8e2b4eeeb67df0e0ecf12 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 24 Jun 2024 21:49:21 +0200 Subject: [PATCH 07/13] formatting --- src/web/WebDataService.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index b6e4330f3..a1f92f778 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -36,7 +36,6 @@ WebDataService::WebDataService(AsyncWebServer * server, SecurityManager * securi HTTP_GET, securityManager->wrapRequest([this](AsyncWebServerRequest * request) { device_data(request); }, AuthenticationPredicates::IS_AUTHENTICATED)); - server->on(CORE_DATA_SERVICE_PATH, HTTP_GET, securityManager->wrapRequest([this](AsyncWebServerRequest * request) { core_data(request); }, AuthenticationPredicates::IS_AUTHENTICATED)); From e3b37e8220b45ea55dd0d79256c4395f91ebc678 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 24 Jun 2024 21:49:29 +0200 Subject: [PATCH 08/13] rename GitHub --- .github/workflows/github-releases-to-discord.yml | 2 +- interface/src/i18n/de/index.ts | 4 ++-- interface/src/i18n/en/index.ts | 2 +- interface/src/i18n/fr/index.ts | 2 +- interface/src/i18n/it/index.ts | 2 +- interface/src/i18n/nl/index.ts | 2 +- interface/src/i18n/pl/index.ts | 2 +- interface/src/i18n/sk/index.ts | 2 +- interface/src/i18n/tr/index.ts | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/github-releases-to-discord.yml b/.github/workflows/github-releases-to-discord.yml index bad6e0917..54bf9702e 100644 --- a/.github/workflows/github-releases-to-discord.yml +++ b/.github/workflows/github-releases-to-discord.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Github Releases To Discord + - name: GitHub Releases To Discord uses: SethCohen/github-releases-to-discord@v1.13.1 with: webhook_url: ${{ secrets.WEBHOOK_URL }} diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index 992cce5f5..bb9f80493 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -163,9 +163,9 @@ const de: Translation = { SUPPORT_INFORMATION: 'Unterstützende Informationen', HELP_INFORMATION_1: 'EMS-ESP Konfigurationsanweisungen und mehr finden Sie im Online-Wiki', HELP_INFORMATION_2: 'Für einen Live-Community-Chat besuchen Sie unseren Discord-Server', - HELP_INFORMATION_3: 'Um neue Funktionen anzufragen oder Fehler zu melden, eröffnen Sie ein Issue auf Github', + HELP_INFORMATION_3: 'Um neue Funktionen anzufragen oder Fehler zu melden, eröffnen Sie ein Issue auf GitHub', HELP_INFORMATION_4: 'Bitte laden Sie die System-Details und hängen Sie sie an das Support-Issue an. ', - HELP_INFORMATION_5: 'EMS-ESP ist ein freies Open-Source Projekt. Bitte unterstützen Sie die zukünftige Entwicklung mit einem "Star" auf Github!', + HELP_INFORMATION_5: 'EMS-ESP ist ein freies Open-Source Projekt. Bitte unterstützen Sie die zukünftige Entwicklung mit einem "Star" auf GitHub!', UPLOAD: 'Hochladen', DOWNLOAD: '{{H|h|h}}erunterladen', ABORTED: 'abgebrochen', diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index 9fdd9977b..ae1e89cc5 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -165,7 +165,7 @@ const en: Translation = { HELP_INFORMATION_2: 'For live community chat join our Discord server', HELP_INFORMATION_3: 'To request a feature or report a bug', HELP_INFORMATION_4: 'Download and attach your support information for a faster response when reporting an issue', - HELP_INFORMATION_5: 'EMS-ESP is a free and open-source project. Please support its future development by giving it a star on Github!', + HELP_INFORMATION_5: 'EMS-ESP is a free and open-source project. Please support its future development by giving it a star on GitHub!', UPLOAD: 'Upload', DOWNLOAD: '{{D|d|d}}ownload', ABORTED: 'aborted', diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index 1799cdfd1..b19b60042 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -165,7 +165,7 @@ const fr: Translation = { HELP_INFORMATION_2: 'Pour une discussion en direct avec la communauté, rejoignez notre serveur Discord', HELP_INFORMATION_3: 'Pour demander une fonctionnalité ou signaler un problème', HELP_INFORMATION_4: "N'oubliez pas de télécharger et de joindre les informations relatives à votre système pour obtenir une réponse plus rapide lorsque vous signalez un problème", - HELP_INFORMATION_5: 'EMS-ESP est un projet libre et open-source. Merci de soutenir son développement futur en lui donnant une étoile sur Github !', + HELP_INFORMATION_5: 'EMS-ESP est un projet libre et open-source. Merci de soutenir son développement futur en lui donnant une étoile sur GitHub !', UPLOAD: 'Upload', DOWNLOAD: '{{D|d|d}}ownload', ABORTED: 'annulé', diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 15b6c3bd0..90d49b765 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -165,7 +165,7 @@ const it: Translation = { HELP_INFORMATION_2: 'Per la chat della community dal vivo unisciti al nostro server Discord', HELP_INFORMATION_3: 'Per richiedere una funzionalità o segnalare un errore', HELP_INFORMATION_4: 'Ricordati di scaricare e allegare le informazioni del tuo sistema per una risposta più rapida quando segnali un problema', - HELP_INFORMATION_5: 'EMS-ESP è un progetto gratuito e open-source. Supporta il suo sviluppo futuro assegnandogli una stella su Github!', + HELP_INFORMATION_5: 'EMS-ESP è un progetto gratuito e open-source. Supporta il suo sviluppo futuro assegnandogli una stella su GitHub!', UPLOAD: 'Carica', DOWNLOAD: 'Scarica', ABORTED: 'Annullato', diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index e8ece543d..28e406839 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -165,7 +165,7 @@ const nl: Translation = { HELP_INFORMATION_2: 'Voor de live community ga naar de Discord server', HELP_INFORMATION_3: 'Om een nieuwe feature te vragen of een bug te rapporteren', HELP_INFORMATION_4: 'Zorg dat je ook je systeem details zijn toevoeged voor een sneller antwoord', - HELP_INFORMATION_5: 'EMS-ESP is een gratis en open source project. Steun ons met een Star op Github!', + HELP_INFORMATION_5: 'EMS-ESP is een gratis en open source project. Steun ons met een Star op GitHub!', UPLOAD: 'Upload', DOWNLOAD: '{{D|d|d}}ownload', ABORTED: 'afgebroken', diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index b14fb564b..6896051fe 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -165,7 +165,7 @@ const pl: BaseTranslation = { HELP_INFORMATION_2: 'Dołącz do naszego serwera Discord by komunikować się na żywo ze społecznością.', HELP_INFORMATION_3: 'Zaproponuj nową funkcjonalność lub zgłoś problem.', HELP_INFORMATION_4: 'Zgłaszając problem, nie zapomnij pobrać i dołączyć informacji o swoim systemie!', - HELP_INFORMATION_5: 'EMS-ESP jest darmowym projektem typu open-source. Aby go wesprzeć, rozważ przyznanie nam gwiazdki na Github!', + HELP_INFORMATION_5: 'EMS-ESP jest darmowym projektem typu open-source. Aby go wesprzeć, rozważ przyznanie nam gwiazdki na GitHub!', UPLOAD: 'Wysyłanie', DOWNLOAD: '{{P|p||P}}obier{{anie|z||z}}', ABORTED: 'zostało przerwane!', diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index 5e3e599e9..bcb958dc7 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -165,7 +165,7 @@ const sk: Translation = { HELP_INFORMATION_2: 'Pre živý komunitný chat sa pripojte na náš Discord server', HELP_INFORMATION_3: 'Ak chcete požiadať o funkciu alebo nahlásiť chybu', HELP_INFORMATION_4: 'nezabudnite si stiahnuť a pripojiť informácie o vašom systéme, aby ste mohli rýchlejšie reagovať pri nahlasovaní problému', - HELP_INFORMATION_5: 'EMS-ESP je bezplatný a open source projekt. Podporte jeho budúci vývoj tým, že mu dáte hviezdičku na Github!', + HELP_INFORMATION_5: 'EMS-ESP je bezplatný a open source projekt. Podporte jeho budúci vývoj tým, že mu dáte hviezdičku na GitHub!', UPLOAD: 'Nahrať', DOWNLOAD: '{{S|s|s}}tiahnuť', ABORTED: 'zrušené', diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index f9656a1e5..9c6e2fb79 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -165,7 +165,7 @@ const tr: Translation = { HELP_INFORMATION_2: 'Canlı topluluk sohbeti için Discord sunucumuza katılın', HELP_INFORMATION_3: 'Yeni bir özellik talep etmek yada hata bildirmek için', HELP_INFORMATION_4: 'Bir sorun bildirirken daha hızlı bir dönüş için sistem bilginizi indirip eklemeyi unutmayın', - HELP_INFORMATION_5: 'EMS-ESP ücretsiz ve açık kaynaklı bir projedir. Lütfen geliştirmeyi desteklemek için Githubda projeye yıldız verin!', + HELP_INFORMATION_5: 'EMS-ESP ücretsiz ve açık kaynaklı bir projedir. Lütfen geliştirmeyi desteklemek için GitHubda projeye yıldız verin!', UPLOAD: 'Yükleme', DOWNLOAD: '{{İ|i|i}}İndirme', ABORTED: 'iptal edildi', From 4ebd0657f4a50bc53480ad3dd63b76e042a37c38 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 25 Jun 2024 10:41:36 +0200 Subject: [PATCH 09/13] include device data in export --- interface/src/project/Devices.tsx | 40 ++++++++----------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/interface/src/project/Devices.tsx b/interface/src/project/Devices.tsx index a7d6e87e2..3af36dc59 100644 --- a/interface/src/project/Devices.tsx +++ b/interface/src/project/Devices.tsx @@ -426,8 +426,9 @@ const Devices: FC = () => { document.body.removeChild(downloadLink); }; + const device = { ...{ device: coreData.devices[deviceIndex] }, ...deviceData }; downloadBlob( - new Blob([JSON.stringify(deviceData, null, 2)], { + new Blob([JSON.stringify(device, null, 2)], { type: 'text;charset:utf-8' }) ); @@ -650,7 +651,7 @@ const Devices: FC = () => { - + {LL.SHOWING() + ' ' + shown_data.length + @@ -660,61 +661,40 @@ const Devices: FC = () => { LL.ENTITIES(shown_data.length)} setShowDeviceInfo(true)}> - + {me.admin && ( - + )} - + setOnlyFav(!onlyFav)}> {onlyFav ? ( - + ) : ( - + )} - + - + From 2184fbb113565f4e32bd8a15384f287521e98ac5 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 25 Jun 2024 10:42:05 +0200 Subject: [PATCH 10/13] experiment with cache (again) --- lib/framework/ESP8266React.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/framework/ESP8266React.cpp b/lib/framework/ESP8266React.cpp index 12036b759..1de95f1cf 100644 --- a/lib/framework/ESP8266React.cpp +++ b/lib/framework/ESP8266React.cpp @@ -39,6 +39,7 @@ ESP8266React::ESP8266React(AsyncWebServer * server, FS * fs) response->addHeader("Content-Encoding", "gzip"); // response->addHeader("Content-Encoding", "br"); // only works over HTTPS // response->addHeader("Cache-Control", "public, immutable, max-age=31536000"); + response->addHeader("Cache-Control", "must-revalidate"); // ensure that a client will check the server for a change response->addHeader("Last-Modified", last_modified); response->addHeader("ETag", hash); @@ -46,6 +47,7 @@ ESP8266React::ESP8266React(AsyncWebServer * server, FS * fs) }; server->on(uri, HTTP_GET, requestHandler); + // Serving non matching get requests with "/index.html" // OPTIONS get a straight up 200 response if (strncmp(uri, "/index.html", 11) == 0) { From 18483558d4f25247249f63b3e597d3ff2b1477e7 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 25 Jun 2024 10:42:18 +0200 Subject: [PATCH 11/13] lowercase Entities --- interface/src/i18n/en/index.ts | 2 +- interface/src/i18n/fr/index.ts | 2 +- interface/src/i18n/it/index.ts | 2 +- interface/src/i18n/nl/index.ts | 2 +- interface/src/i18n/sk/index.ts | 2 +- interface/src/i18n/sv/index.ts | 2 +- interface/src/i18n/tr/index.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index ae1e89cc5..d996e5c06 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -23,7 +23,7 @@ const en: Translation = { ONOFF: 'on/off', TYPE: 'Type', DESCRIPTION: 'Description', - ENTITIES: 'Entities', + ENTITIES: 'entities', REFRESH: 'Refresh', EXPORT: 'Export', DEVICE_DETAILS: 'Device Details', diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index b19b60042..0e1d46f37 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -23,7 +23,7 @@ const fr: Translation = { ONOFF: 'on/off', TYPE: 'Type', DESCRIPTION: 'Description', - ENTITIES: 'Entités', + ENTITIES: 'entités', REFRESH: 'Rafraîchir', EXPORT: 'Exporter', DEVICE_DETAILS: "Détails de l'appareil", diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 90d49b765..eae77f1a2 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -23,7 +23,7 @@ const it: Translation = { ONOFF: 'on/off', TYPE: 'Tipo', DESCRIPTION: 'Descrizione', - ENTITIES: 'Entità', + ENTITIES: 'entità', REFRESH: 'Ricaricare', EXPORT: 'Esporta', DEVICE_DETAILS: 'Dettagli dispositivo', diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index 28e406839..6b2c1a00d 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -23,7 +23,7 @@ const nl: Translation = { ONOFF: 'aan/uit', TYPE: 'Type', DESCRIPTION: 'Beschrijving', - ENTITIES: 'Entiteiten', + ENTITIES: 'entiteiten', REFRESH: 'Ververs', EXPORT: 'Export', DEVICE_DETAILS: 'Device Gegevens', diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index bcb958dc7..43ae4ac38 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -23,7 +23,7 @@ const sk: Translation = { ONOFF: 'zap/vyp', TYPE: 'Typ', DESCRIPTION: 'Popis', - ENTITIES: 'Entity', + ENTITIES: 'entity', REFRESH: 'Obnoviť', EXPORT: 'Export', DEVICE_DETAILS: 'Detaily zariadenia', diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index 523b45b35..ca9952708 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -23,7 +23,7 @@ const sv: Translation = { ONOFF: 'på/av', TYPE: 'Typ', DESCRIPTION: 'Beskrivning', - ENTITIES: 'Entiteter', + ENTITIES: 'entiteter', REFRESH: 'Uppdatera', EXPORT: 'Exportera', DEVICE_DETAILS: 'Enhetsdetaljer', diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index 9c6e2fb79..44ab06c5d 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -23,7 +23,7 @@ const tr: Translation = { ONOFF: 'açık/kapalı', TYPE: 'Tür', DESCRIPTION: 'Açıklama', - ENTITIES: 'Varlıklar', + ENTITIES: 'varlıklar', REFRESH: 'Yenile', EXPORT: 'Dışarı al', DEVICE_DETAILS: 'Cihaz Ayrıntıları', From 9a63307b33c14ea6d8adfcfb8b45a7481b5a6edd Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 25 Jun 2024 10:44:44 +0200 Subject: [PATCH 12/13] updated for dev.18 --- CHANGELOG_LATEST.md | 3 ++- src/version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 91643bf5e..8ff39a6e1 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -5,7 +5,7 @@ ## **IMPORTANT! BREAKING CHANGES** - new device WATER shows dhw entities from MM100 and SM100 in dhw setting -- rename WWC to DHW, always create DHW nests/topics, remove ww prefix from mqtt names [#1634](https://github.com/emsesp/EMS-ESP32/issues/1634) +- renamed WWC to DHW, always create DHW nests/topics, remove ww prefix from mqtt names [#1634](https://github.com/emsesp/EMS-ESP32/issues/1634) ## Added @@ -40,3 +40,4 @@ - dynamic register dhw circuits for thermostat - removed OTA feature [#1738](https://github.com/emsesp/EMS-ESP32/issues/1738) - added shower min duration [[#1801](https://github.com/emsesp/EMS-ESP32/issues/1801)] +- Include TXT file along with the generated CSV for Device Data export/download diff --git a/src/version.h b/src/version.h index 1d59dfab5..93d63925e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.0-dev.17" +#define EMSESP_APP_VERSION "3.7.0-dev.18" From edaeafd6192af32bdf9c883690a69da61c413f0a Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 25 Jun 2024 10:51:08 +0200 Subject: [PATCH 13/13] don't run sonar on pulls --- .github/workflows/sonar_check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonar_check.yml b/.github/workflows/sonar_check.yml index 38e306ade..18dea5b40 100644 --- a/.github/workflows/sonar_check.yml +++ b/.github/workflows/sonar_check.yml @@ -5,8 +5,8 @@ on: push: branches: - dev - pull_request: - types: [opened, synchronize, reopened] + # pull_request: + # types: [opened, synchronize, reopened] jobs: build: