From 3c91ac27dc6d3cf6a9781123db4568f5dd014c75 Mon Sep 17 00:00:00 2001 From: Proddy Date: Fri, 23 Dec 2022 13:42:59 +0100 Subject: [PATCH] Set device_class to duration in HA sensor definitions #822 --- CHANGELOG_LATEST.md | 3 +- interface/.typesafe-i18n.json | 8 +- interface/package-lock.json | 184 +++++++++++++++++----------------- interface/package.json | 8 +- src/emsdevicevalue.h | 30 +++--- src/locale_common.h | 6 +- src/mqtt.cpp | 24 +++-- 7 files changed, 133 insertions(+), 130 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 52eb1dab4..d7186d8a0 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -40,4 +40,5 @@ - reload page after restart button is pressed - analog/dallas values command as list like ems-devices - analog/dallas HA-entities based on id -- MQTT Base is a mandatory field. Removed MQTT topic length from settings. +- MQTT Base is a mandatory field. Removed MQTT topic length from settings +- HA duration class for time entities [[#822](https://github.com/emsesp/EMS-ESP32/issues/822 diff --git a/interface/.typesafe-i18n.json b/interface/.typesafe-i18n.json index e53e4b991..ec7e7c401 100644 --- a/interface/.typesafe-i18n.json +++ b/interface/.typesafe-i18n.json @@ -1,5 +1,5 @@ { - "adapter": "react", - "baseLocale": "pl", - "$schema": "https://unpkg.com/typesafe-i18n@5.17.2/schema/typesafe-i18n.json" -} + "adapter": "react", + "baseLocale": "pl", + "$schema": "https://unpkg.com/typesafe-i18n@5.18.0/schema/typesafe-i18n.json" +} \ No newline at end of file diff --git a/interface/package-lock.json b/interface/package-lock.json index 585bbc16c..f43be3cb6 100644 --- a/interface/package-lock.json +++ b/interface/package-lock.json @@ -12,12 +12,12 @@ "@emotion/styled": "^11.10.5", "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.11.0", - "@mui/material": "^5.11.0", + "@mui/material": "^5.11.1", "@table-library/react-table-library": "4.0.23", "@types/lodash": "^4.14.191", "@types/node": "^18.11.17", "@types/react": "^18.0.26", - "@types/react-dom": "^18.0.9", + "@types/react-dom": "^18.0.10", "@types/react-router-dom": "^5.3.3", "async-validator": "^4.2.5", "axios": "^1.2.1", @@ -31,10 +31,10 @@ "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", "react-icons": "^4.7.1", - "react-router-dom": "^6.5.0", + "react-router-dom": "^6.6.0", "react-scripts": "5.0.1", "sockette": "^2.0.6", - "typesafe-i18n": "^5.17.2", + "typesafe-i18n": "^5.18.0", "typescript": "^4.9.4" }, "devDependencies": { @@ -3091,14 +3091,14 @@ } }, "node_modules/@mui/base": { - "version": "5.0.0-alpha.110", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.110.tgz", - "integrity": "sha512-q4TH9T3sTBknTXXTEf2zO8F3nbHg5iGgiaRx9XErTbXvHrmLrQXbQ4hmrLERocSTBFCFWkKyne/qZj0diWlPtA==", + "version": "5.0.0-alpha.111", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.111.tgz", + "integrity": "sha512-2wfIPpl97S4dPzD0QOM3UIzQ/EuXCYQvHmXxTpfKxev/cfkzOe7Ik/McoYUBbtM1bSOqH3W276R/L2LF9cyXqQ==", "dependencies": { "@babel/runtime": "^7.20.6", "@emotion/is-prop-valid": "^1.2.0", "@mui/types": "^7.2.3", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "@popperjs/core": "^2.11.6", "clsx": "^1.2.1", "prop-types": "^15.8.1", @@ -3123,9 +3123,9 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.0.tgz", - "integrity": "sha512-Bmogung451ezVv2YI1RvweOIVsTj2RQ4Fk61+e/+8LFPLTFEwVGbL0YhNy1VB5tri8pzGNV228kxtWVTFooQkg==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.1.tgz", + "integrity": "sha512-QVqVNlZ2K+LqUDE5kFgYd0r4KekR/dv2cNYbAutQWbfOA8VPVUVrDz0ELrEcoe8TjM/CwnsmGvaDh/YSNl/ALA==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui" @@ -3157,16 +3157,16 @@ } }, "node_modules/@mui/material": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.0.tgz", - "integrity": "sha512-8Zl34lb89rLKTTi50Kakki675/LLHMKKnkp8Ee3rAZ2qmisQlRODsGh1MBjENKp0vwhQnNSvlsCfJteVTfotPQ==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.1.tgz", + "integrity": "sha512-yaZiXvcrl2vgUK+VO24780BWRgwdAMmAyuMVZnRTts1Yu0tWd6PjIYq2ZtaOlpj6/LbaSS+Q2kSfxYnDQ20CEQ==", "dependencies": { "@babel/runtime": "^7.20.6", - "@mui/base": "5.0.0-alpha.110", - "@mui/core-downloads-tracker": "^5.11.0", - "@mui/system": "^5.11.0", + "@mui/base": "5.0.0-alpha.111", + "@mui/core-downloads-tracker": "^5.11.1", + "@mui/system": "^5.11.1", "@mui/types": "^7.2.3", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "@types/react-transition-group": "^4.4.5", "clsx": "^1.2.1", "csstype": "^3.1.1", @@ -3201,12 +3201,12 @@ } }, "node_modules/@mui/private-theming": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.0.tgz", - "integrity": "sha512-UFQLb9x5Sj4pg2GhhCGw3Ls/y1Hw/tz9RsBrULvUF0Vgps1z19o7XTq2xqUvp7pN7fJTW7eVIT2gwVg2xlk8PQ==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.1.tgz", + "integrity": "sha512-nnHg7kA5RwFRhy0wiDYe59sLCVGORpPypL1JcEdhv0+N0Zbmc2E/y4z2zqMRZ62MAEscpro7cQbvv244ThA84A==", "dependencies": { "@babel/runtime": "^7.20.6", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "prop-types": "^15.8.1" }, "engines": { @@ -3258,15 +3258,15 @@ } }, "node_modules/@mui/system": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.0.tgz", - "integrity": "sha512-HFUT7Dlmyq6Wfuxsw8QBXZxXDYIQQaJ4YHaZd7s+nDMcjerLnILxjh2g3a6umtOUM+jEcRaFJAtvLZvlGfa5fw==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.1.tgz", + "integrity": "sha512-BEA2S0hay8n8CcZftkeAVsi0nsb5ZjdnZRCahv5lX7QJYwDjO4ucJ6lnvxHe2v/9Te1LLjTO7ojxu/qM6CE5Cg==", "dependencies": { "@babel/runtime": "^7.20.6", - "@mui/private-theming": "^5.11.0", + "@mui/private-theming": "^5.11.1", "@mui/styled-engine": "^5.11.0", "@mui/types": "^7.2.3", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "clsx": "^1.2.1", "csstype": "^3.1.1", "prop-types": "^15.8.1" @@ -3310,9 +3310,9 @@ } }, "node_modules/@mui/utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.0.tgz", - "integrity": "sha512-DP/YDaVVCVzJpZ5FFPLKNmaJkeaYRviTyIZkL/D5/FmPXQiA6ecd6z0/+VwoNQtp7aXAQWaRhvz4FM25yqFlHA==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.1.tgz", + "integrity": "sha512-lMAPgIJoil8V9ZxsMbEflMsvZmWcHbRVMc4JDY9jPO9V4welpF43h/O267b1RqlcRnC5MEbVQV605GYkTZY29Q==", "dependencies": { "@babel/runtime": "^7.20.6", "@types/prop-types": "^15.7.5", @@ -3458,9 +3458,9 @@ } }, "node_modules/@remix-run/router": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz", - "integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.2.0.tgz", + "integrity": "sha512-GO82KYYTWPRCgdNtnheaZG3LcViUlxRFlHM7ykh7N+ufoXi6PVIHoP+9RUG/vuzl2hr9i/h6EA1Eq+2HpqJ0gQ==", "engines": { "node": ">=14" } @@ -4062,9 +4062,9 @@ } }, "node_modules/@types/react-dom": { - "version": "18.0.9", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.9.tgz", - "integrity": "sha512-qnVvHxASt/H7i+XG1U1xMiY5t+IHcPGUK7TDMDzom08xa7e86eCeKOiLZezwCKVxJn6NEiiy2ekgX8aQssjIKg==", + "version": "18.0.10", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.10.tgz", + "integrity": "sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==", "dependencies": { "@types/react": "*" } @@ -14576,11 +14576,11 @@ } }, "node_modules/react-router": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz", - "integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.6.0.tgz", + "integrity": "sha512-+VPfCIaFbkW7BAiB/2oeprxKAt1KLbl+zXZ10CXOYezKWgBmTKyh8XjI53eLqY5kd7uY+V4rh3UW44FclwUU+Q==", "dependencies": { - "@remix-run/router": "1.1.0" + "@remix-run/router": "1.2.0" }, "engines": { "node": ">=14" @@ -14590,12 +14590,12 @@ } }, "node_modules/react-router-dom": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz", - "integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.6.0.tgz", + "integrity": "sha512-qC4jnvpfCPKVle1mKLD75IvZLcbVJyFMlSn16WY9ZiOed3dgSmqhslCf/u3tmSccWOujkdsT/OwGq12bELmvjg==", "dependencies": { - "@remix-run/router": "1.1.0", - "react-router": "6.5.0" + "@remix-run/router": "1.2.0", + "react-router": "6.6.0" }, "engines": { "node": ">=14" @@ -16441,9 +16441,9 @@ } }, "node_modules/typesafe-i18n": { - "version": "5.17.2", - "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.17.2.tgz", - "integrity": "sha512-G5LCXLDugzvG0GtkBS1+0f+ctQzQNPqwPElvrOMQ8LAG/mwwtW84H42sGfNJ9Dfqlh+t7250N/8TQ7Vta98cKQ==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.18.0.tgz", + "integrity": "sha512-4uzmbSwBOYQ5Upuam1btGf8/fKhBR19b8fg1auILRs9tHlaWtvIYORU7MJsoNee/rmQfIAv6pkiXrIEuMCoW7Q==", "bin": { "typesafe-i18n": "cli/typesafe-i18n.mjs" }, @@ -19657,14 +19657,14 @@ "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==" }, "@mui/base": { - "version": "5.0.0-alpha.110", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.110.tgz", - "integrity": "sha512-q4TH9T3sTBknTXXTEf2zO8F3nbHg5iGgiaRx9XErTbXvHrmLrQXbQ4hmrLERocSTBFCFWkKyne/qZj0diWlPtA==", + "version": "5.0.0-alpha.111", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.111.tgz", + "integrity": "sha512-2wfIPpl97S4dPzD0QOM3UIzQ/EuXCYQvHmXxTpfKxev/cfkzOe7Ik/McoYUBbtM1bSOqH3W276R/L2LF9cyXqQ==", "requires": { "@babel/runtime": "^7.20.6", "@emotion/is-prop-valid": "^1.2.0", "@mui/types": "^7.2.3", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "@popperjs/core": "^2.11.6", "clsx": "^1.2.1", "prop-types": "^15.8.1", @@ -19672,9 +19672,9 @@ } }, "@mui/core-downloads-tracker": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.0.tgz", - "integrity": "sha512-Bmogung451ezVv2YI1RvweOIVsTj2RQ4Fk61+e/+8LFPLTFEwVGbL0YhNy1VB5tri8pzGNV228kxtWVTFooQkg==" + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.1.tgz", + "integrity": "sha512-QVqVNlZ2K+LqUDE5kFgYd0r4KekR/dv2cNYbAutQWbfOA8VPVUVrDz0ELrEcoe8TjM/CwnsmGvaDh/YSNl/ALA==" }, "@mui/icons-material": { "version": "5.11.0", @@ -19685,16 +19685,16 @@ } }, "@mui/material": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.0.tgz", - "integrity": "sha512-8Zl34lb89rLKTTi50Kakki675/LLHMKKnkp8Ee3rAZ2qmisQlRODsGh1MBjENKp0vwhQnNSvlsCfJteVTfotPQ==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.1.tgz", + "integrity": "sha512-yaZiXvcrl2vgUK+VO24780BWRgwdAMmAyuMVZnRTts1Yu0tWd6PjIYq2ZtaOlpj6/LbaSS+Q2kSfxYnDQ20CEQ==", "requires": { "@babel/runtime": "^7.20.6", - "@mui/base": "5.0.0-alpha.110", - "@mui/core-downloads-tracker": "^5.11.0", - "@mui/system": "^5.11.0", + "@mui/base": "5.0.0-alpha.111", + "@mui/core-downloads-tracker": "^5.11.1", + "@mui/system": "^5.11.1", "@mui/types": "^7.2.3", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "@types/react-transition-group": "^4.4.5", "clsx": "^1.2.1", "csstype": "^3.1.1", @@ -19704,12 +19704,12 @@ } }, "@mui/private-theming": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.0.tgz", - "integrity": "sha512-UFQLb9x5Sj4pg2GhhCGw3Ls/y1Hw/tz9RsBrULvUF0Vgps1z19o7XTq2xqUvp7pN7fJTW7eVIT2gwVg2xlk8PQ==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.1.tgz", + "integrity": "sha512-nnHg7kA5RwFRhy0wiDYe59sLCVGORpPypL1JcEdhv0+N0Zbmc2E/y4z2zqMRZ62MAEscpro7cQbvv244ThA84A==", "requires": { "@babel/runtime": "^7.20.6", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "prop-types": "^15.8.1" } }, @@ -19725,15 +19725,15 @@ } }, "@mui/system": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.0.tgz", - "integrity": "sha512-HFUT7Dlmyq6Wfuxsw8QBXZxXDYIQQaJ4YHaZd7s+nDMcjerLnILxjh2g3a6umtOUM+jEcRaFJAtvLZvlGfa5fw==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.1.tgz", + "integrity": "sha512-BEA2S0hay8n8CcZftkeAVsi0nsb5ZjdnZRCahv5lX7QJYwDjO4ucJ6lnvxHe2v/9Te1LLjTO7ojxu/qM6CE5Cg==", "requires": { "@babel/runtime": "^7.20.6", - "@mui/private-theming": "^5.11.0", + "@mui/private-theming": "^5.11.1", "@mui/styled-engine": "^5.11.0", "@mui/types": "^7.2.3", - "@mui/utils": "^5.11.0", + "@mui/utils": "^5.11.1", "clsx": "^1.2.1", "csstype": "^3.1.1", "prop-types": "^15.8.1" @@ -19746,9 +19746,9 @@ "requires": {} }, "@mui/utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.0.tgz", - "integrity": "sha512-DP/YDaVVCVzJpZ5FFPLKNmaJkeaYRviTyIZkL/D5/FmPXQiA6ecd6z0/+VwoNQtp7aXAQWaRhvz4FM25yqFlHA==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.1.tgz", + "integrity": "sha512-lMAPgIJoil8V9ZxsMbEflMsvZmWcHbRVMc4JDY9jPO9V4welpF43h/O267b1RqlcRnC5MEbVQV605GYkTZY29Q==", "requires": { "@babel/runtime": "^7.20.6", "@types/prop-types": "^15.7.5", @@ -19833,9 +19833,9 @@ "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==" }, "@remix-run/router": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz", - "integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.2.0.tgz", + "integrity": "sha512-GO82KYYTWPRCgdNtnheaZG3LcViUlxRFlHM7ykh7N+ufoXi6PVIHoP+9RUG/vuzl2hr9i/h6EA1Eq+2HpqJ0gQ==" }, "@rollup/plugin-babel": { "version": "5.3.1", @@ -20292,9 +20292,9 @@ } }, "@types/react-dom": { - "version": "18.0.9", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.9.tgz", - "integrity": "sha512-qnVvHxASt/H7i+XG1U1xMiY5t+IHcPGUK7TDMDzom08xa7e86eCeKOiLZezwCKVxJn6NEiiy2ekgX8aQssjIKg==", + "version": "18.0.10", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.10.tgz", + "integrity": "sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==", "requires": { "@types/react": "*" } @@ -27748,20 +27748,20 @@ "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==" }, "react-router": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz", - "integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.6.0.tgz", + "integrity": "sha512-+VPfCIaFbkW7BAiB/2oeprxKAt1KLbl+zXZ10CXOYezKWgBmTKyh8XjI53eLqY5kd7uY+V4rh3UW44FclwUU+Q==", "requires": { - "@remix-run/router": "1.1.0" + "@remix-run/router": "1.2.0" } }, "react-router-dom": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz", - "integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.6.0.tgz", + "integrity": "sha512-qC4jnvpfCPKVle1mKLD75IvZLcbVJyFMlSn16WY9ZiOed3dgSmqhslCf/u3tmSccWOujkdsT/OwGq12bELmvjg==", "requires": { - "@remix-run/router": "1.1.0", - "react-router": "6.5.0" + "@remix-run/router": "1.2.0", + "react-router": "6.6.0" } }, "react-scripts": { @@ -29136,9 +29136,9 @@ } }, "typesafe-i18n": { - "version": "5.17.2", - "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.17.2.tgz", - "integrity": "sha512-G5LCXLDugzvG0GtkBS1+0f+ctQzQNPqwPElvrOMQ8LAG/mwwtW84H42sGfNJ9Dfqlh+t7250N/8TQ7Vta98cKQ==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.18.0.tgz", + "integrity": "sha512-4uzmbSwBOYQ5Upuam1btGf8/fKhBR19b8fg1auILRs9tHlaWtvIYORU7MJsoNee/rmQfIAv6pkiXrIEuMCoW7Q==", "requires": {} }, "typescript": { diff --git a/interface/package.json b/interface/package.json index 7b9609c09..03b79d463 100644 --- a/interface/package.json +++ b/interface/package.json @@ -8,12 +8,12 @@ "@emotion/styled": "^11.10.5", "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.11.0", - "@mui/material": "^5.11.0", + "@mui/material": "^5.11.1", "@table-library/react-table-library": "4.0.23", "@types/lodash": "^4.14.191", "@types/node": "^18.11.17", "@types/react": "^18.0.26", - "@types/react-dom": "^18.0.9", + "@types/react-dom": "^18.0.10", "@types/react-router-dom": "^5.3.3", "async-validator": "^4.2.5", "axios": "^1.2.1", @@ -27,10 +27,10 @@ "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", "react-icons": "^4.7.1", - "react-router-dom": "^6.5.0", + "react-router-dom": "^6.6.0", "react-scripts": "5.0.1", "sockette": "^2.0.6", - "typesafe-i18n": "^5.17.2", + "typesafe-i18n": "^5.18.0", "typescript": "^4.9.4" }, "scripts": { diff --git a/src/emsdevicevalue.h b/src/emsdevicevalue.h index 42e93e2ee..918570a8a 100644 --- a/src/emsdevicevalue.h +++ b/src/emsdevicevalue.h @@ -48,28 +48,28 @@ class DeviceValue { // also used with HA as uom enum DeviceValueUOM : uint8_t { NONE = 0, // 0 - DEGREES, // 1 - DEGREES_R, // 2 - relative temperature - PERCENT, // 3 + DEGREES, // 1 - °C + DEGREES_R, // 2 - °C (relative temperature) + PERCENT, // 3 - % LMIN, // 4 - l/min KWH, // 5 - kWh WH, // 6 - Wh - HOURS, // 7 - MINUTES, // 8 + HOURS, // 7 - h + MINUTES, // 8 - m UA, // 9 - µA - BAR, // 10 + BAR, // 10 - bar KW, // 11 - kW - W, // 12 - KB, // 13 - SECONDS, // 14 + W, // 12 - W + KB, // 13 - kB + SECONDS, // 14 - s DBM, // 15 - dBm - FAHRENHEIT, // 16 + FAHRENHEIT, // 16 - °F MV, // 17 - mV - SQM, // 18 - square meter - M3, // 19 - cubic meter - L, // 20 - liter - KMIN, // 21 - Kelvin * minutes - K, // 22 - Kelvin + SQM, // 18 - m² + M3, // 19 - m³ + L, // 20 - L + KMIN, // 21 - K*min + K, // 22 - K CONNECTIVITY // 23 - used in HA }; diff --git a/src/locale_common.h b/src/locale_common.h index ce4d79603..4279345d6 100644 --- a/src/locale_common.h +++ b/src/locale_common.h @@ -197,7 +197,7 @@ MAKE_PSTR_LIST(tpl_input, "Format: [[]") // Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp -// Translating hours/minute/seconds in emsdevice.cpp +// Translating hours/minute/seconds are done in emsdevice.cpp (uom_to_string()) MAKE_PSTR(uom_blank, " ") MAKE_PSTR(uom_percent, "%") MAKE_PSTR(uom_degrees, "°C") @@ -208,13 +208,13 @@ MAKE_PSTR(uom_ua, "µA") MAKE_PSTR(uom_lmin, "l/min") MAKE_PSTR(uom_kw, "kW") MAKE_PSTR(uom_w, "W") -MAKE_PSTR(uom_kb, "KB") +MAKE_PSTR(uom_kb, "kB") MAKE_PSTR(uom_dbm, "dBm") MAKE_PSTR(uom_fahrenheit, "°F") MAKE_PSTR(uom_mv, "mV") MAKE_PSTR(uom_sqm, "m²") MAKE_PSTR(uom_m3, "m³") -MAKE_PSTR(uom_l, "l") +MAKE_PSTR(uom_l, "L") MAKE_PSTR(uom_kmin, "K*min") MAKE_PSTR(uom_k, "K") diff --git a/src/mqtt.cpp b/src/mqtt.cpp index bfb350a6c..c034f7a74 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -66,16 +66,10 @@ MAKE_PSTR_WORD(measurement) MAKE_PSTR_WORD(total_increasing) MAKE_PSTR(icondegrees, "mdi:coolant-temperature") // DeviceValueUOM::DEGREES MAKE_PSTR(iconpercent, "mdi:percent-outline") // DeviceValueUOM::PERCENT -MAKE_PSTR(icontime, "mdi:clock-outline") // DeviceValueUOM::SECONDS MINUTES & HOURS MAKE_PSTR(iconkb, "mdi:memory") // DeviceValueUOM::KB MAKE_PSTR(iconlmin, "mdi:water-boiler") // DeviceValueUOM::LMIN -// MAKE_PSTR(iconkwh, "mdi:transmission-tower") // DeviceValueUOM::KWH & WH -MAKE_PSTR(iconua, "mdi:lightning-bolt-circle") // DeviceValueUOM::UA -// MAKE_PSTR(iconbar, "mdi:gauge") // DeviceValueUOM::BAR -// MAKE_PSTR(iconkw, "mdi:omega") // DeviceValueUOM::KW & W -// MAKE_PSTR(icondbm, "mdi:wifi-strength-2") // DeviceValueUOM::DBM -MAKE_PSTR(iconnum, "mdi:counter") // DeviceValueUOM::NONE -// MAKE_PSTR(icondevice, "mdi:home-automation") // for devices in HA +MAKE_PSTR(iconua, "mdi:lightning-bolt-circle") // DeviceValueUOM::UA +MAKE_PSTR(iconnum, "mdi:counter") // DeviceValueUOM::NONE uuid::log::Logger Mqtt::logger_{F_(mqtt), uuid::log::Facility::DAEMON}; @@ -1171,8 +1165,16 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev doc["payload_off"] = Helpers::render_boolean(result, false); doc[sc_ha] = F_(measurement); } else { - // always set the uom - if (uom != DeviceValueUOM::NONE) { + // always set the uom, using the standards except for hours/minutes/seconds + // using HA specific codes from https://github.com/home-assistant/core/blob/dev/homeassistant/const.py + if (uom == DeviceValueUOM::HOURS) { + doc[uom_ha] = "h"; + } else if (uom == DeviceValueUOM::MINUTES) { + doc[uom_ha] = "min"; + } else if (uom == DeviceValueUOM::SECONDS) { + doc[uom_ha] = "s"; + } else if (uom != DeviceValueUOM::NONE) { + // default doc[uom_ha] = EMSdevice::uom_to_string(uom); } } @@ -1196,12 +1198,12 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev case DeviceValueUOM::SECONDS: case DeviceValueUOM::MINUTES: case DeviceValueUOM::HOURS: - doc[ic_ha] = F_(icontime); if (type == DeviceValueType::TIME) { doc[sc_ha] = F_(total_increasing); } else { doc[sc_ha] = F_(measurement); } + doc[dc_ha] = "duration"; // https://github.com/emsesp/EMS-ESP32/issues/822 break; case DeviceValueUOM::KB: doc[ic_ha] = F_(iconkb);