Merge pull request #1807 from proddy/dev

#1801 shower_duration_min
This commit is contained in:
Proddy
2024-06-20 08:17:16 +01:00
committed by GitHub
18 changed files with 146 additions and 98 deletions

View File

@@ -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)]

View File

@@ -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",
@@ -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"

View File

@@ -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}>

View File

@@ -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;

View File

@@ -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: [
{

View File

@@ -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
@@ -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"
@@ -1879,44 +1879,44 @@ __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:
@@ -1924,23 +1924,23 @@ __metadata:
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"
@@ -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
@@ -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"
@@ -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"
@@ -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

View File

@@ -84,6 +84,4 @@ char * EMSuart::hextoa(char * result, const uint8_t value) {
} // namespace emsesp
#pragma GCC diagnostic pop
#endif

View File

@@ -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,

View File

@@ -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
@@ -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 =
@@ -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 =

View File

@@ -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
@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -28,8 +28,9 @@ void Shower::start() {
EMSESP::webSettingsService.read([&](WebSettings & settings) {
shower_timer_ = settings.shower_timer;
shower_alert_ = settings.shower_alert;
shower_alert_trigger_ = settings.shower_alert_trigger * 60000; // convert from minutes
shower_alert_coldshot_ = settings.shower_alert_coldshot * 1000; // convert from seconds
shower_alert_trigger_ = settings.shower_alert_trigger * 60; // convert from minutes to seconds
shower_alert_coldshot_ = settings.shower_alert_coldshot; // in seconds
shower_min_duration_ = settings.shower_min_duration; // in seconds
});
Command::add(
@@ -60,7 +61,8 @@ void Shower::loop() {
return;
}
uint32_t time_now = uuid::get_uptime();
// uint32_t time_now = uuid::get_uptime(); // in ms
auto time_now = uuid::get_uptime_sec(); // in sec
// if already in cold mode, ignore all this logic until we're out of the cold blast
if (!doing_cold_shot_) {
@@ -78,7 +80,7 @@ void Shower::loop() {
} else {
// hot water has been on for a while
// 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) {
if (!shower_state_ && (time_now - timer_start_) > shower_min_duration_) {
set_shower_state(true);
LOG_DEBUG("hot water still running, starting shower timer");
}
@@ -99,7 +101,7 @@ void Shower::loop() {
// because its unsigned long, can't have negative so check if length is less than OFFSET_TIME
if ((timer_pause_ - timer_start_) > SHOWER_OFFSET_TIME) {
duration_ = (timer_pause_ - timer_start_ - SHOWER_OFFSET_TIME);
if (duration_ > SHOWER_MIN_DURATION) {
if (duration_ > shower_min_duration_) {
JsonDocument doc;
// duration in seconds
@@ -145,7 +147,7 @@ void Shower::shower_alert_start() {
(void)Command::call(EMSdevice::DeviceType::BOILER, "tapactivated", "false", 9);
doing_cold_shot_ = true;
force_coldshot = false;
alert_timer_start_ = uuid::get_uptime(); // timer starts now
alert_timer_start_ = uuid::get_uptime_sec(); // timer starts now
}
// turn back on the hot water for the shower

View File

@@ -36,11 +36,8 @@ class Shower {
private:
static uuid::log::Logger logger_;
static constexpr uint32_t SHOWER_PAUSE_TIME = 15000; // in ms. 15 seconds, max time if water is switched off & on during a shower
static constexpr uint32_t SHOWER_MIN_DURATION = 120000; // in ms. 2 minutes, before recognizing its a shower
// static constexpr uint32_t SHOWER_MIN_DURATION = 5000; // for testing in ms. 5 seconds
static constexpr uint32_t SHOWER_OFFSET_TIME = 5000; // in ms. 5 seconds grace time, to calibrate actual time under the shower
static constexpr uint32_t SHOWER_PAUSE_TIME = 15; // 15 seconds, max time if water is switched off & on during a shower
static constexpr uint32_t SHOWER_OFFSET_TIME = 5; // 5 seconds grace time, to calibrate actual time under the shower
void shower_alert_start();
void shower_alert_stop();
@@ -49,15 +46,17 @@ class Shower {
bool shower_alert_; // true if we want the alert of cold water
uint32_t shower_alert_trigger_; // default 7 minutes, before trigger a shot of cold water
uint32_t shower_alert_coldshot_; // default 10 seconds for cold water before turning back hot water
uint32_t shower_min_duration_; // default 2 minutes (120 seconds), before recognizing its a shower
uint32_t next_alert_;
bool ha_configdone_ = false; // for HA MQTT Discovery
bool shower_state_;
uint32_t timer_start_; // ms
uint32_t timer_pause_; // ms
uint32_t duration_; // ms
uint32_t timer_start_; // sec
uint32_t timer_pause_; // sec
uint32_t duration_; // sec
// cold shot
uint32_t alert_timer_start_; // ms
uint32_t alert_timer_start_; // sec
bool doing_cold_shot_; // true if we've just sent a jolt of cold water
};

View File

@@ -1454,6 +1454,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node["ems bus id"] = settings.ems_bus_id;
node["shower timer"] = settings.shower_timer;
node["shower alert"] = settings.shower_alert;
node["shpwe_min_duration"] = settings.shower_min_duration; // seconds
if (settings.shower_alert) {
node["shower alert coldshot"] = settings.shower_alert_coldshot; // seconds
node["shower alert trigger"] = settings.shower_alert_trigger; // minutes

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.0-dev.14"
#define EMSESP_APP_VERSION "3.7.0-dev.15"

View File

@@ -47,6 +47,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
root["shower_alert"] = settings.shower_alert;
root["shower_alert_coldshot"] = settings.shower_alert_coldshot;
root["shower_alert_trigger"] = settings.shower_alert_trigger;
root["shower_min_duration"] = settings.shower_min_duration;
root["rx_gpio"] = settings.rx_gpio;
root["tx_gpio"] = settings.tx_gpio;
root["dallas_gpio"] = settings.dallas_gpio;
@@ -237,6 +238,9 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
prev = settings.shower_alert_trigger;
settings.shower_alert_trigger = root["shower_alert_trigger"] | EMSESP_DEFAULT_SHOWER_ALERT_TRIGGER;
check_flag(prev, settings.shower_alert_trigger, ChangeFlags::SHOWER);
prev = settings.shower_min_duration;
settings.shower_min_duration = root["shower_min_duration"] | EMSESP_DEFAULT_SHOWER_MIN_DURATION;
check_flag(prev, settings.shower_min_duration, ChangeFlags::SHOWER);
prev = settings.shower_alert_coldshot;
settings.shower_alert_coldshot = root["shower_alert_coldshot"] | EMSESP_DEFAULT_SHOWER_ALERT_COLDSHOT;
check_flag(prev, settings.shower_alert_coldshot, ChangeFlags::SHOWER);

View File

@@ -36,8 +36,9 @@ class WebSettings {
bool boiler_heatingoff;
bool shower_timer;
bool shower_alert;
uint8_t shower_alert_trigger;
uint8_t shower_alert_coldshot;
uint8_t shower_alert_trigger; // minutes
uint8_t shower_alert_coldshot; // seconds
uint32_t shower_min_duration; // seconds
bool syslog_enabled;
int8_t syslog_level; // uuid::log::Level
uint32_t syslog_mark_interval;