mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
auto formatting
This commit is contained in:
132
interface/package-lock.json
generated
132
interface/package-lock.json
generated
@@ -12,10 +12,10 @@
|
||||
"@emotion/styled": "^11.10.4",
|
||||
"@msgpack/msgpack": "^2.8.0",
|
||||
"@mui/icons-material": "^5.10.6",
|
||||
"@mui/material": "^5.10.6",
|
||||
"@mui/material": "^5.10.7",
|
||||
"@table-library/react-table-library": "4.0.18",
|
||||
"@types/lodash": "^4.14.185",
|
||||
"@types/node": "^18.7.20",
|
||||
"@types/node": "^18.7.23",
|
||||
"@types/react": "^18.0.21",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
@@ -34,8 +34,8 @@
|
||||
"react-router-dom": "^6.4.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"sockette": "^2.0.6",
|
||||
"typesafe-i18n": "^5.13.0",
|
||||
"typescript": "^4.8.3"
|
||||
"typesafe-i18n": "^5.13.1",
|
||||
"typescript": "^4.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.20",
|
||||
@@ -3103,9 +3103,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mui/base": {
|
||||
"version": "5.0.0-alpha.98",
|
||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.98.tgz",
|
||||
"integrity": "sha512-c0U51+K2m57MASpRrmNs6qTXSvktDbVcSjD8zCRPbfuwYWERGGwNxwM3/jsBa4dSojTSmLPnOBFDypl74Ds6yQ==",
|
||||
"version": "5.0.0-alpha.99",
|
||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.99.tgz",
|
||||
"integrity": "sha512-D04H6O1c0Jv561yI0SVbpa8MpqpW3G43CwJxV2o6ALfI0DMJ45w07dGafmDchb6aCWTRTdggd3rjgmuzyNwPiQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@emotion/is-prop-valid": "^1.2.0",
|
||||
@@ -3135,9 +3135,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mui/core-downloads-tracker": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.6.tgz",
|
||||
"integrity": "sha512-dmyQBqrKmVU6yCSM4GGal5qNXpViXX+/V1t0GA1A5i9QF5Gx6noV/cw0hrSS2ffLT8L2oScq1oTdA6NVIiQ8lg==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.7.tgz",
|
||||
"integrity": "sha512-3N0UYVy3MbrHzM3j6f7fIUCZ+bQ1/sSZq143tLxwSssW3Z4AqE83brpr5flEY1Lx+Aowv/cPyQMmZxzRlFCGqw==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/mui"
|
||||
@@ -3169,19 +3169,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mui/material": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.6.tgz",
|
||||
"integrity": "sha512-QilW5PAAGSQdN7Cpp4rwSQ1doJAt3ca1a2PHZtr8RLVlpHnXb+qQ8CeDo9+9V2fK5CDNdtTN1F+iJKO43aFBpQ==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.7.tgz",
|
||||
"integrity": "sha512-o1jcQGii+q7ORrXhBiMmGzFDaboc1qTgOOC3zDW+NR9ryVzWzL7qEeqoORbgDB5zk9OBsXCjB91fUH/ls5xMwg==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@mui/base": "5.0.0-alpha.98",
|
||||
"@mui/core-downloads-tracker": "^5.10.6",
|
||||
"@mui/system": "^5.10.6",
|
||||
"@mui/base": "5.0.0-alpha.99",
|
||||
"@mui/core-downloads-tracker": "^5.10.7",
|
||||
"@mui/system": "^5.10.7",
|
||||
"@mui/types": "^7.2.0",
|
||||
"@mui/utils": "^5.10.6",
|
||||
"@types/react-transition-group": "^4.4.5",
|
||||
"clsx": "^1.2.1",
|
||||
"csstype": "^3.1.0",
|
||||
"csstype": "^3.1.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-is": "^18.2.0",
|
||||
"react-transition-group": "^4.4.5"
|
||||
@@ -3239,13 +3239,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mui/styled-engine": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.6.tgz",
|
||||
"integrity": "sha512-OnVw5xnO4l0XzlJFhKif/RlLenBNhyEQQlSTwB9ApSWB05UAU5ZSbjNsRfyEKvgmQ/fPa+MqPD/dzxbIRCwyeg==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.7.tgz",
|
||||
"integrity": "sha512-CCrtW+vvCKEm6pOE/QcutQ+ORC/iE6D1ghscN4l7LE2JXPvTXO/z0yu8Wxug1JEDlWm4r1Qa0PzJe1P9bjKzNA==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@emotion/cache": "^11.10.3",
|
||||
"csstype": "^3.1.0",
|
||||
"csstype": "^3.1.1",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -3270,17 +3270,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mui/system": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.6.tgz",
|
||||
"integrity": "sha512-HfQVX7e2xpQ3jtdB/WwtkFVtozMOozyN575/63u8ILHkE8wGDhblmCieAsnyJPFbm7WBW5PCMyzmfr4QyKLaYg==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.7.tgz",
|
||||
"integrity": "sha512-kwyhjjKGsgtBRFl6vSqidDZcNKU5S1juTgm4Xi2fyWxaEbIQb9Sh9y0iVP2bNCJzgDr0alLaENOZOEaDWHISAQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@mui/private-theming": "^5.10.6",
|
||||
"@mui/styled-engine": "^5.10.6",
|
||||
"@mui/styled-engine": "^5.10.7",
|
||||
"@mui/types": "^7.2.0",
|
||||
"@mui/utils": "^5.10.6",
|
||||
"clsx": "^1.2.1",
|
||||
"csstype": "^3.1.0",
|
||||
"csstype": "^3.1.1",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -4029,9 +4029,9 @@
|
||||
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.7.20",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.20.tgz",
|
||||
"integrity": "sha512-adzY4vLLr5Uivmx8+zfSJ5fbdgKxX8UMtjtl+17n0B1q1Nz8JEmE151vefMdpD+1gyh+77weN4qEhej/O7budQ=="
|
||||
"version": "18.7.23",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz",
|
||||
"integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg=="
|
||||
},
|
||||
"node_modules/@types/parse-json": {
|
||||
"version": "4.0.0",
|
||||
@@ -16420,9 +16420,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typesafe-i18n": {
|
||||
"version": "5.13.0",
|
||||
"resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.0.tgz",
|
||||
"integrity": "sha512-Q72l+LqB37kNT2R39mkTwQy1tuQ7URAahD1QXbR84itO864xvVgdoS8xaRAatp0y2/oU7f+2EzpAK3YGp0g+eA==",
|
||||
"version": "5.13.1",
|
||||
"resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.1.tgz",
|
||||
"integrity": "sha512-9Cgikxcj+2LAWQGZ8pOQAf14P+aOOcOel/G1kSAXAObA4Htj8R+qgCx9DqUnxjRfugWzM/19ZqGss7dl8Dw7Gg==",
|
||||
"bin": {
|
||||
"typesafe-i18n": "cli/typesafe-i18n.mjs"
|
||||
},
|
||||
@@ -16435,9 +16435,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
|
||||
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -19643,9 +19643,9 @@
|
||||
"integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ=="
|
||||
},
|
||||
"@mui/base": {
|
||||
"version": "5.0.0-alpha.98",
|
||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.98.tgz",
|
||||
"integrity": "sha512-c0U51+K2m57MASpRrmNs6qTXSvktDbVcSjD8zCRPbfuwYWERGGwNxwM3/jsBa4dSojTSmLPnOBFDypl74Ds6yQ==",
|
||||
"version": "5.0.0-alpha.99",
|
||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.99.tgz",
|
||||
"integrity": "sha512-D04H6O1c0Jv561yI0SVbpa8MpqpW3G43CwJxV2o6ALfI0DMJ45w07dGafmDchb6aCWTRTdggd3rjgmuzyNwPiQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@emotion/is-prop-valid": "^1.2.0",
|
||||
@@ -19658,9 +19658,9 @@
|
||||
}
|
||||
},
|
||||
"@mui/core-downloads-tracker": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.6.tgz",
|
||||
"integrity": "sha512-dmyQBqrKmVU6yCSM4GGal5qNXpViXX+/V1t0GA1A5i9QF5Gx6noV/cw0hrSS2ffLT8L2oScq1oTdA6NVIiQ8lg=="
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.7.tgz",
|
||||
"integrity": "sha512-3N0UYVy3MbrHzM3j6f7fIUCZ+bQ1/sSZq143tLxwSssW3Z4AqE83brpr5flEY1Lx+Aowv/cPyQMmZxzRlFCGqw=="
|
||||
},
|
||||
"@mui/icons-material": {
|
||||
"version": "5.10.6",
|
||||
@@ -19671,19 +19671,19 @@
|
||||
}
|
||||
},
|
||||
"@mui/material": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.6.tgz",
|
||||
"integrity": "sha512-QilW5PAAGSQdN7Cpp4rwSQ1doJAt3ca1a2PHZtr8RLVlpHnXb+qQ8CeDo9+9V2fK5CDNdtTN1F+iJKO43aFBpQ==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.7.tgz",
|
||||
"integrity": "sha512-o1jcQGii+q7ORrXhBiMmGzFDaboc1qTgOOC3zDW+NR9ryVzWzL7qEeqoORbgDB5zk9OBsXCjB91fUH/ls5xMwg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@mui/base": "5.0.0-alpha.98",
|
||||
"@mui/core-downloads-tracker": "^5.10.6",
|
||||
"@mui/system": "^5.10.6",
|
||||
"@mui/base": "5.0.0-alpha.99",
|
||||
"@mui/core-downloads-tracker": "^5.10.7",
|
||||
"@mui/system": "^5.10.7",
|
||||
"@mui/types": "^7.2.0",
|
||||
"@mui/utils": "^5.10.6",
|
||||
"@types/react-transition-group": "^4.4.5",
|
||||
"clsx": "^1.2.1",
|
||||
"csstype": "^3.1.0",
|
||||
"csstype": "^3.1.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-is": "^18.2.0",
|
||||
"react-transition-group": "^4.4.5"
|
||||
@@ -19700,28 +19700,28 @@
|
||||
}
|
||||
},
|
||||
"@mui/styled-engine": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.6.tgz",
|
||||
"integrity": "sha512-OnVw5xnO4l0XzlJFhKif/RlLenBNhyEQQlSTwB9ApSWB05UAU5ZSbjNsRfyEKvgmQ/fPa+MqPD/dzxbIRCwyeg==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.7.tgz",
|
||||
"integrity": "sha512-CCrtW+vvCKEm6pOE/QcutQ+ORC/iE6D1ghscN4l7LE2JXPvTXO/z0yu8Wxug1JEDlWm4r1Qa0PzJe1P9bjKzNA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@emotion/cache": "^11.10.3",
|
||||
"csstype": "^3.1.0",
|
||||
"csstype": "^3.1.1",
|
||||
"prop-types": "^15.8.1"
|
||||
}
|
||||
},
|
||||
"@mui/system": {
|
||||
"version": "5.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.6.tgz",
|
||||
"integrity": "sha512-HfQVX7e2xpQ3jtdB/WwtkFVtozMOozyN575/63u8ILHkE8wGDhblmCieAsnyJPFbm7WBW5PCMyzmfr4QyKLaYg==",
|
||||
"version": "5.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.7.tgz",
|
||||
"integrity": "sha512-kwyhjjKGsgtBRFl6vSqidDZcNKU5S1juTgm4Xi2fyWxaEbIQb9Sh9y0iVP2bNCJzgDr0alLaENOZOEaDWHISAQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.19.0",
|
||||
"@mui/private-theming": "^5.10.6",
|
||||
"@mui/styled-engine": "^5.10.6",
|
||||
"@mui/styled-engine": "^5.10.7",
|
||||
"@mui/types": "^7.2.0",
|
||||
"@mui/utils": "^5.10.6",
|
||||
"clsx": "^1.2.1",
|
||||
"csstype": "^3.1.0",
|
||||
"csstype": "^3.1.1",
|
||||
"prop-types": "^15.8.1"
|
||||
}
|
||||
},
|
||||
@@ -20233,9 +20233,9 @@
|
||||
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.7.20",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.20.tgz",
|
||||
"integrity": "sha512-adzY4vLLr5Uivmx8+zfSJ5fbdgKxX8UMtjtl+17n0B1q1Nz8JEmE151vefMdpD+1gyh+77weN4qEhej/O7budQ=="
|
||||
"version": "18.7.23",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz",
|
||||
"integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg=="
|
||||
},
|
||||
"@types/parse-json": {
|
||||
"version": "4.0.0",
|
||||
@@ -29096,15 +29096,15 @@
|
||||
}
|
||||
},
|
||||
"typesafe-i18n": {
|
||||
"version": "5.13.0",
|
||||
"resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.0.tgz",
|
||||
"integrity": "sha512-Q72l+LqB37kNT2R39mkTwQy1tuQ7URAahD1QXbR84itO864xvVgdoS8xaRAatp0y2/oU7f+2EzpAK3YGp0g+eA==",
|
||||
"version": "5.13.1",
|
||||
"resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.1.tgz",
|
||||
"integrity": "sha512-9Cgikxcj+2LAWQGZ8pOQAf14P+aOOcOel/G1kSAXAObA4Htj8R+qgCx9DqUnxjRfugWzM/19ZqGss7dl8Dw7Gg==",
|
||||
"requires": {}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
|
||||
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig=="
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ=="
|
||||
},
|
||||
"unbox-primitive": {
|
||||
"version": "1.0.2",
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
"@emotion/styled": "^11.10.4",
|
||||
"@msgpack/msgpack": "^2.8.0",
|
||||
"@mui/icons-material": "^5.10.6",
|
||||
"@mui/material": "^5.10.6",
|
||||
"@mui/material": "^5.10.7",
|
||||
"@table-library/react-table-library": "4.0.18",
|
||||
"@types/lodash": "^4.14.185",
|
||||
"@types/node": "^18.7.20",
|
||||
"@types/node": "^18.7.23",
|
||||
"@types/react": "^18.0.21",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
@@ -30,8 +30,8 @@
|
||||
"react-router-dom": "^6.4.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"sockette": "^2.0.6",
|
||||
"typesafe-i18n": "^5.13.0",
|
||||
"typescript": "^4.8.3"
|
||||
"typesafe-i18n": "^5.13.1",
|
||||
"typescript": "^4.8.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-app-rewired start",
|
||||
|
||||
@@ -49,9 +49,9 @@ void APSettingsService::startAP() {
|
||||
WiFi.softAPConfig(_state.localIP, _state.gatewayIP, _state.subnetMask);
|
||||
esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_AP, WIFI_BW_HT20);
|
||||
WiFi.softAP(_state.ssid.c_str(), _state.password.c_str(), _state.channel, _state.ssidHidden, _state.maxClients);
|
||||
#ifdef ARDUINO_LOLIN_C3_MINI
|
||||
#ifdef ARDUINO_LOLIN_C3_MINI
|
||||
WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi
|
||||
#endif
|
||||
#endif
|
||||
if (!_dnsServer) {
|
||||
IPAddress apIp = WiFi.softAPIP();
|
||||
emsesp::EMSESP::logger().info(F("Starting Access Point with captive portal on %s"), apIp.toString().c_str());
|
||||
|
||||
@@ -68,7 +68,6 @@ class NTPSettingsService : public StatefulService<NTPSettings> {
|
||||
void WiFiEvent(WiFiEvent_t event);
|
||||
void configureNTP();
|
||||
void configureTime(AsyncWebServerRequest * request, JsonVariant & json);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -75,9 +75,9 @@ void NetworkSettingsService::manageSTA() {
|
||||
});
|
||||
|
||||
WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network
|
||||
#ifdef ARDUINO_LOLIN_C3_MINI
|
||||
#ifdef ARDUINO_LOLIN_C3_MINI
|
||||
WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -262,32 +262,30 @@ void Shell::loop_normal() {
|
||||
} else if (esc_ == 1) { // pos1
|
||||
cursor_ = line_buffer_.length();
|
||||
} else if (esc_ == 11) { // F1
|
||||
|
||||
// TODO use flash here?
|
||||
set_command_str(("help"));
|
||||
set_command_str("help");
|
||||
} else if (esc_ == 12) { // F2
|
||||
set_command_str(("show"));
|
||||
set_command_str("show");
|
||||
} else if (esc_ == 13) { // F3
|
||||
set_command_str(("log notice"));
|
||||
set_command_str("log notice");
|
||||
} else if (esc_ == 14) { // F4
|
||||
set_command_str(("log info"));
|
||||
set_command_str("log info");
|
||||
} else if (esc_ == 15) { // F5
|
||||
set_command_str(("log debug"));
|
||||
set_command_str("log debug");
|
||||
} else if (esc_ == 17) { // F6
|
||||
set_command_str(("watch off"));
|
||||
set_command_str("watch off");
|
||||
} else if (esc_ == 18) { // F7
|
||||
set_command_str(("watch on"));
|
||||
set_command_str("watch on");
|
||||
} else if (esc_ == 19) { // F8
|
||||
set_command_str(("watch raw"));
|
||||
set_command_str("watch raw");
|
||||
} else if (esc_ == 20) { // F9
|
||||
set_command_str(("call system info"));
|
||||
set_command_str("call system info");
|
||||
} else if (esc_ == 21) { // F10
|
||||
set_command_str(("call system settings"));
|
||||
set_command_str("call system settings");
|
||||
} else if (esc_ == 23) { // F11
|
||||
line_buffer_ = (("call send \"0B \""));
|
||||
line_buffer_ = ("call send \"0B \"");
|
||||
cursor_ = 1;
|
||||
} else if (esc_ == 24) { // F12
|
||||
set_command_str(("log debug; watch raw"));
|
||||
set_command_str("log debug; watch raw");
|
||||
}
|
||||
esc_ = 0;
|
||||
} else if (c >= '0' && (c <= '9')) { // numbers
|
||||
|
||||
@@ -1344,11 +1344,7 @@ class Commands {
|
||||
* completions for this command.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
Command(unsigned int flags,
|
||||
const string_vector name,
|
||||
const string_vector arguments,
|
||||
command_function function,
|
||||
argument_completion_function arg_function);
|
||||
Command(unsigned int flags, const string_vector name, const string_vector arguments, command_function function, argument_completion_function arg_function);
|
||||
~Command();
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,20 +28,13 @@ namespace uuid {
|
||||
|
||||
namespace telnet {
|
||||
|
||||
TelnetStream::TelnetStream(WiFiClient &client)
|
||||
TelnetStream::TelnetStream(WiFiClient & client)
|
||||
: client_(client) {
|
||||
output_buffer_.reserve(BUFFER_SIZE);
|
||||
}
|
||||
|
||||
void TelnetStream::start() {
|
||||
raw_write({
|
||||
IAC, WILL, OPT_ECHO,
|
||||
IAC, WILL, OPT_BINARY,
|
||||
IAC, WILL, OPT_SGA,
|
||||
IAC, DONT, OPT_ECHO,
|
||||
IAC, DO, OPT_BINARY,
|
||||
IAC, DO, OPT_SGA
|
||||
});
|
||||
raw_write({IAC, WILL, OPT_ECHO, IAC, WILL, OPT_BINARY, IAC, WILL, OPT_SGA, IAC, DONT, OPT_ECHO, IAC, DO, OPT_BINARY, IAC, DO, OPT_SGA});
|
||||
}
|
||||
|
||||
int TelnetStream::available() {
|
||||
@@ -255,7 +248,7 @@ size_t TelnetStream::write(uint8_t data) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t TelnetStream::write(const uint8_t *buffer, size_t size) {
|
||||
size_t TelnetStream::write(const uint8_t * buffer, size_t size) {
|
||||
std::vector<unsigned char> data;
|
||||
data.reserve(size);
|
||||
|
||||
@@ -298,7 +291,7 @@ int TelnetStream::raw_read() {
|
||||
|
||||
void TelnetStream::buffer_flush() {
|
||||
if (!output_buffer_.empty()) {
|
||||
size_t len = client_.write(reinterpret_cast<const unsigned char*>(output_buffer_.data()), output_buffer_.size());
|
||||
size_t len = client_.write(reinterpret_cast<const unsigned char *>(output_buffer_.data()), output_buffer_.size());
|
||||
if (len != output_buffer_.size()) {
|
||||
client_.stop();
|
||||
}
|
||||
@@ -317,11 +310,11 @@ size_t TelnetStream::raw_write(unsigned char data) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t TelnetStream::raw_write(const std::vector<unsigned char> &data) {
|
||||
return raw_write(reinterpret_cast<const unsigned char*>(data.data()), data.size());
|
||||
size_t TelnetStream::raw_write(const std::vector<unsigned char> & data) {
|
||||
return raw_write(reinterpret_cast<const unsigned char *>(data.data()), data.size());
|
||||
}
|
||||
|
||||
size_t TelnetStream::raw_write(const uint8_t *buffer, size_t size) {
|
||||
size_t TelnetStream::raw_write(const uint8_t * buffer, size_t size) {
|
||||
size_t offset = 0;
|
||||
size_t remaining = size;
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
# include <ESP8266WiFi.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#else
|
||||
# include <WiFi.h>
|
||||
#include <WiFi.h>
|
||||
#endif
|
||||
#include <WiFiUdp.h>
|
||||
|
||||
@@ -51,15 +51,15 @@ namespace telnet {
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
class TelnetStream: public ::Stream {
|
||||
public:
|
||||
class TelnetStream : public ::Stream {
|
||||
public:
|
||||
/**
|
||||
* Create a new telnet stream wrapper.
|
||||
*
|
||||
* @param[in] client Client connection.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
explicit TelnetStream(WiFiClient &client);
|
||||
explicit TelnetStream(WiFiClient & client);
|
||||
virtual ~TelnetStream() = default;
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
* @return The number of bytes that were output.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
size_t write(const uint8_t *buffer, size_t size) override;
|
||||
size_t write(const uint8_t * buffer, size_t size) override;
|
||||
/**
|
||||
* Does nothing.
|
||||
*
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
*/
|
||||
void flush() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
static constexpr const unsigned char NUL = 0; /*!< No operation. @since 0.1.0 */
|
||||
static constexpr const unsigned char BEL = 7; /*!< Produces an audible or visible signal. @since 0.1.0 */
|
||||
static constexpr const unsigned char BS = 8; /*!< Moves the print head one character position towards the left margin. @since 0.1.0 */
|
||||
@@ -144,10 +144,13 @@ private:
|
||||
static constexpr const unsigned char EL = 248; /*!< Erase Line function. @since 0.1.0 */
|
||||
static constexpr const unsigned char GA = 249; /*!< Go Ahead signal. @since 0.1.0 */
|
||||
static constexpr const unsigned char SB = 250; /*!< Sub-negotiation of the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char WILL = 251; /*!< Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char WILL =
|
||||
251; /*!< Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char WONT = 252; /*!< Indicates the refusal to perform, or continue performing, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char DO = 253; /*!< Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char DONT = 254; /*!< Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char DO =
|
||||
253; /*!< Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char DONT =
|
||||
254; /*!< Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. @since 0.1.0 */
|
||||
static constexpr const unsigned char IAC = 255; /*!< Interpret As Command escape character. @since 0.1.0 */
|
||||
|
||||
static constexpr const unsigned char OPT_BINARY = 0; /*!< Binary (8-bit) transmission mode. (RFC 856). @since 0.1.0 */
|
||||
@@ -156,8 +159,8 @@ private:
|
||||
|
||||
static constexpr const size_t BUFFER_SIZE = 536; /*!< Output buffer size. @since 0.1.0 */
|
||||
|
||||
TelnetStream(const TelnetStream&) = delete;
|
||||
TelnetStream& operator=(const TelnetStream&) = delete;
|
||||
TelnetStream(const TelnetStream &) = delete;
|
||||
TelnetStream & operator=(const TelnetStream &) = delete;
|
||||
|
||||
/**
|
||||
* Directly check for available input.
|
||||
@@ -200,7 +203,7 @@ private:
|
||||
* @return The number of bytes that were output.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
size_t raw_write(const std::vector<unsigned char> &data);
|
||||
size_t raw_write(const std::vector<unsigned char> & data);
|
||||
/**
|
||||
* Write an array of bytes directly to the output stream.
|
||||
*
|
||||
@@ -211,9 +214,9 @@ private:
|
||||
* @return The number of bytes that were output.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
size_t raw_write(const uint8_t *buffer, size_t size);
|
||||
size_t raw_write(const uint8_t * buffer, size_t size);
|
||||
|
||||
WiFiClient &client_; /*!< Client connection. @since 0.1.0 */
|
||||
WiFiClient & client_; /*!< Client connection. @since 0.1.0 */
|
||||
unsigned char previous_raw_in_ = 0; /*!< Previous raw character that was received. Used to detect commands. @since 0.1.0 */
|
||||
bool sub_negotiation_ = false; /*!< Sub-negotiation mode. @since 0.1.0 */
|
||||
unsigned char previous_in_ = 0; /*!< Previous character that was received. Used to detect CR NUL. @since 0.1.0 */
|
||||
@@ -228,7 +231,7 @@ private:
|
||||
* @since 0.1.0
|
||||
*/
|
||||
class TelnetService {
|
||||
public:
|
||||
public:
|
||||
static constexpr size_t MAX_CONNECTIONS = 3; /*!< Maximum number of concurrent open connections. @since 0.1.0 */
|
||||
static constexpr uint16_t DEFAULT_PORT = 23; /*!< Default TCP port to listen on. @since 0.1.0 */
|
||||
static constexpr unsigned long DEFAULT_IDLE_TIMEOUT = 600; /*!< Default initial idle timeout (in seconds). @since 0.1.0 */
|
||||
@@ -242,7 +245,7 @@ public:
|
||||
* @param[in] port Remote port.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
using shell_factory_function = std::function<std::shared_ptr<uuid::console::Shell>(Stream &stream, const IPAddress &addr, uint16_t port)>;
|
||||
using shell_factory_function = std::function<std::shared_ptr<uuid::console::Shell>(Stream & stream, const IPAddress & addr, uint16_t port)>;
|
||||
|
||||
/**
|
||||
* Create a new telnet service listening on the default port.
|
||||
@@ -367,7 +370,7 @@ public:
|
||||
*/
|
||||
void loop();
|
||||
|
||||
private:
|
||||
private:
|
||||
/**
|
||||
* Telnet connection.
|
||||
*
|
||||
@@ -386,7 +389,7 @@ private:
|
||||
* @param[in] write_timeout Idle timeout in milliseconds.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
Connection(shell_factory_function &shell_factory, WiFiClient &&client, unsigned long idle_timeout, unsigned long write_timeout);
|
||||
Connection(shell_factory_function & shell_factory, WiFiClient && client, unsigned long idle_timeout, unsigned long write_timeout);
|
||||
~Connection() = default;
|
||||
|
||||
/**
|
||||
@@ -411,8 +414,8 @@ private:
|
||||
void stop();
|
||||
|
||||
private:
|
||||
Connection(const Connection&) = delete;
|
||||
Connection& operator=(const Connection&) = delete;
|
||||
Connection(const Connection &) = delete;
|
||||
Connection & operator=(const Connection &) = delete;
|
||||
|
||||
WiFiClient client_; /*!< Client connection. @since 0.1.0 */
|
||||
TelnetStream stream_; /*!< Telnet stream for the connection. @since 0.1.0 */
|
||||
@@ -421,8 +424,8 @@ private:
|
||||
uint16_t port_; /*!< Remote port of connection. @since 0.1.0 */
|
||||
};
|
||||
|
||||
TelnetService(const TelnetService&) = delete;
|
||||
TelnetService& operator=(const TelnetService&) = delete;
|
||||
TelnetService(const TelnetService &) = delete;
|
||||
TelnetService & operator=(const TelnetService &) = delete;
|
||||
|
||||
static uuid::log::Logger logger_; /*!< uuid::log::Logger instance for telnet services. @since 0.1.0 */
|
||||
|
||||
|
||||
@@ -15,29 +15,33 @@ template <class T>
|
||||
class HttpGetEndpoint {
|
||||
public:
|
||||
HttpGetEndpoint(JsonStateReader<T> stateReader,
|
||||
StatefulService<T>* statefulService,
|
||||
AsyncWebServer* server,
|
||||
const String& servicePath,
|
||||
SecurityManager* securityManager,
|
||||
StatefulService<T> * statefulService,
|
||||
AsyncWebServer * server,
|
||||
const String & servicePath,
|
||||
SecurityManager * securityManager,
|
||||
AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE) :
|
||||
_stateReader(stateReader), _statefulService(statefulService), _bufferSize(bufferSize) {
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE)
|
||||
: _stateReader(stateReader)
|
||||
, _statefulService(statefulService)
|
||||
, _bufferSize(bufferSize) {
|
||||
}
|
||||
|
||||
HttpGetEndpoint(JsonStateReader<T> stateReader,
|
||||
StatefulService<T>* statefulService,
|
||||
AsyncWebServer* server,
|
||||
const String& servicePath,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE) :
|
||||
_stateReader(stateReader), _statefulService(statefulService), _bufferSize(bufferSize) {
|
||||
StatefulService<T> * statefulService,
|
||||
AsyncWebServer * server,
|
||||
const String & servicePath,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE)
|
||||
: _stateReader(stateReader)
|
||||
, _statefulService(statefulService)
|
||||
, _bufferSize(bufferSize) {
|
||||
}
|
||||
|
||||
protected:
|
||||
JsonStateReader<T> _stateReader;
|
||||
StatefulService<T>* _statefulService;
|
||||
StatefulService<T> * _statefulService;
|
||||
size_t _bufferSize;
|
||||
|
||||
void fetchSettings(AsyncWebServerRequest* request) {
|
||||
void fetchSettings(AsyncWebServerRequest * request) {
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,37 +50,37 @@ class HttpPostEndpoint {
|
||||
public:
|
||||
HttpPostEndpoint(JsonStateReader<T> stateReader,
|
||||
JsonStateUpdater<T> stateUpdater,
|
||||
StatefulService<T>* statefulService,
|
||||
AsyncWebServer* server,
|
||||
const String& servicePath,
|
||||
SecurityManager* securityManager,
|
||||
StatefulService<T> * statefulService,
|
||||
AsyncWebServer * server,
|
||||
const String & servicePath,
|
||||
SecurityManager * securityManager,
|
||||
AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE) :
|
||||
_stateReader(stateReader),
|
||||
_stateUpdater(stateUpdater),
|
||||
_statefulService(statefulService),
|
||||
_bufferSize(bufferSize) {
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE)
|
||||
: _stateReader(stateReader)
|
||||
, _stateUpdater(stateUpdater)
|
||||
, _statefulService(statefulService)
|
||||
, _bufferSize(bufferSize) {
|
||||
}
|
||||
|
||||
HttpPostEndpoint(JsonStateReader<T> stateReader,
|
||||
JsonStateUpdater<T> stateUpdater,
|
||||
StatefulService<T>* statefulService,
|
||||
AsyncWebServer* server,
|
||||
const String& servicePath,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE) :
|
||||
_stateReader(stateReader),
|
||||
_stateUpdater(stateUpdater),
|
||||
_statefulService(statefulService),
|
||||
_bufferSize(bufferSize) {
|
||||
StatefulService<T> * statefulService,
|
||||
AsyncWebServer * server,
|
||||
const String & servicePath,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE)
|
||||
: _stateReader(stateReader)
|
||||
, _stateUpdater(stateUpdater)
|
||||
, _statefulService(statefulService)
|
||||
, _bufferSize(bufferSize) {
|
||||
}
|
||||
|
||||
protected:
|
||||
JsonStateReader<T> _stateReader;
|
||||
JsonStateUpdater<T> _stateUpdater;
|
||||
StatefulService<T>* _statefulService;
|
||||
StatefulService<T> * _statefulService;
|
||||
size_t _bufferSize;
|
||||
|
||||
void updateSettings(AsyncWebServerRequest* request, JsonVariant& json) {
|
||||
void updateSettings(AsyncWebServerRequest * request, JsonVariant & json) {
|
||||
if (!json.is<JsonObject>()) {
|
||||
return;
|
||||
}
|
||||
@@ -95,37 +99,24 @@ class HttpEndpoint : public HttpGetEndpoint<T>, public HttpPostEndpoint<T> {
|
||||
public:
|
||||
HttpEndpoint(JsonStateReader<T> stateReader,
|
||||
JsonStateUpdater<T> stateUpdater,
|
||||
StatefulService<T>* statefulService,
|
||||
AsyncWebServer* server,
|
||||
const String& servicePath,
|
||||
SecurityManager* securityManager,
|
||||
StatefulService<T> * statefulService,
|
||||
AsyncWebServer * server,
|
||||
const String & servicePath,
|
||||
SecurityManager * securityManager,
|
||||
AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE) :
|
||||
HttpGetEndpoint<T>(stateReader,
|
||||
statefulService,
|
||||
server,
|
||||
servicePath,
|
||||
securityManager,
|
||||
authenticationPredicate,
|
||||
bufferSize),
|
||||
HttpPostEndpoint<T>(stateReader,
|
||||
stateUpdater,
|
||||
statefulService,
|
||||
server,
|
||||
servicePath,
|
||||
securityManager,
|
||||
authenticationPredicate,
|
||||
bufferSize) {
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE)
|
||||
: HttpGetEndpoint<T>(stateReader, statefulService, server, servicePath, securityManager, authenticationPredicate, bufferSize)
|
||||
, HttpPostEndpoint<T>(stateReader, stateUpdater, statefulService, server, servicePath, securityManager, authenticationPredicate, bufferSize) {
|
||||
}
|
||||
|
||||
HttpEndpoint(JsonStateReader<T> stateReader,
|
||||
JsonStateUpdater<T> stateUpdater,
|
||||
StatefulService<T>* statefulService,
|
||||
AsyncWebServer* server,
|
||||
const String& servicePath,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE) :
|
||||
HttpGetEndpoint<T>(stateReader, statefulService, server, servicePath, bufferSize),
|
||||
HttpPostEndpoint<T>(stateReader, stateUpdater, statefulService, server, servicePath, bufferSize) {
|
||||
StatefulService<T> * statefulService,
|
||||
AsyncWebServer * server,
|
||||
const String & servicePath,
|
||||
size_t bufferSize = DEFAULT_BUFFER_SIZE)
|
||||
: HttpGetEndpoint<T>(stateReader, statefulService, server, servicePath, bufferSize)
|
||||
, HttpPostEndpoint<T>(stateReader, stateUpdater, statefulService, server, servicePath, bufferSize) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ typedef struct {
|
||||
uint8_t ssid_len; /**< SSID length of connected AP */
|
||||
uint8_t bssid[6]; /**< BSSID of connected AP*/
|
||||
uint8_t channel; /**< channel of connected AP*/
|
||||
wifi_auth_mode_t authmode;/**< authentication mode used by AP*/
|
||||
wifi_auth_mode_t authmode; /**< authentication mode used by AP*/
|
||||
} wifi_event_sta_connected_t;
|
||||
|
||||
/** Argument structure for WIFI_EVENT_STA_DISCONNECTED event */
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#include "../../src/emsesp_stub.h" // proddy added
|
||||
|
||||
SecuritySettingsService::SecuritySettingsService(AsyncWebServer* server, FS* fs) :
|
||||
_httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this),
|
||||
_fsPersistence(SecuritySettings::read, SecuritySettings::update, this, fs, SECURITY_SETTINGS_FILE),
|
||||
_jwtHandler(FACTORY_JWT_SECRET) {
|
||||
addUpdateHandler([&](const String& originId) { configureJWTHandler(); }, false);
|
||||
SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs)
|
||||
: _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this)
|
||||
, _fsPersistence(SecuritySettings::read, SecuritySettings::update, this, fs, SECURITY_SETTINGS_FILE)
|
||||
, _jwtHandler(FACTORY_JWT_SECRET) {
|
||||
addUpdateHandler([&](const String & originId) { configureJWTHandler(); }, false);
|
||||
}
|
||||
|
||||
void SecuritySettingsService::begin() {
|
||||
@@ -16,8 +16,8 @@ void SecuritySettingsService::begin() {
|
||||
configureJWTHandler();
|
||||
}
|
||||
|
||||
Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest* request) {
|
||||
AsyncWebHeader* authorizationHeader = request->getHeader(AUTHORIZATION_HEADER);
|
||||
Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest * request) {
|
||||
AsyncWebHeader * authorizationHeader = request->getHeader(AUTHORIZATION_HEADER);
|
||||
if (authorizationHeader) {
|
||||
String value = authorizationHeader->value();
|
||||
if (value.startsWith(AUTHORIZATION_HEADER_PREFIX)) {
|
||||
@@ -25,7 +25,7 @@ Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerReques
|
||||
return authenticateJWT(value);
|
||||
}
|
||||
} else if (request->hasParam(ACCESS_TOKEN_PARAMATER)) {
|
||||
AsyncWebParameter* tokenParamater = request->getParam(ACCESS_TOKEN_PARAMATER);
|
||||
AsyncWebParameter * tokenParamater = request->getParam(ACCESS_TOKEN_PARAMATER);
|
||||
String value = tokenParamater->value();
|
||||
return authenticateJWT(value);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ void SecuritySettingsService::configureJWTHandler() {
|
||||
_jwtHandler.setSecret(_state.jwtSecret);
|
||||
}
|
||||
|
||||
Authentication SecuritySettingsService::authenticateJWT(String& jwt) {
|
||||
Authentication SecuritySettingsService::authenticateJWT(String & jwt) {
|
||||
DynamicJsonDocument payloadDocument(MAX_JWT_SIZE);
|
||||
_jwtHandler.parseJWT(jwt, payloadDocument);
|
||||
if (payloadDocument.is<JsonObject>()) {
|
||||
@@ -51,7 +51,7 @@ Authentication SecuritySettingsService::authenticateJWT(String& jwt) {
|
||||
return Authentication();
|
||||
}
|
||||
|
||||
Authentication SecuritySettingsService::authenticate(const String& username, const String& password) {
|
||||
Authentication SecuritySettingsService::authenticate(const String & username, const String & password) {
|
||||
for (User _user : _state.users) {
|
||||
if (_user.username == username && _user.password == password) {
|
||||
return Authentication(_user);
|
||||
@@ -60,19 +60,19 @@ Authentication SecuritySettingsService::authenticate(const String& username, con
|
||||
return Authentication();
|
||||
}
|
||||
|
||||
inline void populateJWTPayload(JsonObject& payload, User* user) {
|
||||
inline void populateJWTPayload(JsonObject & payload, User * user) {
|
||||
payload["username"] = user->username;
|
||||
payload["admin"] = user->admin;
|
||||
}
|
||||
|
||||
boolean SecuritySettingsService::validatePayload(JsonObject& parsedPayload, User* user) {
|
||||
boolean SecuritySettingsService::validatePayload(JsonObject & parsedPayload, User * user) {
|
||||
DynamicJsonDocument jsonDocument(MAX_JWT_SIZE);
|
||||
JsonObject payload = jsonDocument.to<JsonObject>();
|
||||
populateJWTPayload(payload, user);
|
||||
return payload == parsedPayload;
|
||||
}
|
||||
|
||||
String SecuritySettingsService::generateJWT(User* user) {
|
||||
String SecuritySettingsService::generateJWT(User * user) {
|
||||
DynamicJsonDocument jsonDocument(MAX_JWT_SIZE);
|
||||
JsonObject payload = jsonDocument.to<JsonObject>();
|
||||
populateJWTPayload(payload, user);
|
||||
@@ -80,15 +80,14 @@ String SecuritySettingsService::generateJWT(User* user) {
|
||||
}
|
||||
|
||||
ArRequestFilterFunction SecuritySettingsService::filterRequest(AuthenticationPredicate predicate) {
|
||||
return [this, predicate](AsyncWebServerRequest* request) {
|
||||
return [this, predicate](AsyncWebServerRequest * request) {
|
||||
Authentication authentication = authenticateRequest(request);
|
||||
return predicate(authentication);
|
||||
};
|
||||
}
|
||||
|
||||
ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest,
|
||||
AuthenticationPredicate predicate) {
|
||||
return [this, onRequest, predicate](AsyncWebServerRequest* request) {
|
||||
ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest, AuthenticationPredicate predicate) {
|
||||
return [this, onRequest, predicate](AsyncWebServerRequest * request) {
|
||||
Authentication authentication = authenticateRequest(request);
|
||||
if (!predicate(authentication)) {
|
||||
request->send(401);
|
||||
@@ -98,9 +97,8 @@ ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFu
|
||||
};
|
||||
}
|
||||
|
||||
ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest,
|
||||
AuthenticationPredicate predicate) {
|
||||
return [this, onRequest, predicate](AsyncWebServerRequest* request, JsonVariant& json) {
|
||||
ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest, AuthenticationPredicate predicate) {
|
||||
return [this, onRequest, predicate](AsyncWebServerRequest * request, JsonVariant & json) {
|
||||
Authentication authentication = authenticateRequest(request);
|
||||
if (!predicate(authentication)) {
|
||||
request->send(401);
|
||||
@@ -114,28 +112,27 @@ ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequest
|
||||
|
||||
User ADMIN_USER = User(FACTORY_ADMIN_USERNAME, FACTORY_ADMIN_PASSWORD, true);
|
||||
|
||||
SecuritySettingsService::SecuritySettingsService(AsyncWebServer* server, FS* fs) : SecurityManager() {
|
||||
SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs)
|
||||
: SecurityManager() {
|
||||
}
|
||||
SecuritySettingsService::~SecuritySettingsService() {
|
||||
}
|
||||
|
||||
ArRequestFilterFunction SecuritySettingsService::filterRequest(AuthenticationPredicate predicate) {
|
||||
return [this, predicate](AsyncWebServerRequest* request) { return true; };
|
||||
return [this, predicate](AsyncWebServerRequest * request) { return true; };
|
||||
}
|
||||
|
||||
// Return the admin user on all request - disabling security features
|
||||
Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest* request) {
|
||||
Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest * request) {
|
||||
return Authentication(ADMIN_USER);
|
||||
}
|
||||
|
||||
// Return the function unwrapped
|
||||
ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest,
|
||||
AuthenticationPredicate predicate) {
|
||||
ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest, AuthenticationPredicate predicate) {
|
||||
return onRequest;
|
||||
}
|
||||
|
||||
ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest,
|
||||
AuthenticationPredicate predicate) {
|
||||
ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest, AuthenticationPredicate predicate) {
|
||||
return onRequest;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void AnalogSensor::start() {
|
||||
analogSetAttenuation(ADC_2_5db); // for all channels 1.5V
|
||||
|
||||
|
||||
LOG_INFO(("Starting Analog sensor service"));
|
||||
LOG_INFO("Starting Analog sensor service");
|
||||
|
||||
// Add API call for /info
|
||||
Command::add(
|
||||
|
||||
@@ -376,7 +376,7 @@ bool Command::list(const uint8_t device_type, JsonObject & output) {
|
||||
// output list of all commands to console for a specific DeviceType
|
||||
void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbose) {
|
||||
if (cmdfunctions_.empty()) {
|
||||
shell.println(("No commands available"));
|
||||
shell.println("No commands available");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ void EMSESPShell::stopped() {
|
||||
// this is one of the first functions called when the shell is started
|
||||
void EMSESPShell::display_banner() {
|
||||
println();
|
||||
printfln(("┌──────────────────────────────────────┐"));
|
||||
printfln("┌──────────────────────────────────────┐");
|
||||
printfln(("│ %sEMS-ESP version %-10s%s │"), COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF);
|
||||
printfln(("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │"), COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET);
|
||||
printfln(("│ │"));
|
||||
printfln("│ │");
|
||||
printfln(("│ type %shelp%s to show available commands │"), COLOR_UNDERLINE, COLOR_RESET);
|
||||
printfln(("└──────────────────────────────────────┘"));
|
||||
printfln("└──────────────────────────────────────┘");
|
||||
println();
|
||||
|
||||
// set console name
|
||||
@@ -151,16 +151,16 @@ void EMSESPShell::add_console_commands() {
|
||||
},
|
||||
"local");
|
||||
} else {
|
||||
shell.println(("Must be 0B, 0D, 0A, 0F or 12"));
|
||||
shell.println("Must be 0B, 0D, 0A, 0F or 12");
|
||||
}
|
||||
},
|
||||
[](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments __attribute__((unused))) -> const std::vector<std::string> {
|
||||
return std::vector<std::string>{
|
||||
(("0B")),
|
||||
(("0D")),
|
||||
(("0A")),
|
||||
(("0F")),
|
||||
(("12")),
|
||||
("0B"),
|
||||
("0D"),
|
||||
("0A"),
|
||||
("0F"),
|
||||
("12"),
|
||||
|
||||
};
|
||||
});
|
||||
@@ -189,7 +189,7 @@ void EMSESPShell::add_console_commands() {
|
||||
if (arguments.size() == 0) {
|
||||
EMSESP::scan_devices();
|
||||
} else {
|
||||
shell.printfln(("Performing a deep scan..."));
|
||||
shell.printfln("Performing a deep scan...");
|
||||
EMSESP::clear_all_devices();
|
||||
std::vector<uint8_t> Device_Ids;
|
||||
|
||||
@@ -240,7 +240,7 @@ void EMSESPShell::add_console_commands() {
|
||||
uint8_t device_id = Helpers::hextoint(arguments.front().c_str());
|
||||
|
||||
if (!EMSESP::valid_device(device_id)) {
|
||||
shell.printfln(("Invalid deviceID"));
|
||||
shell.printfln("Invalid deviceID");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -305,28 +305,28 @@ void EMSESPShell::add_console_commands() {
|
||||
|
||||
EMSESP::watch_id(watch_id);
|
||||
} else {
|
||||
shell.printfln(("Invalid: use watch raw|on|off|unknown|id [id]"));
|
||||
shell.printfln("Invalid: use watch raw|on|off|unknown|id [id]");
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t watch = EMSESP::watch();
|
||||
if (watch == EMSESP::WATCH_OFF) {
|
||||
shell.printfln(("Watching telegrams is off"));
|
||||
shell.printfln("Watching telegrams is off");
|
||||
return;
|
||||
}
|
||||
|
||||
// if logging is off, the watch won't show anything, show force it back to NOTICE
|
||||
if (shell.log_level() < Level::NOTICE) {
|
||||
shell.log_level(Level::NOTICE);
|
||||
shell.printfln(("Setting log level to Notice"));
|
||||
shell.printfln("Setting log level to Notice");
|
||||
}
|
||||
|
||||
if (watch == EMSESP::WATCH_ON) {
|
||||
shell.printfln(("Watching incoming telegrams, displayed in decoded format"));
|
||||
shell.printfln("Watching incoming telegrams, displayed in decoded format");
|
||||
} else if (watch == EMSESP::WATCH_RAW) {
|
||||
shell.printfln(("Watching incoming telegrams, displayed as raw bytes")); // WATCH_RAW
|
||||
shell.printfln("Watching incoming telegrams, displayed as raw bytes"); // WATCH_RAW
|
||||
} else {
|
||||
shell.printfln(("Watching unknown telegrams")); // WATCH_UNKNOWN
|
||||
shell.printfln("Watching unknown telegrams"); // WATCH_UNKNOWN
|
||||
}
|
||||
|
||||
watch_id = EMSESP::watch_id();
|
||||
@@ -351,7 +351,7 @@ void EMSESPShell::add_console_commands() {
|
||||
// validate the device_type
|
||||
uint8_t device_type = EMSdevice::device_name_2_device_type(arguments[0].c_str());
|
||||
if (!Command::device_has_commands(device_type)) {
|
||||
shell.print(("Invalid device. Available devices are: "));
|
||||
shell.print("Invalid device. Available devices are: ");
|
||||
Command::show_devices(shell);
|
||||
return;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void EMSESPShell::add_console_commands() {
|
||||
|
||||
// validate that a command is present
|
||||
if (arguments.size() < 2) {
|
||||
shell.print(("Missing command. Available commands are: "));
|
||||
shell.print("Missing command. Available commands are: ");
|
||||
Command::show(shell, device_type, false); // non-verbose mode
|
||||
return;
|
||||
}
|
||||
@@ -399,8 +399,8 @@ void EMSESPShell::add_console_commands() {
|
||||
}
|
||||
|
||||
if (return_code == CommandRet::NOT_FOUND) {
|
||||
shell.println(("Unknown command"));
|
||||
shell.print(("Available commands are: "));
|
||||
shell.println("Unknown command");
|
||||
shell.print("Available commands are: ");
|
||||
Command::show(shell, device_type, false); // non-verbose mode
|
||||
} else if (return_code != CommandRet::OK) {
|
||||
shell.printfln(("Bad syntax (error code %d)"), return_code);
|
||||
@@ -494,7 +494,7 @@ void Console::load_standard_commands(unsigned int context) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
shell.print(("levels: "));
|
||||
shell.print("levels: ");
|
||||
std::vector<std::string> v = uuid::log::levels_lowercase();
|
||||
size_t i = v.size();
|
||||
while (i--) {
|
||||
@@ -543,7 +543,7 @@ void Console::load_standard_commands(unsigned int context) {
|
||||
} else {
|
||||
shell.delay_until(now + INVALID_PASSWORD_DELAY_MS, [](Shell & shell) {
|
||||
shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, ("Invalid su password on console"));
|
||||
shell.println(("su: incorrect password"));
|
||||
shell.println("su: incorrect password");
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -579,7 +579,7 @@ void Console::load_system_commands(unsigned int context) {
|
||||
if (securitySettings.jwtSecret.equals(password.c_str())) {
|
||||
EMSESP::system_.format(shell);
|
||||
} else {
|
||||
shell.println(("incorrect password"));
|
||||
shell.println("incorrect password");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -602,9 +602,9 @@ void Console::load_system_commands(unsigned int context) {
|
||||
return StateUpdateResult::CHANGED;
|
||||
},
|
||||
"local");
|
||||
shell.println(("su password updated"));
|
||||
shell.println("su password updated");
|
||||
} else {
|
||||
shell.println(("Passwords do not match"));
|
||||
shell.println("Passwords do not match");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -675,7 +675,7 @@ void Console::load_system_commands(unsigned int context) {
|
||||
});
|
||||
shell.println("Use `wifi reconnect` to save and apply the new settings");
|
||||
} else {
|
||||
shell.println(("Passwords do not match"));
|
||||
shell.println("Passwords do not match");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -737,7 +737,7 @@ EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, bool local)
|
||||
: uuid::console::Shell(commands, ShellContext::MAIN, local ? (CommandFlags::USER | CommandFlags::LOCAL) : CommandFlags::USER)
|
||||
, uuid::console::StreamConsole(stream)
|
||||
, EMSESPShell()
|
||||
, name_((("Serial")))
|
||||
, name_(("Serial"))
|
||||
, pty_(SIZE_MAX)
|
||||
, addr_()
|
||||
, port_(0) {
|
||||
|
||||
@@ -42,7 +42,7 @@ void DallasSensor::start() {
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
bus_.begin(dallas_gpio_);
|
||||
LOG_INFO(("Starting Dallas sensor service"));
|
||||
LOG_INFO("Starting Dallas sensor service");
|
||||
#endif
|
||||
|
||||
// Add API calls
|
||||
@@ -84,7 +84,7 @@ void DallasSensor::loop() {
|
||||
if (state_ == State::IDLE) {
|
||||
if (time_now - last_activity_ >= READ_INTERVAL_MS) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_DEBUG(("[DEBUG] Read sensor temperature"));
|
||||
LOG_DEBUG("[DEBUG] Read sensor temperature");
|
||||
#endif
|
||||
if (bus_.reset() || parasite_) {
|
||||
YIELD;
|
||||
@@ -99,7 +99,7 @@ void DallasSensor::loop() {
|
||||
if (++scanretry_ > SCAN_MAX) { // every 30 sec
|
||||
scanretry_ = 0;
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_ERROR(("Bus reset failed"));
|
||||
LOG_ERROR("Bus reset failed");
|
||||
#endif
|
||||
for (auto & sensor : sensors_) {
|
||||
sensor.temperature_c = EMS_VALUE_SHORT_NOTSET;
|
||||
@@ -112,13 +112,13 @@ void DallasSensor::loop() {
|
||||
} else if (state_ == State::READING) {
|
||||
if (temperature_convert_complete() && (time_now - last_activity_ > CONVERSION_MS)) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_DEBUG(("Scanning for sensors"));
|
||||
LOG_DEBUG("Scanning for sensors");
|
||||
#endif
|
||||
bus_.reset_search();
|
||||
state_ = State::SCANNING;
|
||||
} else if (time_now - last_activity_ > READ_TIMEOUT_MS) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_WARNING(("Dallas sensor read timeout"));
|
||||
LOG_WARNING("Dallas sensor read timeout");
|
||||
#endif
|
||||
state_ = State::IDLE;
|
||||
sensorfails_++;
|
||||
@@ -126,7 +126,7 @@ void DallasSensor::loop() {
|
||||
} else if (state_ == State::SCANNING) {
|
||||
if (time_now - last_activity_ > SCAN_TIMEOUT_MS) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_ERROR(("Dallas sensor scan timeout"));
|
||||
LOG_ERROR("Dallas sensor scan timeout");
|
||||
#endif
|
||||
state_ = State::IDLE;
|
||||
sensorfails_++;
|
||||
|
||||
@@ -2083,9 +2083,9 @@ bool Boiler::set_ww_circulation_mode(const char * value, const int8_t id) {
|
||||
if (v < 7) {
|
||||
// LOG_INFO(("Setting dhw circulation mode %dx3min"), v);
|
||||
} else if (v == 7) {
|
||||
// LOG_INFO(("Setting dhw circulation mode continuous"));
|
||||
// LOG_INFO("Setting dhw circulation mode continuous");
|
||||
} else {
|
||||
// LOG_WARNING(("Set dhw circulation mode: Invalid value"));
|
||||
// LOG_WARNING("Set dhw circulation mode: Invalid value");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2109,12 +2109,12 @@ bool Boiler::set_reset(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
if (num == 1) {
|
||||
// LOG_INFO(("Reset boiler maintenance message"));
|
||||
// LOG_INFO("Reset boiler maintenance message");
|
||||
write_command(0x05, 0x08, 0xFF, 0x1C);
|
||||
has_update(&reset_);
|
||||
return true;
|
||||
} else if (num == 2) {
|
||||
// LOG_INFO(("Reset boiler error message"));
|
||||
// LOG_INFO("Reset boiler error message");
|
||||
write_command(0x05, 0x00, 0x5A); // error reset
|
||||
has_update(&reset_);
|
||||
return true;
|
||||
@@ -2131,7 +2131,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) {
|
||||
std::string s;
|
||||
if (Helpers::value2string(value, s)) {
|
||||
if (s == Helpers::translated_word(FL_(reset))) {
|
||||
// LOG_INFO(("Reset boiler maintenance message"));
|
||||
// LOG_INFO("Reset boiler maintenance message");
|
||||
write_command(0x05, 0x08, 0xFF, 0x1C);
|
||||
return true;
|
||||
}
|
||||
@@ -2169,7 +2169,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_WARNING(("Setting maintenance: wrong format"));
|
||||
LOG_WARNING("Setting maintenance: wrong format");
|
||||
return false;
|
||||
}
|
||||
//maintenance
|
||||
@@ -2183,7 +2183,7 @@ bool Boiler::set_maintenancetime(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LOG_WARNING(("Setting maintenance: wrong format"));
|
||||
LOG_WARNING("Setting maintenance: wrong format");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2204,7 +2204,7 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_WARNING(("Setting maintenance: wrong format"));
|
||||
LOG_WARNING("Setting maintenance: wrong format");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1369,7 +1369,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
double difference = difftime(now, ttime);
|
||||
if (difference > 15 || difference < -15) {
|
||||
set_datetime("ntp", -1); // set from NTP
|
||||
LOG_INFO(("thermostat time correction from ntp"));
|
||||
LOG_INFO("thermostat time correction from ntp");
|
||||
}
|
||||
}
|
||||
#ifndef EMSESP_STANDALONE
|
||||
@@ -1380,7 +1380,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
}
|
||||
struct timeval newnow = {.tv_sec = ttime};
|
||||
settimeofday(&newnow, nullptr);
|
||||
LOG_INFO(("ems-esp time set from thermostat"));
|
||||
LOG_INFO("ems-esp time set from thermostat");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2132,7 +2132,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
if (!EMSESP::system_.ntp_connected()) {
|
||||
LOG_WARNING(("Set date: no valid NTP data, setting from ESP Clock"));
|
||||
LOG_WARNING("Set date: no valid NTP data, setting from ESP Clock");
|
||||
}
|
||||
|
||||
data[0] = tm_->tm_year - 100; // Bosch counts from 2000
|
||||
@@ -2153,7 +2153,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
||||
data[6] = (dt[20] - '0'); // day of week, Mo:0
|
||||
data[7] = (dt[22] - '0') + 2; // DST and flag
|
||||
} else {
|
||||
LOG_WARNING(("Set date: invalid data, wrong length"));
|
||||
LOG_WARNING("Set date: invalid data, wrong length");
|
||||
return false;
|
||||
}
|
||||
if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) {
|
||||
|
||||
@@ -62,19 +62,19 @@ std::string EMSdevice::uom_to_string(uint8_t uom) {
|
||||
std::string EMSdevice::brand_to_string() const {
|
||||
switch (brand_) {
|
||||
case EMSdevice::Brand::BOSCH:
|
||||
return (("Bosch"));
|
||||
return ("Bosch");
|
||||
case EMSdevice::Brand::JUNKERS:
|
||||
return (("Junkers"));
|
||||
return ("Junkers");
|
||||
case EMSdevice::Brand::BUDERUS:
|
||||
return (("Buderus"));
|
||||
return ("Buderus");
|
||||
case EMSdevice::Brand::NEFIT:
|
||||
return (("Nefit"));
|
||||
return ("Nefit");
|
||||
case EMSdevice::Brand::SIEGER:
|
||||
return (("Sieger"));
|
||||
return ("Sieger");
|
||||
case EMSdevice::Brand::WORCESTER:
|
||||
return (("Worcester"));
|
||||
return ("Worcester");
|
||||
case EMSdevice::Brand::IVT:
|
||||
return (("IVT"));
|
||||
return ("IVT");
|
||||
default:
|
||||
return ((""));
|
||||
}
|
||||
@@ -302,28 +302,28 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const {
|
||||
}
|
||||
shell.printf(COLOR_RESET);
|
||||
*/
|
||||
shell.printf((" Received telegram type IDs: "));
|
||||
shell.printf(" Received telegram type IDs: ");
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
if (tf.received_ && !tf.fetch_) {
|
||||
shell.printf(("0x%02X "), tf.telegram_type_id_);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
shell.printf((" Fetched telegram type IDs: "));
|
||||
shell.printf(" Fetched telegram type IDs: ");
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
if (tf.fetch_) {
|
||||
shell.printf(("0x%02X "), tf.telegram_type_id_);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
shell.printf((" Pending telegram type IDs: "));
|
||||
shell.printf(" Pending telegram type IDs: ");
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
if (!tf.received_ && !tf.fetch_) {
|
||||
shell.printf(("0x%02X "), tf.telegram_type_id_);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
shell.printf((" Ignored telegram type IDs: "));
|
||||
shell.printf(" Ignored telegram type IDs: ");
|
||||
for (auto handlers : handlers_ignored_) {
|
||||
shell.printf(("0x%02X "), handlers);
|
||||
}
|
||||
@@ -1467,9 +1467,9 @@ bool EMSdevice::has_telegram_id(uint16_t id) const {
|
||||
std::string EMSdevice::telegram_type_name(std::shared_ptr<const Telegram> telegram) const {
|
||||
// see if it's one of the common ones, like Version
|
||||
if (telegram->type_id == EMS_TYPE_VERSION) {
|
||||
return (("Version"));
|
||||
return ("Version");
|
||||
} else if (telegram->type_id == EMS_TYPE_UBADevices) {
|
||||
return (("UBADevices"));
|
||||
return ("UBADevices");
|
||||
}
|
||||
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
|
||||
@@ -190,7 +190,7 @@ void EMSESP::uart_init() {
|
||||
if (System::is_valid_gpio(rx_gpio) && System::is_valid_gpio(tx_gpio)) {
|
||||
EMSuart::start(tx_mode, rx_gpio, tx_gpio); // start UART
|
||||
} else {
|
||||
LOG_WARNING(("Invalid UART Rx/Tx GPIOs. Check config."));
|
||||
LOG_WARNING("Invalid UART Rx/Tx GPIOs. Check config.");
|
||||
}
|
||||
|
||||
txservice_.start(); // sends out request to EMS bus for all devices
|
||||
@@ -234,20 +234,20 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// EMS bus information
|
||||
switch (bus_status()) {
|
||||
case BUS_STATUS_OFFLINE:
|
||||
shell.printfln(("EMS Bus is disconnected."));
|
||||
shell.printfln("EMS Bus is disconnected.");
|
||||
break;
|
||||
case BUS_STATUS_TX_ERRORS:
|
||||
shell.printfln(("EMS Bus is connected, but Tx is not stable."));
|
||||
shell.printfln("EMS Bus is connected, but Tx is not stable.");
|
||||
break;
|
||||
default:
|
||||
shell.printfln(("EMS Bus is connected."));
|
||||
shell.printfln("EMS Bus is connected.");
|
||||
break;
|
||||
}
|
||||
|
||||
shell.println();
|
||||
|
||||
if (bus_status() != BUS_STATUS_OFFLINE) {
|
||||
shell.printfln(("EMS Bus info:"));
|
||||
shell.printfln("EMS Bus info:");
|
||||
EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln((" Tx mode: %d"), settings.tx_mode); });
|
||||
shell.printfln((" Bus protocol: %s"), EMSbus::is_ht3() ? ("HT3") : ("Buderus"));
|
||||
shell.printfln((" #recognized EMS devices: %d"), EMSESP::emsdevices.size());
|
||||
@@ -265,7 +265,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// Rx queue
|
||||
auto rx_telegrams = rxservice_.queue();
|
||||
if (rx_telegrams.empty()) {
|
||||
shell.printfln(("Rx Queue is empty"));
|
||||
shell.printfln("Rx Queue is empty");
|
||||
} else {
|
||||
shell.printfln(("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s");
|
||||
for (const auto & it : rx_telegrams) {
|
||||
@@ -278,7 +278,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// Tx queue
|
||||
auto tx_telegrams = txservice_.queue();
|
||||
if (tx_telegrams.empty()) {
|
||||
shell.printfln(("Tx Queue is empty"));
|
||||
shell.printfln("Tx Queue is empty");
|
||||
} else {
|
||||
shell.printfln(("Tx Queue (%ld telegram%s):"), tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s");
|
||||
|
||||
@@ -301,7 +301,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// show EMS device values to the shell console
|
||||
void EMSESP::show_device_values(uuid::console::Shell & shell) {
|
||||
if (emsdevices.empty()) {
|
||||
shell.printfln(("No EMS devices detected."));
|
||||
shell.printfln("No EMS devices detected.");
|
||||
shell.println();
|
||||
return;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) {
|
||||
// show Dallas temperature sensors and Analog sensors
|
||||
void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
if (dallassensor_.have_sensors()) {
|
||||
shell.printfln(("Temperature sensors:"));
|
||||
shell.printfln("Temperature sensors:");
|
||||
char s[10];
|
||||
char s2[10];
|
||||
uint8_t fahrenheit = EMSESP::system_.fahrenheit() ? 2 : 0;
|
||||
@@ -384,7 +384,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
if (analogsensor_.have_sensors()) {
|
||||
char s[10];
|
||||
char s2[10];
|
||||
shell.printfln(("Analog sensors:"));
|
||||
shell.printfln("Analog sensors:");
|
||||
for (const auto & sensor : analogsensor_.sensors()) {
|
||||
switch (sensor.type()) {
|
||||
case AnalogSensor::AnalogType::ADC:
|
||||
@@ -537,7 +537,7 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
||||
}
|
||||
if (need_publish) {
|
||||
if (doc.overflowed()) {
|
||||
LOG_WARNING(("MQTT buffer overflow, please use individual topics"));
|
||||
LOG_WARNING("MQTT buffer overflow, please use individual topics");
|
||||
}
|
||||
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_NONE), json);
|
||||
}
|
||||
@@ -808,7 +808,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
||||
// only process broadcast telegrams or ones sent to us on request
|
||||
// if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id())) {
|
||||
if (telegram->operation == Telegram::Operation::RX_READ) {
|
||||
// LOG_DEBUG(("read telegram received, not processing"));
|
||||
// LOG_DEBUG("read telegram received, not processing");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -884,12 +884,12 @@ bool EMSESP::device_exists(const uint8_t device_id) {
|
||||
// for each associated EMS device go and get its system information
|
||||
void EMSESP::show_devices(uuid::console::Shell & shell) {
|
||||
if (emsdevices.empty()) {
|
||||
shell.printfln(("No EMS devices detected. Try using 'scan devices' from the ems menu."));
|
||||
shell.printfln("No EMS devices detected. Try using 'scan devices' from the ems menu.");
|
||||
shell.println();
|
||||
return;
|
||||
}
|
||||
|
||||
shell.printfln(("These EMS devices are currently active:"));
|
||||
shell.printfln("These EMS devices are currently active:");
|
||||
shell.println();
|
||||
|
||||
// count the number of thermostats
|
||||
@@ -1018,7 +1018,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
name = "generic boiler";
|
||||
device_type = DeviceType::BOILER;
|
||||
flags = DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP;
|
||||
LOG_WARNING(("Unknown EMS boiler. Using generic profile. Please report on GitHub."));
|
||||
LOG_WARNING("Unknown EMS boiler. Using generic profile. Please report on GitHub.");
|
||||
} else {
|
||||
LOG_WARNING(("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub."), device_id);
|
||||
return false;
|
||||
@@ -1190,14 +1190,14 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
// if we're waiting on a Write operation, we want a single byte 1 or 4
|
||||
if ((tx_state == Telegram::Operation::TX_WRITE) && (length == 1)) {
|
||||
if (first_value == TxService::TX_WRITE_SUCCESS) {
|
||||
LOG_DEBUG(("Last Tx write successful"));
|
||||
LOG_DEBUG("Last Tx write successful");
|
||||
txservice_.increment_telegram_write_count(); // last tx/write was confirmed ok
|
||||
txservice_.send_poll(); // close the bus
|
||||
publish_id_ = txservice_.post_send_query(); // follow up with any post-read if set
|
||||
txservice_.reset_retry_count();
|
||||
tx_successful = true;
|
||||
} else if (first_value == TxService::TX_WRITE_FAIL) {
|
||||
LOG_ERROR(("Last Tx write rejected by host"));
|
||||
LOG_ERROR("Last Tx write rejected by host");
|
||||
txservice_.send_poll(); // close the bus
|
||||
txservice_.reset_retry_count();
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
uint8_t src = data[0];
|
||||
uint8_t dest = data[1];
|
||||
if (txservice_.is_last_tx(src, dest)) {
|
||||
LOG_DEBUG(("Last Tx read successful"));
|
||||
LOG_DEBUG("Last Tx read successful");
|
||||
txservice_.increment_telegram_read_count();
|
||||
txservice_.send_poll(); // close the bus
|
||||
txservice_.reset_retry_count();
|
||||
@@ -1289,14 +1289,14 @@ void EMSESP::start() {
|
||||
webLogService.begin(); // start web log service. now we can start capturing logs to the web log
|
||||
|
||||
#ifdef EMSESP_DEBUG
|
||||
LOG_NOTICE(("System is running in Debug mode"));
|
||||
LOG_NOTICE("System is running in Debug mode");
|
||||
#endif
|
||||
|
||||
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
|
||||
if (system_.check_upgrade()) {
|
||||
LOG_INFO(("System needs a restart to apply new settings. Please wait."));
|
||||
LOG_INFO("System needs a restart to apply new settings. Please wait.");
|
||||
system_.system_restart();
|
||||
};
|
||||
|
||||
|
||||
24
src/mqtt.cpp
24
src/mqtt.cpp
@@ -192,7 +192,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
shell.println();
|
||||
|
||||
// show subscriptions
|
||||
shell.printfln(("MQTT topic subscriptions:"));
|
||||
shell.printfln("MQTT topic subscriptions:");
|
||||
for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
|
||||
shell.printfln((" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str());
|
||||
}
|
||||
@@ -200,7 +200,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
|
||||
// show queues
|
||||
if (mqtt_messages_.empty()) {
|
||||
shell.printfln(("MQTT queue is empty"));
|
||||
shell.printfln("MQTT queue is empty");
|
||||
shell.println();
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ void Mqtt::show_topic_handlers(uuid::console::Shell & shell, const uint8_t devic
|
||||
return;
|
||||
}
|
||||
|
||||
// shell.print((" Subscribed MQTT topics: "));
|
||||
// shell.print(" Subscribed MQTT topics: ");
|
||||
// for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
|
||||
// if (mqtt_subfunction.device_type_ == device_type) {
|
||||
// shell.printf(("%s "), mqtt_subfunction.topic_.c_str());
|
||||
@@ -368,7 +368,7 @@ void Mqtt::on_publish(uint16_t packetId) const {
|
||||
// if the last published failed, don't bother checking it. wait for the next retry
|
||||
if (mqtt_message.packet_id_ == 0) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
LOG_DEBUG(("[DEBUG] ACK for failed message pid 0"));
|
||||
LOG_DEBUG("[DEBUG] ACK for failed message pid 0");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -450,15 +450,15 @@ void Mqtt::start() {
|
||||
}
|
||||
connecting_ = false;
|
||||
if (reason == AsyncMqttClientDisconnectReason::TCP_DISCONNECTED) {
|
||||
LOG_WARNING(("MQTT disconnected: TCP"));
|
||||
LOG_WARNING("MQTT disconnected: TCP");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_IDENTIFIER_REJECTED) {
|
||||
LOG_WARNING(("MQTT disconnected: Identifier Rejected"));
|
||||
LOG_WARNING("MQTT disconnected: Identifier Rejected");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_SERVER_UNAVAILABLE) {
|
||||
LOG_WARNING(("MQTT disconnected: Server unavailable"));
|
||||
LOG_WARNING("MQTT disconnected: Server unavailable");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_MALFORMED_CREDENTIALS) {
|
||||
LOG_WARNING(("MQTT disconnected: Malformed credentials"));
|
||||
LOG_WARNING("MQTT disconnected: Malformed credentials");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED) {
|
||||
LOG_WARNING(("MQTT disconnected: Not authorized"));
|
||||
LOG_WARNING("MQTT disconnected: Not authorized");
|
||||
} else {
|
||||
LOG_WARNING(("MQTT disconnected: code %d"), reason);
|
||||
}
|
||||
@@ -535,7 +535,7 @@ void Mqtt::on_connect() {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO(("MQTT connected"));
|
||||
LOG_INFO("MQTT connected");
|
||||
|
||||
connecting_ = true;
|
||||
connectcount_++;
|
||||
@@ -686,7 +686,7 @@ std::shared_ptr<const MqttMessage> Mqtt::queue_message(const uint8_t operation,
|
||||
// if the queue is full, make room but removing the last one
|
||||
if (mqtt_messages_.size() >= MAX_MQTT_MESSAGES) {
|
||||
mqtt_messages_.pop_front();
|
||||
LOG_WARNING(("Queue overflow, removing one message"));
|
||||
LOG_WARNING("Queue overflow, removing one message");
|
||||
mqtt_publish_fails_++;
|
||||
}
|
||||
mqtt_messages_.emplace_back(mqtt_message_id_++, std::move(message));
|
||||
@@ -815,7 +815,7 @@ void Mqtt::process_queue() {
|
||||
// it will have a real packet ID
|
||||
if (mqtt_message.packet_id_ > 0) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
LOG_DEBUG(("[DEBUG] Waiting for QOS-ACK"));
|
||||
LOG_DEBUG("[DEBUG] Waiting for QOS-ACK");
|
||||
#endif
|
||||
// if we don't get the ack within 10 minutes, republish with new packet_id
|
||||
if (uuid::get_uptime_sec() - last_publish_queue_ < 600) {
|
||||
|
||||
@@ -57,7 +57,7 @@ void Shower::loop() {
|
||||
// first check to see if hot water has been on long enough to be recognized as a Shower/Bath
|
||||
if (!shower_state_ && (time_now - timer_start_) > SHOWER_MIN_DURATION) {
|
||||
set_shower_state(true);
|
||||
LOG_DEBUG(("[Shower] hot water still running, starting shower timer"));
|
||||
LOG_DEBUG("[Shower] hot water still running, starting shower timer");
|
||||
}
|
||||
// check if the shower has been on too long
|
||||
else if ((time_now - timer_start_) > shower_alert_trigger_) {
|
||||
@@ -109,7 +109,7 @@ void Shower::loop() {
|
||||
// turn back on the hot water for the shower
|
||||
void Shower::shower_alert_stop() {
|
||||
if (doing_cold_shot_) {
|
||||
LOG_DEBUG(("Shower Alert stopped"));
|
||||
LOG_DEBUG("Shower Alert stopped");
|
||||
(void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "true");
|
||||
doing_cold_shot_ = false;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void Shower::shower_alert_stop() {
|
||||
// turn off hot water to send a shot of cold
|
||||
void Shower::shower_alert_start() {
|
||||
if (shower_alert_) {
|
||||
LOG_DEBUG(("Shower Alert started"));
|
||||
LOG_DEBUG("Shower Alert started");
|
||||
(void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "false");
|
||||
doing_cold_shot_ = true;
|
||||
alert_timer_start_ = uuid::get_uptime(); // timer starts now
|
||||
|
||||
@@ -77,7 +77,7 @@ bool System::command_fetch(const char * value, const int8_t id) {
|
||||
std::string value_s;
|
||||
if (Helpers::value2string(value, value_s)) {
|
||||
if (value_s == "all") {
|
||||
LOG_INFO(("Requesting data from EMS devices"));
|
||||
LOG_INFO("Requesting data from EMS devices");
|
||||
EMSESP::fetch_device_values();
|
||||
return true;
|
||||
} else if (value_s == (F_(boiler))) {
|
||||
@@ -105,7 +105,7 @@ bool System::command_publish(const char * value, const int8_t id) {
|
||||
if (Helpers::value2string(value, value_s)) {
|
||||
if (value_s == "ha") {
|
||||
EMSESP::publish_all(true); // includes HA
|
||||
LOG_INFO(("Publishing all data to MQTT, including HA configs"));
|
||||
LOG_INFO("Publishing all data to MQTT, including HA configs");
|
||||
return true;
|
||||
} else if (value_s == (F_(boiler))) {
|
||||
EMSESP::publish_device_values(EMSdevice::DeviceType::BOILER);
|
||||
@@ -129,7 +129,7 @@ bool System::command_publish(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
EMSESP::publish_all();
|
||||
LOG_INFO(("Publishing all data to MQTT"));
|
||||
LOG_INFO("Publishing all data to MQTT");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ bool System::command_watch(const char * value, const int8_t id) {
|
||||
|
||||
// restart EMS-ESP
|
||||
void System::system_restart() {
|
||||
LOG_INFO(("Restarting EMS-ESP..."));
|
||||
LOG_INFO("Restarting EMS-ESP...");
|
||||
Shell::loop_all();
|
||||
delay(1000); // wait a second
|
||||
#ifndef EMSESP_STANDALONE
|
||||
@@ -202,7 +202,7 @@ void System::system_restart() {
|
||||
|
||||
// saves all settings
|
||||
void System::wifi_reconnect() {
|
||||
LOG_INFO(("WiFi reconnecting..."));
|
||||
LOG_INFO("WiFi reconnecting...");
|
||||
Shell::loop_all();
|
||||
EMSESP::console_.loop();
|
||||
delay(1000); // wait a second
|
||||
@@ -241,7 +241,7 @@ void System::syslog_init() {
|
||||
// start & configure syslog
|
||||
if (!was_enabled) {
|
||||
syslog_.start();
|
||||
EMSESP::logger().info(("Starting Syslog"));
|
||||
EMSESP::logger().info("Starting Syslog");
|
||||
}
|
||||
syslog_.log_level((uuid::log::Level)syslog_level_);
|
||||
syslog_.mark_interval(syslog_mark_interval_);
|
||||
@@ -255,7 +255,7 @@ void System::syslog_init() {
|
||||
} else if (was_enabled) {
|
||||
// in case service is still running, this flushes the queue
|
||||
// https://github.com/emsesp/EMS-ESP/issues/496
|
||||
EMSESP::logger().info(("Stopping Syslog"));
|
||||
EMSESP::logger().info("Stopping Syslog");
|
||||
syslog_.log_level((uuid::log::Level)-1);
|
||||
syslog_.mark_interval(0);
|
||||
syslog_.destination("");
|
||||
@@ -399,7 +399,7 @@ void System::start() {
|
||||
|
||||
// button single click
|
||||
void System::button_OnClick(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - single click"));
|
||||
LOG_DEBUG("Button pressed - single click");
|
||||
|
||||
#ifdef EMSESP_DEBUG
|
||||
#ifndef EMSESP_STANDALONE
|
||||
@@ -410,20 +410,20 @@ void System::button_OnClick(PButton & b) {
|
||||
|
||||
// button double click
|
||||
void System::button_OnDblClick(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - double click - reconnect"));
|
||||
LOG_DEBUG("Button pressed - double click - reconnect");
|
||||
EMSESP::system_.wifi_reconnect();
|
||||
}
|
||||
|
||||
// button long press
|
||||
void System::button_OnLongPress(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - long press"));
|
||||
LOG_DEBUG("Button pressed - long press");
|
||||
}
|
||||
|
||||
// button indefinite press
|
||||
void System::button_OnVLongPress(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - very long press"));
|
||||
LOG_DEBUG("Button pressed - very long press");
|
||||
#ifndef EMSESP_STANDALONE
|
||||
LOG_WARNING(("Performing factory reset..."));
|
||||
LOG_WARNING("Performing factory reset...");
|
||||
EMSESP::console_.loop();
|
||||
EMSESP::esp8266React.factoryReset();
|
||||
#endif
|
||||
@@ -437,12 +437,12 @@ void System::button_init(bool refresh) {
|
||||
|
||||
if (is_valid_gpio(pbutton_gpio_)) {
|
||||
if (!myPButton_.init(pbutton_gpio_, HIGH)) {
|
||||
LOG_DEBUG(("Multi-functional button not detected"));
|
||||
LOG_DEBUG("Multi-functional button not detected");
|
||||
} else {
|
||||
LOG_DEBUG(("Multi-functional button enabled"));
|
||||
LOG_DEBUG("Multi-functional button enabled");
|
||||
}
|
||||
} else {
|
||||
LOG_WARNING(("Invalid button GPIO. Check config."));
|
||||
LOG_WARNING("Invalid button GPIO. Check config.");
|
||||
}
|
||||
|
||||
myPButton_.onClick(BUTTON_Debounce, button_OnClick);
|
||||
@@ -772,7 +772,7 @@ int8_t System::wifi_quality(int8_t dBm) {
|
||||
|
||||
// print users to console
|
||||
void System::show_users(uuid::console::Shell & shell) {
|
||||
shell.printfln(("Users:"));
|
||||
shell.printfln("Users:");
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
EMSESP::esp8266React.getSecuritySettingsService()->read([&](SecuritySettings & securitySettings) {
|
||||
@@ -801,19 +801,19 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
shell.println("Network:");
|
||||
switch (WiFi.status()) {
|
||||
case WL_IDLE_STATUS:
|
||||
shell.printfln((" Network: Idle"));
|
||||
shell.printfln(" Network: Idle");
|
||||
break;
|
||||
|
||||
case WL_NO_SSID_AVAIL:
|
||||
shell.printfln((" Network: Network not found"));
|
||||
shell.printfln(" Network: Network not found");
|
||||
break;
|
||||
|
||||
case WL_SCAN_COMPLETED:
|
||||
shell.printfln((" Network: Network scan complete"));
|
||||
shell.printfln(" Network: Network scan complete");
|
||||
break;
|
||||
|
||||
case WL_CONNECTED:
|
||||
shell.printfln((" Network: connected"));
|
||||
shell.printfln(" Network: connected");
|
||||
shell.printfln((" SSID: %s"), WiFi.SSID().c_str());
|
||||
shell.printfln((" BSSID: %s"), WiFi.BSSIDstr().c_str());
|
||||
shell.printfln((" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI()));
|
||||
@@ -828,27 +828,27 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
break;
|
||||
|
||||
case WL_CONNECT_FAILED:
|
||||
shell.printfln((" WiFi Network: Connection failed"));
|
||||
shell.printfln(" WiFi Network: Connection failed");
|
||||
break;
|
||||
|
||||
case WL_CONNECTION_LOST:
|
||||
shell.printfln((" WiFi Network: Connection lost"));
|
||||
shell.printfln(" WiFi Network: Connection lost");
|
||||
break;
|
||||
|
||||
case WL_DISCONNECTED:
|
||||
shell.printfln((" WiFi Network: Disconnected"));
|
||||
shell.printfln(" WiFi Network: Disconnected");
|
||||
break;
|
||||
|
||||
case WL_NO_SHIELD:
|
||||
default:
|
||||
shell.printfln((" WiFi Network: Unknown"));
|
||||
shell.printfln(" WiFi Network: Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
// show Ethernet if connected
|
||||
if (ethernet_connected_) {
|
||||
shell.println();
|
||||
shell.printfln((" Ethernet Network: connected"));
|
||||
shell.printfln(" Ethernet Network: connected");
|
||||
shell.printfln((" MAC address: %s"), ETH.macAddress().c_str());
|
||||
shell.printfln((" Hostname: %s"), ETH.getHostname());
|
||||
shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str());
|
||||
@@ -862,17 +862,17 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
|
||||
shell.println("Syslog:");
|
||||
if (!syslog_enabled_) {
|
||||
shell.printfln((" Syslog: disabled"));
|
||||
shell.printfln(" Syslog: disabled");
|
||||
} else {
|
||||
shell.printfln((" Syslog: %s"), syslog_.started() ? "started" : "stopped");
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : (F_(unset)));
|
||||
shell.printfln((" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str());
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(port_fmt), syslog_port_);
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(log_level_fmt), uuid::log::format_level_lowercase(static_cast<uuid::log::Level>(syslog_level_)));
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(mark_interval_fmt), syslog_mark_interval_);
|
||||
shell.printfln((" Queued: %d"), syslog_.queued());
|
||||
}
|
||||
@@ -908,10 +908,10 @@ bool System::check_upgrade() {
|
||||
// it's a customization file, just replace it and there's no need to reboot
|
||||
saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customizations", input);
|
||||
} else {
|
||||
LOG_ERROR(("Unrecognized file uploaded"));
|
||||
LOG_ERROR("Unrecognized file uploaded");
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR(("Unrecognized file uploaded, not json"));
|
||||
LOG_ERROR("Unrecognized file uploaded, not json");
|
||||
}
|
||||
|
||||
// close (just in case) and remove the temp file
|
||||
@@ -1111,16 +1111,16 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
||||
node = output.createNestedObject("Bus Status");
|
||||
switch (EMSESP::bus_status()) {
|
||||
case EMSESP::BUS_STATUS_OFFLINE:
|
||||
node["bus status"] = (("disconnected"));
|
||||
node["bus status"] = ("disconnected");
|
||||
break;
|
||||
case EMSESP::BUS_STATUS_TX_ERRORS:
|
||||
node["bus status"] = (("connected, tx issues - try a different Tx Mode"));
|
||||
node["bus status"] = ("connected, tx issues - try a different Tx Mode");
|
||||
break;
|
||||
case EMSESP::BUS_STATUS_CONNECTED:
|
||||
node["bus status"] = (("connected"));
|
||||
node["bus status"] = ("connected");
|
||||
break;
|
||||
default:
|
||||
node["bus status"] = (("unknown"));
|
||||
node["bus status"] = ("unknown");
|
||||
break;
|
||||
}
|
||||
if (EMSESP::bus_status() != EMSESP::BUS_STATUS_OFFLINE) {
|
||||
|
||||
@@ -120,7 +120,7 @@ std::string Telegram::to_string() const {
|
||||
// returns telegram's message body only, in hex
|
||||
std::string Telegram::to_string_message() const {
|
||||
if (this->message_length == 0) {
|
||||
return (("<empty>"));
|
||||
return ("<empty>");
|
||||
}
|
||||
|
||||
return Helpers::data_to_hex(this->message_data, this->message_length);
|
||||
@@ -381,7 +381,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
|
||||
uint16_t status = EMSuart::transmit(telegram_raw, length);
|
||||
|
||||
if (status == EMS_TX_STATUS_ERR) {
|
||||
LOG_ERROR(("Failed to transmit Tx via UART."));
|
||||
LOG_ERROR("Failed to transmit Tx via UART.");
|
||||
if (telegram->operation == Telegram::Operation::TX_READ) {
|
||||
increment_telegram_read_fail_count(); // another Tx fail
|
||||
} else {
|
||||
@@ -412,7 +412,7 @@ void TxService::send_telegram(const uint8_t * data, const uint8_t length) {
|
||||
uint16_t status = EMSuart::transmit(telegram_raw, length);
|
||||
|
||||
if (status == EMS_TX_STATUS_ERR) {
|
||||
LOG_ERROR(("Failed to transmit Tx via UART."));
|
||||
LOG_ERROR("Failed to transmit Tx via UART.");
|
||||
increment_telegram_fail_count(); // another Tx fail
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "general") == 0) {
|
||||
EMSESP::logger().info(("Testing general. Adding a Boiler and Thermostat"));
|
||||
EMSESP::logger().info("Testing general. Adding a Boiler and Thermostat");
|
||||
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
add_device(0x18, 157); // Bosch CR100
|
||||
@@ -54,7 +54,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "2thermostats") == 0) {
|
||||
EMSESP::logger().info(("Testing with multiple thermostats..."));
|
||||
EMSESP::logger().info("Testing with multiple thermostats...");
|
||||
|
||||
add_device(0x08, 123); // GB072
|
||||
add_device(0x10, 158); // RC310
|
||||
@@ -86,7 +86,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "310") == 0) {
|
||||
EMSESP::logger().info(("Adding a GB072/RC310 combo..."));
|
||||
EMSESP::logger().info("Adding a GB072/RC310 combo...");
|
||||
|
||||
add_device(0x08, 123); // GB072
|
||||
add_device(0x10, 158); // RC310
|
||||
@@ -113,7 +113,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "gateway") == 0) {
|
||||
EMSESP::logger().info(("Adding a Gateway..."));
|
||||
EMSESP::logger().info("Adding a Gateway...");
|
||||
|
||||
// add 0x48 KM200, via a version command
|
||||
rx_telegram({0x48, 0x0B, 0x02, 0x00, 0xBD, 0x04, 0x06, 00, 00, 00, 00, 00, 00, 00});
|
||||
@@ -133,7 +133,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "mixer") == 0) {
|
||||
EMSESP::logger().info(("Adding a mixer..."));
|
||||
EMSESP::logger().info("Adding a mixer...");
|
||||
|
||||
// add controller
|
||||
add_device(0x09, 114);
|
||||
@@ -155,7 +155,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "boiler") == 0) {
|
||||
EMSESP::logger().info(("Adding boiler..."));
|
||||
EMSESP::logger().info("Adding boiler...");
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
|
||||
// UBAuptime
|
||||
@@ -172,7 +172,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "thermostat") == 0) {
|
||||
EMSESP::logger().info(("Adding thermostat..."));
|
||||
EMSESP::logger().info("Adding thermostat...");
|
||||
|
||||
add_device(0x10, 192); // FW120
|
||||
|
||||
@@ -185,7 +185,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "solar") == 0) {
|
||||
EMSESP::logger().info(("Adding solar..."));
|
||||
EMSESP::logger().info("Adding solar...");
|
||||
|
||||
add_device(0x30, 163); // SM100
|
||||
|
||||
@@ -204,7 +204,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "heatpump") == 0) {
|
||||
EMSESP::logger().info(("Adding heatpump..."));
|
||||
EMSESP::logger().info("Adding heatpump...");
|
||||
|
||||
add_device(0x38, 200); // Enviline module
|
||||
add_device(0x10, 192); // FW120 thermostat
|
||||
@@ -238,7 +238,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "general") {
|
||||
shell.printfln(("Testing adding a general boiler & thermostat..."));
|
||||
shell.printfln("Testing adding a general boiler & thermostat...");
|
||||
run_test("general");
|
||||
shell.invoke_command("show devices");
|
||||
shell.invoke_command("show");
|
||||
@@ -247,7 +247,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "render") {
|
||||
shell.printfln(("Testing render..."));
|
||||
shell.printfln("Testing render...");
|
||||
|
||||
// check read_value to make sure it handles all the data type correctly
|
||||
uint8_t message_data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; // message_length is 9
|
||||
@@ -315,7 +315,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "devices") {
|
||||
shell.printfln(("Testing devices..."));
|
||||
shell.printfln("Testing devices...");
|
||||
|
||||
// A fake response - UBADevices(0x07)
|
||||
rx_telegram({0x08, 0x00, 0x07, 0x00, 0x0B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
|
||||
@@ -323,7 +323,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// check for boiler and controller on same product_id
|
||||
if (command == "double") {
|
||||
shell.printfln(("Testing double..."));
|
||||
shell.printfln("Testing double...");
|
||||
|
||||
add_device(0x08, 206); // Nefit Excellent HR30
|
||||
add_device(0x09, 206); // Nefit Excellent HR30 Controller
|
||||
@@ -333,7 +333,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "620") {
|
||||
EMSESP::logger().info(("Testing 620..."));
|
||||
EMSESP::logger().info("Testing 620...");
|
||||
|
||||
// Version Controller
|
||||
uart_telegram({0x09, 0x0B, 0x02, 0x00, 0x5F, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
|
||||
@@ -344,7 +344,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// unknown device
|
||||
if (command == "unknown") {
|
||||
shell.printfln(("Testing unknown..."));
|
||||
shell.printfln("Testing unknown...");
|
||||
|
||||
// add boiler
|
||||
add_device(0x08, 84);
|
||||
@@ -361,19 +361,19 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "unknown2") {
|
||||
shell.printfln(("Testing unknown2..."));
|
||||
shell.printfln("Testing unknown2...");
|
||||
|
||||
// simulate getting version information back from an unknown device
|
||||
rx_telegram({0x09, 0x0B, 0x02, 0x00, 0x5A, 0x01, 0x02}); // productID is 90 which doesn't exist
|
||||
}
|
||||
|
||||
if (command == "gateway") {
|
||||
shell.printfln(("Testing Gateway..."));
|
||||
shell.printfln("Testing Gateway...");
|
||||
run_test("gateway");
|
||||
}
|
||||
|
||||
if (command == "310") {
|
||||
shell.printfln(("Testing RC310..."));
|
||||
shell.printfln("Testing RC310...");
|
||||
run_test("310");
|
||||
shell.invoke_command("show devices");
|
||||
shell.invoke_command("show");
|
||||
@@ -382,14 +382,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "2thermostats") {
|
||||
shell.printfln(("Testing multiple thermostats..."));
|
||||
shell.printfln("Testing multiple thermostats...");
|
||||
run_test("2thermostats");
|
||||
shell.invoke_command("show");
|
||||
shell.invoke_command("show devices");
|
||||
}
|
||||
|
||||
if (command == "web") {
|
||||
shell.printfln(("Testing Web..."));
|
||||
shell.printfln("Testing Web...");
|
||||
|
||||
Mqtt::enabled(false); // turn off mqtt
|
||||
Mqtt::ha_enabled(false); // turn off ha
|
||||
@@ -438,7 +438,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "board_profile") {
|
||||
shell.printfln(("Testing board profile..."));
|
||||
shell.printfln("Testing board profile...");
|
||||
|
||||
shell.invoke_command("system");
|
||||
shell.invoke_command("set board_profile wemos");
|
||||
@@ -447,7 +447,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "boiler") {
|
||||
shell.printfln(("Testing boiler..."));
|
||||
shell.printfln("Testing boiler...");
|
||||
// Mqtt::ha_enabled(false);
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -475,7 +475,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "shower_alert") {
|
||||
shell.printfln(("Testing Shower Alert..."));
|
||||
shell.printfln("Testing Shower Alert...");
|
||||
|
||||
run_test("boiler");
|
||||
|
||||
@@ -484,7 +484,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "fr120") {
|
||||
shell.printfln(("Testing adding a thermostat FR120..."));
|
||||
shell.printfln("Testing adding a thermostat FR120...");
|
||||
|
||||
add_device(0x10, 191); // FR120 thermostat
|
||||
|
||||
@@ -496,7 +496,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "ha") {
|
||||
shell.printfln(("Testing HA mqtt discovery"));
|
||||
shell.printfln("Testing HA mqtt discovery");
|
||||
Mqtt::ha_enabled(true);
|
||||
// Mqtt::ha_enabled(false);
|
||||
|
||||
@@ -518,7 +518,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "lastcode") {
|
||||
shell.printfln(("Testing lastcode"));
|
||||
shell.printfln("Testing lastcode");
|
||||
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -536,7 +536,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "dv") {
|
||||
shell.printfln(("Testing device value rendering"));
|
||||
shell.printfln("Testing device value rendering");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -550,12 +550,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "dallas") {
|
||||
shell.printfln(("Testing adding Dallas sensor"));
|
||||
shell.printfln("Testing adding Dallas sensor");
|
||||
emsesp::EMSESP::dallassensor_.test();
|
||||
}
|
||||
|
||||
if (command == "dallas_full") {
|
||||
shell.printfln(("Testing adding and changing Dallas sensor"));
|
||||
shell.printfln("Testing adding and changing Dallas sensor");
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::nested_format(1);
|
||||
// Mqtt::nested_format(0);
|
||||
@@ -571,7 +571,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "analog") {
|
||||
shell.printfln(("Testing adding Analog sensor"));
|
||||
shell.printfln("Testing adding Analog sensor");
|
||||
Mqtt::ha_enabled(true);
|
||||
// Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -602,7 +602,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "masked") {
|
||||
shell.printfln(("Testing masked entities"));
|
||||
shell.printfln("Testing masked entities");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::send_response(false);
|
||||
@@ -626,7 +626,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "dv2") {
|
||||
shell.printfln(("Testing device value lost"));
|
||||
shell.printfln("Testing device value lost");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::send_response(false);
|
||||
@@ -647,7 +647,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
if (command == "api_values") {
|
||||
#if defined(EMSESP_STANDALONE)
|
||||
shell.printfln(("Testing API getting values"));
|
||||
shell.printfln("Testing API getting values");
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
Mqtt::send_response(false);
|
||||
@@ -680,7 +680,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "mqtt_post") {
|
||||
shell.printfln(("Testing MQTT incoming changes"));
|
||||
shell.printfln("Testing MQTT incoming changes");
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
Mqtt::send_response(false);
|
||||
@@ -696,7 +696,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
#if defined(EMSESP_STANDALONE)
|
||||
// https://github.com/emsesp/EMS-ESP32/issues/541
|
||||
if (command == "api_wwmode") {
|
||||
shell.printfln(("Testing API wwmode"));
|
||||
shell.printfln("Testing API wwmode");
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
run_test("310");
|
||||
@@ -715,7 +715,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
#endif
|
||||
|
||||
if (command == "api") {
|
||||
shell.printfln(("Testing API with MQTT and REST, standalone"));
|
||||
shell.printfln("Testing API with MQTT and REST, standalone");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
// Mqtt::ha_enabled(false);
|
||||
@@ -990,7 +990,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "mqtt_nested") {
|
||||
shell.printfln(("Testing nested MQTT"));
|
||||
shell.printfln("Testing nested MQTT");
|
||||
Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter
|
||||
|
||||
run_test("boiler");
|
||||
@@ -1010,7 +1010,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "thermostat") {
|
||||
shell.printfln(("Testing adding a thermostat FW120..."));
|
||||
shell.printfln("Testing adding a thermostat FW120...");
|
||||
|
||||
run_test("thermostat");
|
||||
shell.invoke_command("show");
|
||||
@@ -1026,7 +1026,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "tc100") {
|
||||
shell.printfln(("Testing adding a TC100 thermostat to the EMS bus..."));
|
||||
shell.printfln("Testing adding a TC100 thermostat to the EMS bus...");
|
||||
|
||||
// add a thermostat
|
||||
add_device(0x18, 202); // Bosch TC100 - https://github.com/emsesp/EMS-ESP/issues/474
|
||||
@@ -1037,7 +1037,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "solar") {
|
||||
shell.printfln(("Testing Solar"));
|
||||
shell.printfln("Testing Solar");
|
||||
run_test("solar");
|
||||
|
||||
uart_telegram("30 00 FF 0A 02 6A 04"); // SM100 pump on (1)sh
|
||||
@@ -1050,14 +1050,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "heatpump") {
|
||||
shell.printfln(("Testing Heat Pump"));
|
||||
shell.printfln("Testing Heat Pump");
|
||||
run_test("heatpump");
|
||||
shell.invoke_command("call");
|
||||
shell.invoke_command("call heatpump info");
|
||||
}
|
||||
|
||||
if (command == "solar200") {
|
||||
shell.printfln(("Testing Solar SM200"));
|
||||
shell.printfln("Testing Solar SM200");
|
||||
|
||||
add_device(0x30, 164); // SM200
|
||||
|
||||
@@ -1082,7 +1082,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "km") {
|
||||
shell.printfln(("Testing KM200 Gateway"));
|
||||
shell.printfln("Testing KM200 Gateway");
|
||||
|
||||
add_device(0x10, 158); // RC300
|
||||
add_device(0x48, 189); // KM200
|
||||
@@ -1140,7 +1140,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "cr100") {
|
||||
shell.printfln(("Testing CR100"));
|
||||
shell.printfln("Testing CR100");
|
||||
|
||||
add_device(0x18, 157); // Bosch CR100 - https://github.com/emsesp/EMS-ESP/issues/355
|
||||
|
||||
@@ -1165,14 +1165,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "rx2") {
|
||||
shell.printfln(("Testing Rx2..."));
|
||||
shell.printfln("Testing Rx2...");
|
||||
for (uint8_t i = 0; i < 30; i++) {
|
||||
uart_telegram({0x08, 0x0B, 0x33, 0x00, 0x08, 0xFF, 0x34, 0xFB, 0x00, 0x28, 0x00, 0x00, 0x46, 0x00, 0xFF, 0xFF, 0x00});
|
||||
}
|
||||
}
|
||||
|
||||
if (command == "rx") {
|
||||
shell.printfln(("Testing Rx..."));
|
||||
shell.printfln("Testing Rx...");
|
||||
|
||||
// fake telegrams. length includes CRC
|
||||
// Boiler -> Me, UBAMonitorFast(0x18), telegram: 08 00 18 00 00 02 5A 73 3D 0A 10 65 40 02 1A 80 00 01 E1 01 76 0E 3D 48 00 C9 44 02 00 (#data=25)
|
||||
@@ -1229,7 +1229,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "tx") {
|
||||
shell.printfln(("Testing Tx..."));
|
||||
shell.printfln("Testing Tx...");
|
||||
|
||||
// TX queue example - Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4)
|
||||
uint8_t t11[] = {0x44, 0x45, 0x46, 0x47};
|
||||
@@ -1266,7 +1266,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "poll") {
|
||||
shell.printfln(("Testing Poll..."));
|
||||
shell.printfln("Testing Poll...");
|
||||
|
||||
// simulate sending a read request
|
||||
// uint8_t t16[] = {0x44, 0x45, 0x46, 0x47}; // Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4)
|
||||
@@ -1291,7 +1291,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "cmd") {
|
||||
shell.printfln(("Testing Commands..."));
|
||||
shell.printfln("Testing Commands...");
|
||||
|
||||
// add a thermostat with 3 HCs
|
||||
add_device(0x10, 192); // FW120
|
||||
@@ -1318,13 +1318,13 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "pin") {
|
||||
shell.printfln(("Testing pin..."));
|
||||
shell.printfln("Testing pin...");
|
||||
shell.invoke_command("call system pin");
|
||||
shell.invoke_command("call system pin 1 true");
|
||||
}
|
||||
|
||||
if (command == "mqtt2") {
|
||||
shell.printfln(("Testing MQTT large payloads..."));
|
||||
shell.printfln("Testing MQTT large payloads...");
|
||||
|
||||
DynamicJsonDocument doc(EMSESP_JSON_SIZE_XXLARGE_DYN);
|
||||
|
||||
@@ -1347,7 +1347,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "mqtt") {
|
||||
shell.printfln(("Testing MQTT..."));
|
||||
shell.printfln("Testing MQTT...");
|
||||
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::enabled(true);
|
||||
@@ -1422,7 +1422,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "poll2") {
|
||||
shell.printfln(("Testing Tx Sending last message on queue..."));
|
||||
shell.printfln("Testing Tx Sending last message on queue...");
|
||||
|
||||
EMSESP::show_ems(shell);
|
||||
|
||||
@@ -1433,7 +1433,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "rx2") {
|
||||
shell.printfln(("Testing rx2..."));
|
||||
shell.printfln("Testing rx2...");
|
||||
|
||||
uart_telegram({0x1B, 0x5B, 0xFD, 0x2D, 0x9E, 0x3A, 0xB6, 0xE5, 0x02, 0x20, 0x33, 0x30, 0x32, 0x3A, 0x20, 0x5B,
|
||||
0x73, 0xFF, 0xFF, 0xCB, 0xDF, 0xB7, 0xA7, 0xB5, 0x67, 0x77, 0x77, 0xE4, 0xFF, 0xFD, 0x77, 0xFF});
|
||||
@@ -1441,14 +1441,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// https://github.com/emsesp/EMS-ESP/issues/380#issuecomment-633663007
|
||||
if (command == "rx3") {
|
||||
shell.printfln(("Testing rx3..."));
|
||||
shell.printfln("Testing rx3...");
|
||||
|
||||
uart_telegram({0x21, 0x0B, 0xFF, 0x00});
|
||||
}
|
||||
|
||||
// testing the UART tx command, without a queue
|
||||
if (command == "tx2") {
|
||||
shell.printfln(("Testing tx2..."));
|
||||
shell.printfln("Testing tx2...");
|
||||
|
||||
uint8_t t[] = {0x0B, 0x88, 0x18, 0x00, 0x20, 0xD4}; // including CRC
|
||||
EMSuart::transmit(t, sizeof(t));
|
||||
@@ -1456,14 +1456,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// send read request with offset
|
||||
if (command == "offset") {
|
||||
shell.printfln(("Testing offset..."));
|
||||
shell.printfln("Testing offset...");
|
||||
|
||||
// send_read_request(0x18, 0x08);
|
||||
EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset
|
||||
}
|
||||
|
||||
if (command == "mixer") {
|
||||
shell.printfln(("Testing Mixer..."));
|
||||
shell.printfln("Testing Mixer...");
|
||||
|
||||
run_test("mixer");
|
||||
|
||||
@@ -1477,7 +1477,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "crash") {
|
||||
shell.printfln(("Forcing a crash..."));
|
||||
shell.printfln("Forcing a crash...");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdiv-by-zero"
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.5.0b3"
|
||||
#define EMSESP_APP_VERSION "3.5.0b3_o"
|
||||
|
||||
@@ -117,7 +117,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) {
|
||||
emsesp::EMSESP::logger().err(error);
|
||||
api_fails_++;
|
||||
} else {
|
||||
// emsesp::EMSESP::logger().debug(("API command called successfully"));
|
||||
// emsesp::EMSESP::logger().debug("API command called successfully");
|
||||
// if there was no json output from the call, default to the output message 'OK'.
|
||||
if (!output.size()) {
|
||||
output["message"] = "OK";
|
||||
|
||||
@@ -238,7 +238,7 @@ void WebDataService::write_value(AsyncWebServerRequest * request, JsonVariant &
|
||||
if (return_code != CommandRet::OK) {
|
||||
EMSESP::logger().err(("Write command failed %s (%s)"), (const char *)output["message"], Command::return_code_string(return_code).c_str());
|
||||
} else {
|
||||
EMSESP::logger().debug(("Write command successful"));
|
||||
EMSESP::logger().debug("Write command successful");
|
||||
}
|
||||
|
||||
response->setCode((return_code == CommandRet::OK) ? 200 : 204);
|
||||
|
||||
@@ -48,7 +48,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
// EMSESP::logger().info(("Ethernet initialized"));
|
||||
// EMSESP::logger().info("Ethernet initialized");
|
||||
ETH.setHostname(EMSESP::system_.hostname().c_str());
|
||||
|
||||
// configure for static IP
|
||||
@@ -74,12 +74,12 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
EMSESP::logger().warning(("Ethernet disconnected"));
|
||||
EMSESP::logger().warning("Ethernet disconnected");
|
||||
EMSESP::system_.ethernet_connected(false);
|
||||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
EMSESP::logger().info(("Ethernet stopped"));
|
||||
EMSESP::logger().info("Ethernet stopped");
|
||||
EMSESP::system_.ethernet_connected(false);
|
||||
break;
|
||||
|
||||
@@ -202,7 +202,7 @@ void WebStatusService::mDNS_start() const {
|
||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||
if (networkSettings.enableMDNS) {
|
||||
if (!MDNS.begin(EMSESP::system_.hostname().c_str())) {
|
||||
EMSESP::logger().warning(("Failed to start mDNS responder service"));
|
||||
EMSESP::logger().warning("Failed to start mDNS responder service");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,13 +214,13 @@ void WebStatusService::mDNS_start() const {
|
||||
MDNS.addServiceTxt("http", "tcp", "version", EMSESP_APP_VERSION);
|
||||
MDNS.addServiceTxt("http", "tcp", "address", address_s.c_str());
|
||||
|
||||
EMSESP::logger().info(("mDNS responder service started"));
|
||||
EMSESP::logger().info("mDNS responder service started");
|
||||
}
|
||||
});
|
||||
#else
|
||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||
if (networkSettings.enableMDNS) {
|
||||
EMSESP::logger().info(("mDNS responder service started"));
|
||||
EMSESP::logger().info("mDNS responder service started");
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user