Merge pull request #830 from proddy/dev

#822 and #829
This commit is contained in:
Proddy
2022-12-24 08:09:44 +01:00
committed by GitHub
24 changed files with 326 additions and 258 deletions

View File

@@ -24,8 +24,9 @@
- Add more bus-ids [#673](https://github.com/emsesp/EMS-ESP32/issues/673) - Add more bus-ids [#673](https://github.com/emsesp/EMS-ESP32/issues/673)
- Use HA connectivity device class for Status, added boot time [#751](https://github.com/emsesp/EMS-ESP32/issues/751) - Use HA connectivity device class for Status, added boot time [#751](https://github.com/emsesp/EMS-ESP32/issues/751)
- Add commands for analog sensors outputs - Add commands for analog sensors outputs
- Support for multiple EMS-ESPs with MQTT and HA [[#759](https://github.com/emsesp/EMS-ESP32/issues/759)] - Support for multiple EMS-ESPs with MQTT and HA [#759](https://github.com/emsesp/EMS-ESP32/issues/759)
- Settings for heatpump silent mode and additional heater [[#802](https://github.com/emsesp/EMS-ESP32/issues/802)] [[#803](https://github.com/emsesp/EMS-ESP32/issues/803)] - Settings for heatpump silent mode and additional heater [#802](https://github.com/emsesp/EMS-ESP32/issues/802)] [[#803](https://github.com/emsesp/EMS-ESP32/issues/803)
- Default MQTT hostname is blank [#829](https://github.com/emsesp/EMS-ESP32/issues/829)
## Fixed ## Fixed
@@ -40,4 +41,5 @@
- reload page after restart button is pressed - reload page after restart button is pressed
- analog/dallas values command as list like ems-devices - analog/dallas values command as list like ems-devices
- analog/dallas HA-entities based on id - 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

View File

@@ -7,8 +7,8 @@ build_flags =
; Access point settings ; Access point settings
-D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED -D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED
-D FACTORY_AP_SSID=\"ems-esp\" ; 1-64 characters -D FACTORY_AP_SSID=\"ems-esp\"
-D FACTORY_AP_PASSWORD=\"ems-esp-neo\" ; 8-64 characters -D FACTORY_AP_PASSWORD=\"ems-esp-neo\"
-D FACTORY_AP_LOCAL_IP=\"192.168.4.1\" -D FACTORY_AP_LOCAL_IP=\"192.168.4.1\"
-D FACTORY_AP_GATEWAY_IP=\"192.168.4.1\" -D FACTORY_AP_GATEWAY_IP=\"192.168.4.1\"
-D FACTORY_AP_SUBNET_MASK=\"255.255.255.0\" -D FACTORY_AP_SUBNET_MASK=\"255.255.255.0\"
@@ -32,7 +32,7 @@ build_flags =
; MQTT settings ; MQTT settings
-D FACTORY_MQTT_ENABLED=false -D FACTORY_MQTT_ENABLED=false
-D FACTORY_MQTT_HOST=\"test.mosquitto.org\" -D FACTORY_MQTT_HOST=\"\"
-D FACTORY_MQTT_PORT=1883 -D FACTORY_MQTT_PORT=1883
-D FACTORY_MQTT_USERNAME=\"\" -D FACTORY_MQTT_USERNAME=\"\"
-D FACTORY_MQTT_PASSWORD=\"\" -D FACTORY_MQTT_PASSWORD=\"\"

View File

@@ -1,5 +1,5 @@
{ {
"adapter": "react", "adapter": "react",
"baseLocale": "pl", "baseLocale": "pl",
"$schema": "https://unpkg.com/typesafe-i18n@5.17.2/schema/typesafe-i18n.json" "$schema": "https://unpkg.com/typesafe-i18n@5.18.0/schema/typesafe-i18n.json"
} }

View File

@@ -12,12 +12,12 @@
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@msgpack/msgpack": "^2.8.0", "@msgpack/msgpack": "^2.8.0",
"@mui/icons-material": "^5.11.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", "@table-library/react-table-library": "4.0.23",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"@types/react": "^18.0.26", "@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9", "@types/react-dom": "^18.0.10",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
"async-validator": "^4.2.5", "async-validator": "^4.2.5",
"axios": "^1.2.1", "axios": "^1.2.1",
@@ -31,10 +31,10 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-icons": "^4.7.1", "react-icons": "^4.7.1",
"react-router-dom": "^6.5.0", "react-router-dom": "^6.6.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"sockette": "^2.0.6", "sockette": "^2.0.6",
"typesafe-i18n": "^5.17.2", "typesafe-i18n": "^5.18.0",
"typescript": "^4.9.4" "typescript": "^4.9.4"
}, },
"devDependencies": { "devDependencies": {
@@ -3091,14 +3091,14 @@
} }
}, },
"node_modules/@mui/base": { "node_modules/@mui/base": {
"version": "5.0.0-alpha.110", "version": "5.0.0-alpha.111",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.110.tgz", "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.111.tgz",
"integrity": "sha512-q4TH9T3sTBknTXXTEf2zO8F3nbHg5iGgiaRx9XErTbXvHrmLrQXbQ4hmrLERocSTBFCFWkKyne/qZj0diWlPtA==", "integrity": "sha512-2wfIPpl97S4dPzD0QOM3UIzQ/EuXCYQvHmXxTpfKxev/cfkzOe7Ik/McoYUBbtM1bSOqH3W276R/L2LF9cyXqQ==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@emotion/is-prop-valid": "^1.2.0", "@emotion/is-prop-valid": "^1.2.0",
"@mui/types": "^7.2.3", "@mui/types": "^7.2.3",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
@@ -3123,9 +3123,9 @@
} }
}, },
"node_modules/@mui/core-downloads-tracker": { "node_modules/@mui/core-downloads-tracker": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.1.tgz",
"integrity": "sha512-Bmogung451ezVv2YI1RvweOIVsTj2RQ4Fk61+e/+8LFPLTFEwVGbL0YhNy1VB5tri8pzGNV228kxtWVTFooQkg==", "integrity": "sha512-QVqVNlZ2K+LqUDE5kFgYd0r4KekR/dv2cNYbAutQWbfOA8VPVUVrDz0ELrEcoe8TjM/CwnsmGvaDh/YSNl/ALA==",
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
"url": "https://opencollective.com/mui" "url": "https://opencollective.com/mui"
@@ -3157,16 +3157,16 @@
} }
}, },
"node_modules/@mui/material": { "node_modules/@mui/material": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.1.tgz",
"integrity": "sha512-8Zl34lb89rLKTTi50Kakki675/LLHMKKnkp8Ee3rAZ2qmisQlRODsGh1MBjENKp0vwhQnNSvlsCfJteVTfotPQ==", "integrity": "sha512-yaZiXvcrl2vgUK+VO24780BWRgwdAMmAyuMVZnRTts1Yu0tWd6PjIYq2ZtaOlpj6/LbaSS+Q2kSfxYnDQ20CEQ==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@mui/base": "5.0.0-alpha.110", "@mui/base": "5.0.0-alpha.111",
"@mui/core-downloads-tracker": "^5.11.0", "@mui/core-downloads-tracker": "^5.11.1",
"@mui/system": "^5.11.0", "@mui/system": "^5.11.1",
"@mui/types": "^7.2.3", "@mui/types": "^7.2.3",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"@types/react-transition-group": "^4.4.5", "@types/react-transition-group": "^4.4.5",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"csstype": "^3.1.1", "csstype": "^3.1.1",
@@ -3201,12 +3201,12 @@
} }
}, },
"node_modules/@mui/private-theming": { "node_modules/@mui/private-theming": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.1.tgz",
"integrity": "sha512-UFQLb9x5Sj4pg2GhhCGw3Ls/y1Hw/tz9RsBrULvUF0Vgps1z19o7XTq2xqUvp7pN7fJTW7eVIT2gwVg2xlk8PQ==", "integrity": "sha512-nnHg7kA5RwFRhy0wiDYe59sLCVGORpPypL1JcEdhv0+N0Zbmc2E/y4z2zqMRZ62MAEscpro7cQbvv244ThA84A==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
}, },
"engines": { "engines": {
@@ -3258,15 +3258,15 @@
} }
}, },
"node_modules/@mui/system": { "node_modules/@mui/system": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.1.tgz",
"integrity": "sha512-HFUT7Dlmyq6Wfuxsw8QBXZxXDYIQQaJ4YHaZd7s+nDMcjerLnILxjh2g3a6umtOUM+jEcRaFJAtvLZvlGfa5fw==", "integrity": "sha512-BEA2S0hay8n8CcZftkeAVsi0nsb5ZjdnZRCahv5lX7QJYwDjO4ucJ6lnvxHe2v/9Te1LLjTO7ojxu/qM6CE5Cg==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@mui/private-theming": "^5.11.0", "@mui/private-theming": "^5.11.1",
"@mui/styled-engine": "^5.11.0", "@mui/styled-engine": "^5.11.0",
"@mui/types": "^7.2.3", "@mui/types": "^7.2.3",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"csstype": "^3.1.1", "csstype": "^3.1.1",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
@@ -3310,9 +3310,9 @@
} }
}, },
"node_modules/@mui/utils": { "node_modules/@mui/utils": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.1.tgz",
"integrity": "sha512-DP/YDaVVCVzJpZ5FFPLKNmaJkeaYRviTyIZkL/D5/FmPXQiA6ecd6z0/+VwoNQtp7aXAQWaRhvz4FM25yqFlHA==", "integrity": "sha512-lMAPgIJoil8V9ZxsMbEflMsvZmWcHbRVMc4JDY9jPO9V4welpF43h/O267b1RqlcRnC5MEbVQV605GYkTZY29Q==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@types/prop-types": "^15.7.5", "@types/prop-types": "^15.7.5",
@@ -3458,9 +3458,9 @@
} }
}, },
"node_modules/@remix-run/router": { "node_modules/@remix-run/router": {
"version": "1.1.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.2.0.tgz",
"integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==", "integrity": "sha512-GO82KYYTWPRCgdNtnheaZG3LcViUlxRFlHM7ykh7N+ufoXi6PVIHoP+9RUG/vuzl2hr9i/h6EA1Eq+2HpqJ0gQ==",
"engines": { "engines": {
"node": ">=14" "node": ">=14"
} }
@@ -4062,9 +4062,9 @@
} }
}, },
"node_modules/@types/react-dom": { "node_modules/@types/react-dom": {
"version": "18.0.9", "version": "18.0.10",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.9.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.10.tgz",
"integrity": "sha512-qnVvHxASt/H7i+XG1U1xMiY5t+IHcPGUK7TDMDzom08xa7e86eCeKOiLZezwCKVxJn6NEiiy2ekgX8aQssjIKg==", "integrity": "sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==",
"dependencies": { "dependencies": {
"@types/react": "*" "@types/react": "*"
} }
@@ -14576,11 +14576,11 @@
} }
}, },
"node_modules/react-router": { "node_modules/react-router": {
"version": "6.5.0", "version": "6.6.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.6.0.tgz",
"integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==", "integrity": "sha512-+VPfCIaFbkW7BAiB/2oeprxKAt1KLbl+zXZ10CXOYezKWgBmTKyh8XjI53eLqY5kd7uY+V4rh3UW44FclwUU+Q==",
"dependencies": { "dependencies": {
"@remix-run/router": "1.1.0" "@remix-run/router": "1.2.0"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=14"
@@ -14590,12 +14590,12 @@
} }
}, },
"node_modules/react-router-dom": { "node_modules/react-router-dom": {
"version": "6.5.0", "version": "6.6.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.6.0.tgz",
"integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==", "integrity": "sha512-qC4jnvpfCPKVle1mKLD75IvZLcbVJyFMlSn16WY9ZiOed3dgSmqhslCf/u3tmSccWOujkdsT/OwGq12bELmvjg==",
"dependencies": { "dependencies": {
"@remix-run/router": "1.1.0", "@remix-run/router": "1.2.0",
"react-router": "6.5.0" "react-router": "6.6.0"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=14"
@@ -16441,9 +16441,9 @@
} }
}, },
"node_modules/typesafe-i18n": { "node_modules/typesafe-i18n": {
"version": "5.17.2", "version": "5.18.0",
"resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.17.2.tgz", "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.18.0.tgz",
"integrity": "sha512-G5LCXLDugzvG0GtkBS1+0f+ctQzQNPqwPElvrOMQ8LAG/mwwtW84H42sGfNJ9Dfqlh+t7250N/8TQ7Vta98cKQ==", "integrity": "sha512-4uzmbSwBOYQ5Upuam1btGf8/fKhBR19b8fg1auILRs9tHlaWtvIYORU7MJsoNee/rmQfIAv6pkiXrIEuMCoW7Q==",
"bin": { "bin": {
"typesafe-i18n": "cli/typesafe-i18n.mjs" "typesafe-i18n": "cli/typesafe-i18n.mjs"
}, },
@@ -19657,14 +19657,14 @@
"integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==" "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ=="
}, },
"@mui/base": { "@mui/base": {
"version": "5.0.0-alpha.110", "version": "5.0.0-alpha.111",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.110.tgz", "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.111.tgz",
"integrity": "sha512-q4TH9T3sTBknTXXTEf2zO8F3nbHg5iGgiaRx9XErTbXvHrmLrQXbQ4hmrLERocSTBFCFWkKyne/qZj0diWlPtA==", "integrity": "sha512-2wfIPpl97S4dPzD0QOM3UIzQ/EuXCYQvHmXxTpfKxev/cfkzOe7Ik/McoYUBbtM1bSOqH3W276R/L2LF9cyXqQ==",
"requires": { "requires": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@emotion/is-prop-valid": "^1.2.0", "@emotion/is-prop-valid": "^1.2.0",
"@mui/types": "^7.2.3", "@mui/types": "^7.2.3",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
@@ -19672,9 +19672,9 @@
} }
}, },
"@mui/core-downloads-tracker": { "@mui/core-downloads-tracker": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.1.tgz",
"integrity": "sha512-Bmogung451ezVv2YI1RvweOIVsTj2RQ4Fk61+e/+8LFPLTFEwVGbL0YhNy1VB5tri8pzGNV228kxtWVTFooQkg==" "integrity": "sha512-QVqVNlZ2K+LqUDE5kFgYd0r4KekR/dv2cNYbAutQWbfOA8VPVUVrDz0ELrEcoe8TjM/CwnsmGvaDh/YSNl/ALA=="
}, },
"@mui/icons-material": { "@mui/icons-material": {
"version": "5.11.0", "version": "5.11.0",
@@ -19685,16 +19685,16 @@
} }
}, },
"@mui/material": { "@mui/material": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.11.1.tgz",
"integrity": "sha512-8Zl34lb89rLKTTi50Kakki675/LLHMKKnkp8Ee3rAZ2qmisQlRODsGh1MBjENKp0vwhQnNSvlsCfJteVTfotPQ==", "integrity": "sha512-yaZiXvcrl2vgUK+VO24780BWRgwdAMmAyuMVZnRTts1Yu0tWd6PjIYq2ZtaOlpj6/LbaSS+Q2kSfxYnDQ20CEQ==",
"requires": { "requires": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@mui/base": "5.0.0-alpha.110", "@mui/base": "5.0.0-alpha.111",
"@mui/core-downloads-tracker": "^5.11.0", "@mui/core-downloads-tracker": "^5.11.1",
"@mui/system": "^5.11.0", "@mui/system": "^5.11.1",
"@mui/types": "^7.2.3", "@mui/types": "^7.2.3",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"@types/react-transition-group": "^4.4.5", "@types/react-transition-group": "^4.4.5",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"csstype": "^3.1.1", "csstype": "^3.1.1",
@@ -19704,12 +19704,12 @@
} }
}, },
"@mui/private-theming": { "@mui/private-theming": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.1.tgz",
"integrity": "sha512-UFQLb9x5Sj4pg2GhhCGw3Ls/y1Hw/tz9RsBrULvUF0Vgps1z19o7XTq2xqUvp7pN7fJTW7eVIT2gwVg2xlk8PQ==", "integrity": "sha512-nnHg7kA5RwFRhy0wiDYe59sLCVGORpPypL1JcEdhv0+N0Zbmc2E/y4z2zqMRZ62MAEscpro7cQbvv244ThA84A==",
"requires": { "requires": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
} }
}, },
@@ -19725,15 +19725,15 @@
} }
}, },
"@mui/system": { "@mui/system": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.11.1.tgz",
"integrity": "sha512-HFUT7Dlmyq6Wfuxsw8QBXZxXDYIQQaJ4YHaZd7s+nDMcjerLnILxjh2g3a6umtOUM+jEcRaFJAtvLZvlGfa5fw==", "integrity": "sha512-BEA2S0hay8n8CcZftkeAVsi0nsb5ZjdnZRCahv5lX7QJYwDjO4ucJ6lnvxHe2v/9Te1LLjTO7ojxu/qM6CE5Cg==",
"requires": { "requires": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@mui/private-theming": "^5.11.0", "@mui/private-theming": "^5.11.1",
"@mui/styled-engine": "^5.11.0", "@mui/styled-engine": "^5.11.0",
"@mui/types": "^7.2.3", "@mui/types": "^7.2.3",
"@mui/utils": "^5.11.0", "@mui/utils": "^5.11.1",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"csstype": "^3.1.1", "csstype": "^3.1.1",
"prop-types": "^15.8.1" "prop-types": "^15.8.1"
@@ -19746,9 +19746,9 @@
"requires": {} "requires": {}
}, },
"@mui/utils": { "@mui/utils": {
"version": "5.11.0", "version": "5.11.1",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.0.tgz", "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.11.1.tgz",
"integrity": "sha512-DP/YDaVVCVzJpZ5FFPLKNmaJkeaYRviTyIZkL/D5/FmPXQiA6ecd6z0/+VwoNQtp7aXAQWaRhvz4FM25yqFlHA==", "integrity": "sha512-lMAPgIJoil8V9ZxsMbEflMsvZmWcHbRVMc4JDY9jPO9V4welpF43h/O267b1RqlcRnC5MEbVQV605GYkTZY29Q==",
"requires": { "requires": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@types/prop-types": "^15.7.5", "@types/prop-types": "^15.7.5",
@@ -19833,9 +19833,9 @@
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==" "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw=="
}, },
"@remix-run/router": { "@remix-run/router": {
"version": "1.1.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.2.0.tgz",
"integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==" "integrity": "sha512-GO82KYYTWPRCgdNtnheaZG3LcViUlxRFlHM7ykh7N+ufoXi6PVIHoP+9RUG/vuzl2hr9i/h6EA1Eq+2HpqJ0gQ=="
}, },
"@rollup/plugin-babel": { "@rollup/plugin-babel": {
"version": "5.3.1", "version": "5.3.1",
@@ -20292,9 +20292,9 @@
} }
}, },
"@types/react-dom": { "@types/react-dom": {
"version": "18.0.9", "version": "18.0.10",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.9.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.10.tgz",
"integrity": "sha512-qnVvHxASt/H7i+XG1U1xMiY5t+IHcPGUK7TDMDzom08xa7e86eCeKOiLZezwCKVxJn6NEiiy2ekgX8aQssjIKg==", "integrity": "sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==",
"requires": { "requires": {
"@types/react": "*" "@types/react": "*"
} }
@@ -27748,20 +27748,20 @@
"integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==" "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A=="
}, },
"react-router": { "react-router": {
"version": "6.5.0", "version": "6.6.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.6.0.tgz",
"integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==", "integrity": "sha512-+VPfCIaFbkW7BAiB/2oeprxKAt1KLbl+zXZ10CXOYezKWgBmTKyh8XjI53eLqY5kd7uY+V4rh3UW44FclwUU+Q==",
"requires": { "requires": {
"@remix-run/router": "1.1.0" "@remix-run/router": "1.2.0"
} }
}, },
"react-router-dom": { "react-router-dom": {
"version": "6.5.0", "version": "6.6.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.6.0.tgz",
"integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==", "integrity": "sha512-qC4jnvpfCPKVle1mKLD75IvZLcbVJyFMlSn16WY9ZiOed3dgSmqhslCf/u3tmSccWOujkdsT/OwGq12bELmvjg==",
"requires": { "requires": {
"@remix-run/router": "1.1.0", "@remix-run/router": "1.2.0",
"react-router": "6.5.0" "react-router": "6.6.0"
} }
}, },
"react-scripts": { "react-scripts": {
@@ -29136,9 +29136,9 @@
} }
}, },
"typesafe-i18n": { "typesafe-i18n": {
"version": "5.17.2", "version": "5.18.0",
"resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.17.2.tgz", "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.18.0.tgz",
"integrity": "sha512-G5LCXLDugzvG0GtkBS1+0f+ctQzQNPqwPElvrOMQ8LAG/mwwtW84H42sGfNJ9Dfqlh+t7250N/8TQ7Vta98cKQ==", "integrity": "sha512-4uzmbSwBOYQ5Upuam1btGf8/fKhBR19b8fg1auILRs9tHlaWtvIYORU7MJsoNee/rmQfIAv6pkiXrIEuMCoW7Q==",
"requires": {} "requires": {}
}, },
"typescript": { "typescript": {

View File

@@ -8,12 +8,12 @@
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@msgpack/msgpack": "^2.8.0", "@msgpack/msgpack": "^2.8.0",
"@mui/icons-material": "^5.11.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", "@table-library/react-table-library": "4.0.23",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"@types/react": "^18.0.26", "@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9", "@types/react-dom": "^18.0.10",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
"async-validator": "^4.2.5", "async-validator": "^4.2.5",
"axios": "^1.2.1", "axios": "^1.2.1",
@@ -27,10 +27,10 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-icons": "^4.7.1", "react-icons": "^4.7.1",
"react-router-dom": "^6.5.0", "react-router-dom": "^6.6.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"sockette": "^2.0.6", "sockette": "^2.0.6",
"typesafe-i18n": "^5.17.2", "typesafe-i18n": "^5.18.0",
"typescript": "^4.9.4" "typescript": "^4.9.4"
}, },
"scripts": { "scripts": {

View File

@@ -4,7 +4,7 @@ import { ValidateFieldsError } from 'async-validator';
import { Button, Checkbox, MenuItem, Grid, Typography, InputAdornment } from '@mui/material'; import { Button, Checkbox, MenuItem, Grid, Typography, InputAdornment } from '@mui/material';
import SaveIcon from '@mui/icons-material/Save'; import SaveIcon from '@mui/icons-material/Save';
import { MQTT_SETTINGS_VALIDATOR, validate } from '../../validators'; import { createMqttSettingsValidator, validate } from '../../validators';
import { import {
BlockFormControlLabel, BlockFormControlLabel,
ButtonRow, ButtonRow,
@@ -39,7 +39,7 @@ const MqttSettingsForm: FC = () => {
const validateAndSubmit = async () => { const validateAndSubmit = async () => {
try { try {
setFieldErrors(undefined); setFieldErrors(undefined);
await validate(MQTT_SETTINGS_VALIDATOR, data); await validate(createMqttSettingsValidator(data), data);
saveData(); saveData();
} catch (errors: any) { } catch (errors: any) {
setFieldErrors(errors); setFieldErrors(errors);

View File

@@ -71,7 +71,7 @@ const de: Translation = {
TEMP_SENSOR: 'Temperatursensor', TEMP_SENSOR: 'Temperatursensor',
TEMP_SENSORS: 'Temperatursensoren', TEMP_SENSORS: 'Temperatursensoren',
WRITE_CMD_SENT: 'Befehl schreiben wurde gesendet', WRITE_CMD_SENT: 'Befehl schreiben wurde gesendet',
WRITE_CMD_FAILED: 'Befehl schreiben failed', WRITE_CMD_FAILED: 'Befehl schreiben failed', // TODO
EMS_BUS_WARNING: 'EMS-Bus getrennt. Wenn diese Warnung nach einigen Sekunden immer noch besteht, überprüfen Sie bitte die Einstellungen und das Board-Profil', EMS_BUS_WARNING: 'EMS-Bus getrennt. Wenn diese Warnung nach einigen Sekunden immer noch besteht, überprüfen Sie bitte die Einstellungen und das Board-Profil',
EMS_BUS_SCANNING: 'Suche nach EMS Geräten...', EMS_BUS_SCANNING: 'Suche nach EMS Geräten...',
CONNECTED: 'Verbunden', CONNECTED: 'Verbunden',

View File

@@ -69,8 +69,8 @@ const fr: Translation = {
SENSOR: 'Capteur', SENSOR: 'Capteur',
TEMP_SENSOR: 'Capteur de température', TEMP_SENSOR: 'Capteur de température',
TEMP_SENSORS: 'Capteurs de température', TEMP_SENSORS: 'Capteurs de température',
WRITE_CMD_SENT: 'Envoyer la commande sent', WRITE_CMD_SENT: 'Envoyer la commande sent', // TODO
WRITE_CMD_FAILED: 'Envoyer la commande failed', WRITE_CMD_FAILED: 'Envoyer la commande failed', // TODO
EMS_BUS_WARNING: 'Bus EMS déconnecté. Si ce message persiste après quelques secondes, vérifiez les paramètres et la configuration de la carte.', EMS_BUS_WARNING: 'Bus EMS déconnecté. Si ce message persiste après quelques secondes, vérifiez les paramètres et la configuration de la carte.',
EMS_BUS_SCANNING: 'Scan des appareils EMS...', EMS_BUS_SCANNING: 'Scan des appareils EMS...',
CONNECTED: 'Connecté', CONNECTED: 'Connecté',
@@ -249,10 +249,10 @@ const fr: Translation = {
MQTT_INT_HEARTBEAT: 'Battements', MQTT_INT_HEARTBEAT: 'Battements',
MQTT_QUEUE: 'Queue MQTT', MQTT_QUEUE: 'Queue MQTT',
DEFAULT: 'Défaut', DEFAULT: 'Défaut',
MQTT_ENTITY_FORMAT: 'Entity ID format', MQTT_ENTITY_FORMAT: 'Entity ID format', // TODO
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)',// TODO
MQTT_ENTITY_FORMAT_1: 'Single instance, short name', MQTT_ENTITY_FORMAT_1: 'Single instance, short name', // TODO
MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', // TODO
MQTT_CLEAN_SESSION: 'Flag Clean Session', MQTT_CLEAN_SESSION: 'Flag Clean Session',
MQTT_RETAIN_FLAG: 'Toujours activer le Retain Flag', MQTT_RETAIN_FLAG: 'Toujours activer le Retain Flag',
INACTIVE: 'Inactif', INACTIVE: 'Inactif',

View File

@@ -69,8 +69,8 @@ const nl: Translation = {
SENSOR: 'Sensor', SENSOR: 'Sensor',
TEMP_SENSOR: 'Temperatuur sensor', TEMP_SENSOR: 'Temperatuur sensor',
TEMP_SENSORS: 'Temperatuur Sensoren', TEMP_SENSORS: 'Temperatuur Sensoren',
WRITE_CMD_SENT: 'Schrijf commando sent', WRITE_CMD_SENT: 'Schrijf commando sent', // TODO
WRITE_CMD_FAILED: 'Schrijf commando failed', WRITE_CMD_FAILED: 'Schrijf commando failed', // TODO
EMS_BUS_WARNING: 'EMS bus niet gevonden. Als deze waarschuwing blijft staan na een paar seconden dan loop de instellingen na en in het bijzonder het apparaat type profiel na.', EMS_BUS_WARNING: 'EMS bus niet gevonden. Als deze waarschuwing blijft staan na een paar seconden dan loop de instellingen na en in het bijzonder het apparaat type profiel na.',
EMS_BUS_SCANNING: 'Scannen naar EMS apparaten...', EMS_BUS_SCANNING: 'Scannen naar EMS apparaten...',
CONNECTED: 'Verbonden', CONNECTED: 'Verbonden',
@@ -249,10 +249,10 @@ const nl: Translation = {
MQTT_INT_HEARTBEAT: 'Heartbeat', MQTT_INT_HEARTBEAT: 'Heartbeat',
MQTT_QUEUE: 'MQTT Queue', MQTT_QUEUE: 'MQTT Queue',
DEFAULT: 'Default', DEFAULT: 'Default',
MQTT_ENTITY_FORMAT: 'Entity ID format', MQTT_ENTITY_FORMAT: 'Entity ID format', // TODO
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', // TODO
MQTT_ENTITY_FORMAT_1: 'Single instance, short name', MQTT_ENTITY_FORMAT_1: 'Single instance, short name', // TODO
MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', // TODO
MQTT_CLEAN_SESSION: 'Clean Session aan', MQTT_CLEAN_SESSION: 'Clean Session aan',
MQTT_RETAIN_FLAG: 'Retain flag aan', MQTT_RETAIN_FLAG: 'Retain flag aan',
INACTIVE: 'Inactief', INACTIVE: 'Inactief',

View File

@@ -69,8 +69,8 @@ const no: Translation = {
SENSOR: 'Sensor', SENSOR: 'Sensor',
TEMP_SENSOR: 'Temperatursensor', TEMP_SENSOR: 'Temperatursensor',
TEMP_SENSORS: 'Temperaturesensorer', TEMP_SENSORS: 'Temperaturesensorer',
WRITE_CMD_SENT: 'Skriv kommando sent', WRITE_CMD_SENT: 'Skriv kommando sent', // TODO
WRITE_CMD_FAILED: 'Skriv kommandofailed', WRITE_CMD_FAILED: 'Skriv kommando failed', // TODO
EMS_BUS_WARNING: 'EMS bussen koblet ned. Hvis denne advarselen fortsetter etter noen f¨sekunder sjekk instillinger og prosessorkort', EMS_BUS_WARNING: 'EMS bussen koblet ned. Hvis denne advarselen fortsetter etter noen f¨sekunder sjekk instillinger og prosessorkort',
EMS_BUS_SCANNING: 'Søker etter EMS enheter...', EMS_BUS_SCANNING: 'Søker etter EMS enheter...',
CONNECTED: 'Tilkoblet', CONNECTED: 'Tilkoblet',
@@ -249,10 +249,10 @@ const no: Translation = {
MQTT_INT_HEARTBEAT: 'Heartbeat', MQTT_INT_HEARTBEAT: 'Heartbeat',
MQTT_QUEUE: 'MQTT Queue', MQTT_QUEUE: 'MQTT Queue',
DEFAULT: 'Standard', DEFAULT: 'Standard',
MQTT_ENTITY_FORMAT: 'Entity ID format', MQTT_ENTITY_FORMAT: 'Entity ID format', // TODO
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', // TODO
MQTT_ENTITY_FORMAT_1: 'Single instance, short name', MQTT_ENTITY_FORMAT_1: 'Single instance, short name', // TODO
MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', // TODO
MQTT_CLEAN_SESSION: 'Benytt Clean Session', MQTT_CLEAN_SESSION: 'Benytt Clean Session',
MQTT_RETAIN_FLAG: 'Alltid sett Retain flag', MQTT_RETAIN_FLAG: 'Alltid sett Retain flag',
INACTIVE: 'Innaktiv', INACTIVE: 'Innaktiv',

View File

@@ -69,8 +69,8 @@ const se: Translation = {
SENSOR: 'Sensor', SENSOR: 'Sensor',
TEMP_SENSOR: 'Temperatursensor', TEMP_SENSOR: 'Temperatursensor',
TEMP_SENSORS: 'Temperatursensorer', TEMP_SENSORS: 'Temperatursensorer',
WRITE_CMD_SENT: 'Skrivkommando sent', WRITE_CMD_SENT: 'Skrivkommando sent', // TODO
WRITE_CMD_FAILED: 'Skrivkommando failed', WRITE_CMD_FAILED: 'Skrivkommando failed', // TODO
EMS_BUS_WARNING: 'EMS-buss nedkopplad. Om denna varning kvarstår efter några sekunder, kontrollera inställningar och enhets-profil.', EMS_BUS_WARNING: 'EMS-buss nedkopplad. Om denna varning kvarstår efter några sekunder, kontrollera inställningar och enhets-profil.',
EMS_BUS_SCANNING: 'Söker efter EMS-enheter...', EMS_BUS_SCANNING: 'Söker efter EMS-enheter...',
CONNECTED: 'Ansluten', CONNECTED: 'Ansluten',
@@ -249,10 +249,10 @@ const se: Translation = {
MQTT_INT_HEARTBEAT: 'Heartbeat', MQTT_INT_HEARTBEAT: 'Heartbeat',
MQTT_QUEUE: 'MQTT Queue', MQTT_QUEUE: 'MQTT Queue',
DEFAULT: 'Standard', DEFAULT: 'Standard',
MQTT_ENTITY_FORMAT: 'Entity ID format', MQTT_ENTITY_FORMAT: 'Entity ID format', // TODO
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', MQTT_ENTITY_FORMAT_0: 'Single instance, long name (v3.4)', // TODO
MQTT_ENTITY_FORMAT_1: 'Single instance, short name', MQTT_ENTITY_FORMAT_1: 'Single instance, short name', // TODO
MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', MQTT_ENTITY_FORMAT_2: 'Multiple instances, short name', // TODO
MQTT_CLEAN_SESSION: 'Använd "Clean Session"-flaggan', MQTT_CLEAN_SESSION: 'Använd "Clean Session"-flaggan',
MQTT_RETAIN_FLAG: 'Använd "Always Retain"-flaggan', MQTT_RETAIN_FLAG: 'Använd "Always Retain"-flaggan',
INACTIVE: 'Inaktiv', INACTIVE: 'Inaktiv',

View File

@@ -1,19 +1,23 @@
import Schema from 'async-validator'; import Schema from 'async-validator';
import { MqttSettings } from '../types';
import { IP_OR_HOSTNAME_VALIDATOR } from './shared'; import { IP_OR_HOSTNAME_VALIDATOR } from './shared';
export const MQTT_SETTINGS_VALIDATOR = new Schema({ export const createMqttSettingsValidator = (mqttSettings: MqttSettings) =>
host: [{ required: true, message: 'Host is required' }, IP_OR_HOSTNAME_VALIDATOR], new Schema({
base: { required: true, message: 'Base is required' }, ...(mqttSettings.enabled && {
port: [ host: [{ required: true, message: 'Host is required' }, IP_OR_HOSTNAME_VALIDATOR],
{ required: true, message: 'Port is required' }, base: { required: true, message: 'Base is required' },
{ type: 'number', min: 0, max: 65535, message: 'Invalid Port' } port: [
], { required: true, message: 'Port is required' },
keep_alive: [ { type: 'number', min: 0, max: 65535, message: 'Invalid Port' }
{ required: true, message: 'Keep alive is required' }, ],
{ type: 'number', min: 1, max: 86400, message: 'Keep alive must be between 1 and 86400' } keep_alive: [
], { required: true, message: 'Keep alive is required' },
publish_time_heartbeat: [ { type: 'number', min: 1, max: 86400, message: 'Keep alive must be between 1 and 86400' }
{ required: true, message: 'Heartbeat is required' }, ],
{ type: 'number', min: 10, max: 86400, message: 'Heartbeat must be between 10 and 86400' } publish_time_heartbeat: [
] { required: true, message: 'Heartbeat is required' },
}); { type: 'number', min: 10, max: 86400, message: 'Heartbeat must be between 10 and 86400' }
]
})
});

View File

@@ -125,8 +125,8 @@ void MqttSettingsService::configureMqtt() {
// disconnect if connected // disconnect if connected
_mqttClient.disconnect(); _mqttClient.disconnect();
// only connect if WiFi is connected and MQTT is enabled // only connect if WiFi is connected and MQTT is enabled
if (_state.enabled && emsesp::EMSESP::system_.network_connected()) { if (_state.enabled && emsesp::EMSESP::system_.network_connected() && !_state.host.isEmpty()) {
// emsesp::EMSESP::logger().info("Configuring Mqtt client"); // emsesp::EMSESP::logger().info("Configuring MQTT client");
_mqttClient.setServer(retainCstr(_state.host.c_str(), &_retainedHost), _state.port); _mqttClient.setServer(retainCstr(_state.host.c_str(), &_retainedHost), _state.port);
if (_state.username.length() > 0) { if (_state.username.length() > 0) {
_mqttClient.setCredentials(retainCstr(_state.username.c_str(), &_retainedUsername), _mqttClient.setCredentials(retainCstr(_state.username.c_str(), &_retainedUsername),
@@ -140,7 +140,7 @@ void MqttSettingsService::configureMqtt() {
_mqttClient.setMaxTopicLength(FACTORY_MQTT_MAX_TOPIC_LENGTH); // hardcode. We don't take this from the settings anymore. _mqttClient.setMaxTopicLength(FACTORY_MQTT_MAX_TOPIC_LENGTH); // hardcode. We don't take this from the settings anymore.
_mqttClient.connect(); _mqttClient.connect();
// } else { // } else {
// emsesp::EMSESP::logger().info("Error configuring Mqtt client"); // emsesp::EMSESP::logger().info("Error configuring MQTT client");
} }
} }

View File

@@ -19,7 +19,7 @@
#endif #endif
#ifndef FACTORY_MQTT_HOST #ifndef FACTORY_MQTT_HOST
#define FACTORY_MQTT_HOST "test.mosquitto.org" #define FACTORY_MQTT_HOST "" // is blank
#endif #endif
#ifndef FACTORY_MQTT_PORT #ifndef FACTORY_MQTT_PORT

View File

@@ -26,42 +26,43 @@
class DummySettings { class DummySettings {
public: public:
String locale = "en"; std::string version{"poerp"};
uint8_t tx_mode = 1; String locale = "en";
uint8_t ems_bus_id = 0x0B; uint8_t tx_mode = 1;
bool syslog_enabled = false; uint8_t ems_bus_id = 0x0B;
int8_t syslog_level = 3; // uuid::log::Level bool syslog_enabled = false;
uint32_t syslog_mark_interval = 0; int8_t syslog_level = 3; // uuid::log::Level
String syslog_host = "192.168.1.4"; uint32_t syslog_mark_interval = 0;
uint16_t syslog_port = 514; String syslog_host = "192.168.1.4";
bool shower_timer = true; uint16_t syslog_port = 514;
bool shower_alert = false; bool shower_timer = true;
uint8_t shower_alert_coldshot = 10; bool shower_alert = false;
uint8_t shower_alert_trigger = 7; uint8_t shower_alert_coldshot = 10;
bool hide_led = false; uint8_t shower_alert_trigger = 7;
bool notoken_api = false; bool hide_led = false;
bool readonly_mode = false; bool notoken_api = false;
uint8_t bool_format = 1; // using "on" and "off" bool readonly_mode = false;
uint8_t bool_dashboard = 1; uint8_t bool_format = 1; // using "on" and "off"
uint8_t enum_format = 1; uint8_t bool_dashboard = 1;
bool nosleep = false; uint8_t enum_format = 1;
bool fahrenheit = false; bool nosleep = false;
bool bandwidth20 = false; bool fahrenheit = false;
bool telnet_enabled = false; bool bandwidth20 = false;
String board_profile = "CUSTOM"; bool telnet_enabled = false;
bool trace_raw = false; String board_profile = "CUSTOM";
bool analog_enabled = true; // analog is enabled bool trace_raw = false;
int8_t weblog_level = 1; bool analog_enabled = true; // analog is enabled
uint8_t weblog_buffer = 50; int8_t weblog_level = 1;
bool weblog_compact = true; uint8_t weblog_buffer = 50;
uint8_t rx_gpio = 0; bool weblog_compact = true;
uint8_t tx_gpio = 0; uint8_t rx_gpio = 0;
uint8_t dallas_gpio = 16; // to ensure its enabled uint8_t tx_gpio = 0;
bool dallas_parasite = false; uint8_t dallas_gpio = 16; // to ensure its enabled
uint8_t led_gpio = 0; bool dallas_parasite = false;
bool low_clock = false; uint8_t led_gpio = 0;
uint8_t pbutton_gpio = false; bool low_clock = false;
uint8_t solar_maxflow = 30; uint8_t pbutton_gpio = false;
uint8_t solar_maxflow = 30;
// MQTT // MQTT
uint16_t publish_time = 10; uint16_t publish_time = 10;

View File

@@ -24,6 +24,7 @@ class FSPersistence {
} }
void readFromFS() { void readFromFS() {
Serial.println();
Serial.print("Fake reading file "); Serial.print("Fake reading file ");
Serial.println(_filePath); Serial.println(_filePath);
applyDefaults(); applyDefaults();

View File

@@ -48,28 +48,28 @@ class DeviceValue {
// also used with HA as uom // also used with HA as uom
enum DeviceValueUOM : uint8_t { enum DeviceValueUOM : uint8_t {
NONE = 0, // 0 NONE = 0, // 0
DEGREES, // 1 DEGREES, // 1 - °C
DEGREES_R, // 2 - relative temperature DEGREES_R, // 2 - °C (relative temperature)
PERCENT, // 3 PERCENT, // 3 - %
LMIN, // 4 - l/min LMIN, // 4 - l/min
KWH, // 5 - kWh KWH, // 5 - kWh
WH, // 6 - Wh WH, // 6 - Wh
HOURS, // 7 HOURS, // 7 - h
MINUTES, // 8 MINUTES, // 8 - m
UA, // 9 - µA UA, // 9 - µA
BAR, // 10 BAR, // 10 - bar
KW, // 11 - kW KW, // 11 - kW
W, // 12 W, // 12 - W
KB, // 13 KB, // 13 - kB
SECONDS, // 14 SECONDS, // 14 - s
DBM, // 15 - dBm DBM, // 15 - dBm
FAHRENHEIT, // 16 FAHRENHEIT, // 16 - °F
MV, // 17 - mV MV, // 17 - mV
SQM, // 18 - square meter SQM, // 18 -
M3, // 19 - cubic meter M3, // 19 -
L, // 20 - liter L, // 20 - L
KMIN, // 21 - Kelvin * minutes KMIN, // 21 - K*min
K, // 22 - Kelvin K, // 22 - K
CONNECTIVITY // 23 - used in HA CONNECTIVITY // 23 - used in HA
}; };

View File

@@ -1293,13 +1293,20 @@ void EMSESP::start() {
LOG_INFO("Last system reset reason Core0: %s, Core1: %s", system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); LOG_INFO("Last system reset reason Core0: %s, Core1: %s", system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str());
// do any system upgrades // see if we're restoring a settings file
if (system_.check_upgrade()) { if (system_.check_restore()) {
LOG_INFO("System needs a restart to apply new settings. Please wait."); LOG_WARNING("System needs a restart to apply new settings. Please wait.");
system_.system_restart();
};
webSettingsService.begin(); // load EMS-ESP Application settings...
// do any system upgrades
if (system_.check_upgrade()) {
LOG_WARNING("System needs a restart to apply new settings. Please wait.");
system_.system_restart(); system_.system_restart();
}; };
webSettingsService.begin(); // load EMS-ESP Application settings...
system_.reload_settings(); // ... and store some of the settings locally system_.reload_settings(); // ... and store some of the settings locally
webCustomizationService.begin(); // load the customizations webCustomizationService.begin(); // load the customizations

View File

@@ -197,7 +197,7 @@ MAKE_PSTR_LIST(tpl_input, "Format: <inv>[<evu1><evu2><evu3><comp><aux><cool><hea
MAKE_PSTR_LIST(tpl_input4, "Format: <inv>[<comp><aux><cool><heat><dhw><pv>]") MAKE_PSTR_LIST(tpl_input4, "Format: <inv>[<comp><aux><cool><heat><dhw><pv>]")
// Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp // 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_blank, " ")
MAKE_PSTR(uom_percent, "%") MAKE_PSTR(uom_percent, "%")
MAKE_PSTR(uom_degrees, "°C") MAKE_PSTR(uom_degrees, "°C")

View File

@@ -66,16 +66,10 @@ MAKE_PSTR_WORD(measurement)
MAKE_PSTR_WORD(total_increasing) MAKE_PSTR_WORD(total_increasing)
MAKE_PSTR(icondegrees, "mdi:coolant-temperature") // DeviceValueUOM::DEGREES MAKE_PSTR(icondegrees, "mdi:coolant-temperature") // DeviceValueUOM::DEGREES
MAKE_PSTR(iconpercent, "mdi:percent-outline") // DeviceValueUOM::PERCENT 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(iconkb, "mdi:memory") // DeviceValueUOM::KB
MAKE_PSTR(iconlmin, "mdi:water-boiler") // DeviceValueUOM::LMIN 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(iconua, "mdi:lightning-bolt-circle") // DeviceValueUOM::UA MAKE_PSTR(iconnum, "mdi:counter") // DeviceValueUOM::NONE
// 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
uuid::log::Logger Mqtt::logger_{F_(mqtt), uuid::log::Facility::DAEMON}; 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["payload_off"] = Helpers::render_boolean(result, false);
doc[sc_ha] = F_(measurement); doc[sc_ha] = F_(measurement);
} else { } else {
// always set the uom // always set the uom, using the standards except for hours/minutes/seconds
if (uom != DeviceValueUOM::NONE) { // 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); 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::SECONDS:
case DeviceValueUOM::MINUTES: case DeviceValueUOM::MINUTES:
case DeviceValueUOM::HOURS: case DeviceValueUOM::HOURS:
doc[ic_ha] = F_(icontime);
if (type == DeviceValueType::TIME) { if (type == DeviceValueType::TIME) {
doc[sc_ha] = F_(total_increasing); doc[sc_ha] = F_(total_increasing);
} else { } else {
doc[sc_ha] = F_(measurement); doc[sc_ha] = F_(measurement);
} }
doc[dc_ha] = "duration"; // https://github.com/emsesp/EMS-ESP32/issues/822
break; break;
case DeviceValueUOM::KB: case DeviceValueUOM::KB:
doc[ic_ha] = F_(iconkb); doc[ic_ha] = F_(iconkb);

View File

@@ -290,6 +290,8 @@ void System::syslog_init() {
// read some specific system settings to store locally for faster access // read some specific system settings to store locally for faster access
void System::reload_settings() { void System::reload_settings() {
EMSESP::webSettingsService.read([&](WebSettings & settings) { EMSESP::webSettingsService.read([&](WebSettings & settings) {
version_ = settings.version;
pbutton_gpio_ = settings.pbutton_gpio; pbutton_gpio_ = settings.pbutton_gpio;
analog_enabled_ = settings.analog_enabled; analog_enabled_ = settings.analog_enabled;
low_clock_ = settings.low_clock; low_clock_ = settings.low_clock;
@@ -969,10 +971,8 @@ void System::show_system(uuid::console::Shell & shell) {
#endif #endif
} }
// handle upgrades from previous versions // see if there is a restore of an older settings file that needs to be applied
// or managing an uploaded files to replace settings files bool System::check_restore() {
// returns true if we need a reboot
bool System::check_upgrade() {
bool reboot_required = false; bool reboot_required = false;
#ifndef EMSESP_STANDALONE #ifndef EMSESP_STANDALONE
@@ -1012,6 +1012,50 @@ bool System::check_upgrade() {
return reboot_required; return reboot_required;
} }
// handle upgrades from previous versions
// returns true if we need a reboot
bool System::check_upgrade() {
std::string old_version;
// TODO fix
if (version_ != EMSESP_APP_VERSION) {
if (version_.empty()) {
LOG_DEBUG("No version, presuming fresh install. Setting to %s", EMSESP_APP_VERSION);
old_version = EMSESP_APP_VERSION;
} else {
LOG_DEBUG("Going from version %s to %s", version_, EMSESP_APP_VERSION);
old_version = version_;
}
// save the new version
version_ = EMSESP_APP_VERSION;
EMSESP::webSettingsService.update(
[&](WebSettings & settings) {
settings.version = EMSESP_APP_VERSION;
return StateUpdateResult::CHANGED;
},
"local");
}
if (old_version == EMSESP_APP_VERSION) {
return false; // no upgrades or reboot needed. we're on the latest
}
LOG_DEBUG("Doing upgrade..."); // TODO remove
// check variations between versions
// get major version
// get minor version
// get patch version (ignore alphanumerics)
bool reboot_required = false;
return reboot_required;
}
// list commands // list commands
bool System::command_commands(const char * value, const int8_t id, JsonObject & output) { bool System::command_commands(const char * value, const int8_t id, JsonObject & output) {
return Command::list(EMSdevice::DeviceType::SYSTEM, output); return Command::list(EMSdevice::DeviceType::SYSTEM, output);

View File

@@ -75,6 +75,7 @@ class System {
void wifi_tweak(); void wifi_tweak();
void syslog_init(); void syslog_init();
bool check_upgrade(); bool check_upgrade();
bool check_restore();
bool heartbeat_json(JsonObject & output); bool heartbeat_json(JsonObject & output);
void send_heartbeat(); void send_heartbeat();
void send_info_mqtt(const char * event_str, bool send_ntp = false); void send_info_mqtt(const char * event_str, bool send_ntp = false);
@@ -294,6 +295,7 @@ class System {
uint8_t bool_format_; uint8_t bool_format_;
uint8_t enum_format_; uint8_t enum_format_;
bool readonly_mode_; bool readonly_mode_;
std::string version_;
// ethernet // ethernet
uint8_t phy_type_; uint8_t phy_type_;

View File

@@ -80,6 +80,10 @@ void WebSettings::read(WebSettings & settings, JsonObject & root) {
// call on initialization and also when settings are updated via web or console // call on initialization and also when settings are updated via web or console
StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) { StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) {
// load the version of the settings
// will be picked up in System::check_upgrade()
settings.version = root["version"] || "";
// load default GPIO configuration based on board profile // load default GPIO configuration based on board profile
std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
#if CONFIG_IDF_TARGET_ESP32C3 #if CONFIG_IDF_TARGET_ESP32C3

View File

@@ -29,40 +29,41 @@ namespace emsesp {
class WebSettings { class WebSettings {
public: public:
String locale; std::string version;
uint8_t tx_mode; String locale;
uint8_t ems_bus_id; uint8_t tx_mode;
bool shower_timer; uint8_t ems_bus_id;
bool shower_alert; bool shower_timer;
uint8_t shower_alert_trigger; bool shower_alert;
uint8_t shower_alert_coldshot; uint8_t shower_alert_trigger;
bool syslog_enabled; uint8_t shower_alert_coldshot;
int8_t syslog_level; // uuid::log::Level bool syslog_enabled;
uint32_t syslog_mark_interval; int8_t syslog_level; // uuid::log::Level
String syslog_host; uint32_t syslog_mark_interval;
uint16_t syslog_port; String syslog_host;
bool trace_raw; uint16_t syslog_port;
uint8_t rx_gpio; bool trace_raw;
uint8_t tx_gpio; uint8_t rx_gpio;
uint8_t dallas_gpio; uint8_t tx_gpio;
bool dallas_parasite; uint8_t dallas_gpio;
uint8_t led_gpio; bool dallas_parasite;
bool hide_led; uint8_t led_gpio;
bool low_clock; bool hide_led;
bool telnet_enabled; bool low_clock;
bool notoken_api; bool telnet_enabled;
bool readonly_mode; bool notoken_api;
bool analog_enabled; bool readonly_mode;
uint8_t pbutton_gpio; bool analog_enabled;
uint8_t solar_maxflow; uint8_t pbutton_gpio;
String board_profile; uint8_t solar_maxflow;
uint8_t bool_format; String board_profile;
uint8_t bool_dashboard; uint8_t bool_format;
uint8_t enum_format; uint8_t bool_dashboard;
int8_t weblog_level; uint8_t enum_format;
uint8_t weblog_buffer; int8_t weblog_level;
bool weblog_compact; uint8_t weblog_buffer;
bool fahrenheit; bool weblog_compact;
bool fahrenheit;
uint8_t phy_type; uint8_t phy_type;
int8_t eth_power; // -1 means disabled int8_t eth_power; // -1 means disabled