Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1801 shower_duration_min #1807

Merged
merged 7 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
- rename DeviceValueTypes, add UINT32 for custom entities
- dynamic register dhw circuits for thermostat
- removed OTA feature [#1738](https://github.com/emsesp/EMS-ESP32/issues/1738)
- added shower min duration [[#1801](https://github.com/emsesp/EMS-ESP32/issues/1801)]
4 changes: 2 additions & 2 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@mui/material": "^5.15.20",
"@table-library/react-table-library": "4.1.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.14.2",
"@types/node": "^20.14.6",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",
Expand Down Expand Up @@ -63,7 +63,7 @@
"prettier": "^3.3.2",
"rollup-plugin-visualizer": "^5.12.0",
"terser": "^5.31.1",
"typescript-eslint": "^7.13.0",
"typescript-eslint": "^7.13.1",
"vite": "^5.3.1",
"vite-plugin-imagemin": "^0.6.1",
"vite-tsconfig-paths": "^4.3.2"
Expand Down
20 changes: 20 additions & 0 deletions interface/src/project/ApplicationSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,26 @@ const ApplicationSettings: FC = () => {
justifyContent="flex-start"
alignItems="flex-start"
>
{data.shower_timer && (
<Grid item xs={12} sm={6}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="shower_min_duration"
// TODO translate
label="Dp this"
InputProps={{
endAdornment: (
<InputAdornment position="end">{LL.SECONDS()}</InputAdornment>
)
}}
variant="outlined"
value={numberValue(data.shower_min_duration)}
fullWidth
type="number"
onChange={updateFormValue}
/>
</Grid>
)}
{data.shower_alert && (
<>
<Grid item xs={12} sm={6}>
Expand Down
1 change: 1 addition & 0 deletions interface/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Settings {
shower_alert: boolean;
shower_alert_coldshot: number;
shower_alert_trigger: number;
shower_min_duration: number;
rx_gpio: number;
tx_gpio: number;
telnet_enabled: boolean;
Expand Down
10 changes: 10 additions & 0 deletions interface/src/project/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ export const createSettingsValidator = (settings: Settings) =>
{ type: 'number', min: 0, max: 10, message: 'Must be between 0 and 10' }
]
}),
...(settings.shower_timer && {
shower_min_duration: [
{
type: 'number',
min: 1,
max: 3000,
message: 'Time must be between 1 and 3000 seconds'
}
]
}),
...(settings.shower_alert && {
shower_alert_trigger: [
{
Expand Down
126 changes: 63 additions & 63 deletions interface/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1760,12 +1760,12 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^20.14.2":
version: 20.14.2
resolution: "@types/node@npm:20.14.2"
"@types/node@npm:^20.14.6":
version: 20.14.6
resolution: "@types/node@npm:20.14.6"
dependencies:
undici-types: "npm:~5.26.4"
checksum: 10c0/2d86e5f2227aaa42212e82ea0affe72799111b888ff900916376450b02b09b963ca888b20d9c332d8d2b833ed4781987867a38eaa2e4863fa8439071468b0a6f
checksum: 10c0/22640f0eb2a955872e4529a93be1b719f67b527b80fdab51419756d20e21b5ce0f4ccbee9a3e2ff20e5def647f77baf77b4b0434ff8896791c102165ec0c3e48
languageName: node
linkType: hard

Expand Down Expand Up @@ -1860,15 +1860,15 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/eslint-plugin@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/eslint-plugin@npm:7.13.0"
"@typescript-eslint/eslint-plugin@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/eslint-plugin@npm:7.13.1"
dependencies:
"@eslint-community/regexpp": "npm:^4.10.0"
"@typescript-eslint/scope-manager": "npm:7.13.0"
"@typescript-eslint/type-utils": "npm:7.13.0"
"@typescript-eslint/utils": "npm:7.13.0"
"@typescript-eslint/visitor-keys": "npm:7.13.0"
"@typescript-eslint/scope-manager": "npm:7.13.1"
"@typescript-eslint/type-utils": "npm:7.13.1"
"@typescript-eslint/utils": "npm:7.13.1"
"@typescript-eslint/visitor-keys": "npm:7.13.1"
graphemer: "npm:^1.4.0"
ignore: "npm:^5.3.1"
natural-compare: "npm:^1.4.0"
Expand All @@ -1879,68 +1879,68 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/00a69d029713252c03490e0a9c49c9136d99c9c1888dd3570b1e044c9a740b59c2e488849beda654d6fc0a69e2549445c16d443bcf5832c66b7a4472b42826ae
checksum: 10c0/6677f9c090a25978e4e20c24d67365ad89ca1208ebd2bb103d3f1e15a7deea22dea538e9f61f3a3d4f03a741179acf58c02ad7d03f805aceabb78929a8dc1908
languageName: node
linkType: hard

"@typescript-eslint/parser@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/parser@npm:7.13.0"
"@typescript-eslint/parser@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/parser@npm:7.13.1"
dependencies:
"@typescript-eslint/scope-manager": "npm:7.13.0"
"@typescript-eslint/types": "npm:7.13.0"
"@typescript-eslint/typescript-estree": "npm:7.13.0"
"@typescript-eslint/visitor-keys": "npm:7.13.0"
"@typescript-eslint/scope-manager": "npm:7.13.1"
"@typescript-eslint/types": "npm:7.13.1"
"@typescript-eslint/typescript-estree": "npm:7.13.1"
"@typescript-eslint/visitor-keys": "npm:7.13.1"
debug: "npm:^4.3.4"
peerDependencies:
eslint: ^8.56.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/8cf58116d6577c9459db3e3047e337dc41d914bf222a33b20e149515d037e09e6171fbac5af02b66aa6fbad81dd492fa5b7bcd44aaf659d4e9b02ab23100f955
checksum: 10c0/455d067bfb81fa3d133c75ebc4d8d7f2de5001441585f5b58dc8b0d4380d7397dc3745e11a9299d596dfa581265fdcdea6c28b2ddd2d3b542869c851ecd52fcd
languageName: node
linkType: hard

"@typescript-eslint/scope-manager@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/scope-manager@npm:7.13.0"
"@typescript-eslint/scope-manager@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/scope-manager@npm:7.13.1"
dependencies:
"@typescript-eslint/types": "npm:7.13.0"
"@typescript-eslint/visitor-keys": "npm:7.13.0"
checksum: 10c0/0f5c75578ee8cb3c31b9c4e222f4787ea4621fde639f3ac0a467e56250f3cc48bf69304c33b2b8cc8ba5ec69f3977b6c463b8d9e791806af9a8c6a2233505432
"@typescript-eslint/types": "npm:7.13.1"
"@typescript-eslint/visitor-keys": "npm:7.13.1"
checksum: 10c0/3d8770bf9c89e7a07e54efbc3dac6df02c0ce49d49575076111ac663566c90cbb852f06c94a311db7c0aec1fab0417f3ef6e601b3852aa30bed75c65f4f076f4
languageName: node
linkType: hard

"@typescript-eslint/type-utils@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/type-utils@npm:7.13.0"
"@typescript-eslint/type-utils@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/type-utils@npm:7.13.1"
dependencies:
"@typescript-eslint/typescript-estree": "npm:7.13.0"
"@typescript-eslint/utils": "npm:7.13.0"
"@typescript-eslint/typescript-estree": "npm:7.13.1"
"@typescript-eslint/utils": "npm:7.13.1"
debug: "npm:^4.3.4"
ts-api-utils: "npm:^1.3.0"
peerDependencies:
eslint: ^8.56.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/240e9b34e8602444cd234b84c9e3e52c565e3141a4942751f597c38cee48f7cb43c42a093d219ac6404dca2e74b54d2a8121fe66cbc59f404cb0ec2adecd8520
checksum: 10c0/c02305dccb0b2c7dcc9249230078c83e851ee589f93e08eb6cdc0b4c38d78d85ef4996631ac427836ee9d0a868ac031417feb74a6e4d0600096f41ca3c0e99a0
languageName: node
linkType: hard

"@typescript-eslint/types@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/types@npm:7.13.0"
checksum: 10c0/73dc59d4b0d0f0fed9f4b9b55f143185259ced5f0ca8ad9efa881eea1ff1cc9ccc1f175af2e2069f7b92a69c9f64f9be29d160c932b8f70a129af6b738b23be0
"@typescript-eslint/types@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/types@npm:7.13.1"
checksum: 10c0/38a01004e11259e457ae2fd02300ef362a3268a8fc70addfbf1508e2edcaca72da2f0f8771e42c1cb9f191c1f754af583cdcaebd830c8e3c3f796dcf30d3c3a8
languageName: node
linkType: hard

"@typescript-eslint/typescript-estree@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/typescript-estree@npm:7.13.0"
"@typescript-eslint/typescript-estree@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/typescript-estree@npm:7.13.1"
dependencies:
"@typescript-eslint/types": "npm:7.13.0"
"@typescript-eslint/visitor-keys": "npm:7.13.0"
"@typescript-eslint/types": "npm:7.13.1"
"@typescript-eslint/visitor-keys": "npm:7.13.1"
debug: "npm:^4.3.4"
globby: "npm:^11.1.0"
is-glob: "npm:^4.0.3"
Expand All @@ -1950,31 +1950,31 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/75b09384bc14afa3d3623507432d19d8ca91c4e936b1d2c1cfe4654a9c07179f1bc04aa99d1b541e84e40a01536862b23058f462d61b4a797c27d02f64b8aa51
checksum: 10c0/bd5c8951ae79e8eacd05ff100def02926c633045a1a54426f98f20b4ca31c485968af3226dd7939934dfaf36a6b5fcb3386948e2a7d763ddee2db905ac187ebc
languageName: node
linkType: hard

"@typescript-eslint/utils@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/utils@npm:7.13.0"
"@typescript-eslint/utils@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/utils@npm:7.13.1"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.4.0"
"@typescript-eslint/scope-manager": "npm:7.13.0"
"@typescript-eslint/types": "npm:7.13.0"
"@typescript-eslint/typescript-estree": "npm:7.13.0"
"@typescript-eslint/scope-manager": "npm:7.13.1"
"@typescript-eslint/types": "npm:7.13.1"
"@typescript-eslint/typescript-estree": "npm:7.13.1"
peerDependencies:
eslint: ^8.56.0
checksum: 10c0/5391f628775dec1a7033d954a066b77eeb03ac04c0a94690e60d8ebe351b57fdbda51b90cf785c901bcdf68b88ca3bcb5533ac59276b8b626b73eb18ac3280b6
checksum: 10c0/d2f6be42a80608ed265b34a5f6a0c97dc0b627d53b91e83d87c7d67541cb5b3c038e7320026b4ad8dfafe1ac07a0554efa8fe7673f54d74b68c253d6f9519bb6
languageName: node
linkType: hard

"@typescript-eslint/visitor-keys@npm:7.13.0":
version: 7.13.0
resolution: "@typescript-eslint/visitor-keys@npm:7.13.0"
"@typescript-eslint/visitor-keys@npm:7.13.1":
version: 7.13.1
resolution: "@typescript-eslint/visitor-keys@npm:7.13.1"
dependencies:
"@typescript-eslint/types": "npm:7.13.0"
"@typescript-eslint/types": "npm:7.13.1"
eslint-visitor-keys: "npm:^3.4.3"
checksum: 10c0/5daa45c3358aeab41495c4419cc26fbbe54a42bb18c6f0f70f0ac31cb7bc5890ec6478a1a6bb00b0b8522663fe5466ee0fd2972bd4235b07140918875797f4eb
checksum: 10c0/23c1bb896173cadfb33e3801420a70aa2f0481384caa3b534b04f7920acdb9d8f7d635fcaf1f8c7fc78ebce71b8f2435391608d120091761ad2e2c00eb870832
languageName: node
linkType: hard

Expand All @@ -1996,7 +1996,7 @@ __metadata:
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@types/babel__core": "npm:^7"
"@types/lodash-es": "npm:^4.17.12"
"@types/node": "npm:^20.14.2"
"@types/node": "npm:^20.14.6"
"@types/react": "npm:^18.3.3"
"@types/react-dom": "npm:^18.3.0"
"@types/react-router-dom": "npm:^5.3.3"
Expand All @@ -2021,7 +2021,7 @@ __metadata:
terser: "npm:^5.31.1"
typesafe-i18n: "npm:^5.26.2"
typescript: "npm:^5.4.5"
typescript-eslint: "npm:^7.13.0"
typescript-eslint: "npm:^7.13.1"
vite: "npm:^5.3.1"
vite-plugin-imagemin: "npm:^0.6.1"
vite-tsconfig-paths: "npm:^4.3.2"
Expand Down Expand Up @@ -7139,19 +7139,19 @@ __metadata:
languageName: node
linkType: hard

"typescript-eslint@npm:^7.13.0":
version: 7.13.0
resolution: "typescript-eslint@npm:7.13.0"
"typescript-eslint@npm:^7.13.1":
version: 7.13.1
resolution: "typescript-eslint@npm:7.13.1"
dependencies:
"@typescript-eslint/eslint-plugin": "npm:7.13.0"
"@typescript-eslint/parser": "npm:7.13.0"
"@typescript-eslint/utils": "npm:7.13.0"
"@typescript-eslint/eslint-plugin": "npm:7.13.1"
"@typescript-eslint/parser": "npm:7.13.1"
"@typescript-eslint/utils": "npm:7.13.1"
peerDependencies:
eslint: ^8.56.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/ad067868ede764d411f4933285faca0d41c7e3ca439d7aac032ed78db7703e9842f5bbad4344004fa876a3577cda3c56b0716897f94a0d1aec00a90d6c0d3990
checksum: 10c0/b929e865cdbf2b8b5dd417d40a6af2d76bb87a8ad3879dcde9a0f66b478906247ec3378aa7ab4c0659ddae73ba4bb15167053ff20a552e192f352797e94bee46
languageName: node
linkType: hard

Expand Down
2 changes: 0 additions & 2 deletions lib_standalone/emsuart_standalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,4 @@ char * EMSuart::hextoa(char * result, const uint8_t value) {

} // namespace emsesp

#pragma GCC diagnostic pop

#endif
1 change: 1 addition & 0 deletions mock-api/rest_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ let settings = {
shower_alert: true,
shower_alert_trigger: 7,
shower_alert_coldshot: 10,
shower_min_duration: 120,
rx_gpio: 23,
tx_gpio: 5,
phy_type: 0,
Expand Down
8 changes: 4 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extra_configs =
pio_local.ini

[common]
core_build_flags = -std=gnu++2a -Isrc -Wno-type-limits -Wall -Wextra -Wno-unused-parameter
core_build_flags = -std=gnu++2a -Isrc -Wno-type-limits -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-format
core_unbuild_flags = -std=gnu++11

; my_build_flags is set in pio_local.ini
Expand All @@ -38,7 +38,7 @@ unbuild_flags =
${common.core_unbuild_flags}

[espressi32_base]
platform = espressif32
platform = espressif32@6.7.0
framework = arduino
board_build.filesystem = littlefs
build_flags =
Expand All @@ -51,9 +51,9 @@ extra_scripts =
[espressi32_base_tasmota]
; use Tasmota's library which removes some unused libs (like mbedtsl, so no WiFi_secure.h) and increases available heap
; Tasmota Arduino Core 2.0.17 with IPv6 support, based on IDF 4.4.7
; platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.05.00/platform-espressif32.zip
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.05.00/platform-espressif32.zip
; Tasmota Arduino Core 3.0.1.240605 based on IDF v5.1.4.240602
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.10/platform-espressif32.zip
; platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.10/platform-espressif32.zip
framework = arduino
board_build.filesystem = littlefs
build_flags =
Expand Down
9 changes: 7 additions & 2 deletions scripts/run_sonar.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/sh
# This is an example file to run sonar from a Linux command line
#
# Make sure Sonar CLI is installed (https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/)
# Download Solar Scanner from https://github.com/SonarSource/sonar-scanner-cli/releases
# or https://binaries.sonarsource.com/?prefix=Distribution/sonar-scanner-cli/
#
# Run from the root of the project like `./scripts/run_sonar.sh`
# Follow the setup in Sonar for your prpject and make sure chmod 755 +x on all the files
# Follow the setup in Sonar for your project and make sure chmod 755 +x on all the files
# and make sure you set the token in the shell like export SONAR_TOKEN="xxxxx"

make clean
Expand All @@ -12,5 +17,5 @@ make clean
-Dsonar.projectKey=proddy_EMS-ESP32 \
-Dsonar.projectName=EMS-ESP32 \
-Dsonar.sources="./src, ./lib/framework" \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.cfamily.compile-commands=compile_commands.json \
-Dsonar.host.url=https://sonarcloud.io
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ sonar.projectKey=emsesp_EMS-ESP32
sonar.projectName=EMS-ESP32
sonar.projectVersion=3.7.0
sonar.sources=./src
sonar.cfamily.build-wrapper-output=bw-output
# sonar.cfamily.build-wrapper-output=bw-output
sonar.cfamily.compile-commands=compile_commands.json
sonar.sourceEncoding=UTF-8
sonar.host.url=https://sonarcloud.io
# sonar.cfamily.threads=4
4 changes: 4 additions & 0 deletions src/default_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
#define EMSESP_DEFAULT_SHOWER_ALERT_TRIGGER 7
#endif

#ifndef EMSESP_DEFAULT_SHOWER_MIN_DURATION
#define EMSESP_DEFAULT_SHOWER_MIN_DURATION 120
#endif

#ifndef EMSESP_DEFAULT_SHOWER_ALERT_COLDSHOT
#define EMSESP_DEFAULT_SHOWER_ALERT_COLDSHOT 10
#endif
Expand Down
Loading