mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
re-enable shower alert
This commit is contained in:
@@ -8,5 +8,6 @@
|
||||
- Icon for Network
|
||||
- MQTT Formatting payload (nested vs single) is a pull-down option
|
||||
- moved mqtt-topics and texts to local_EN, all topics lower case
|
||||
- Re-enabled Shower Alert (still experimental)
|
||||
|
||||
## Removed
|
||||
|
||||
@@ -86,9 +86,16 @@ void Shower::loop() {
|
||||
timer_start_ = 0;
|
||||
timer_pause_ = 0;
|
||||
shower_on_ = false;
|
||||
shower_alert_stop();
|
||||
doing_cold_shot_ = false;
|
||||
alert_timer_start_ = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// at this point we're in the shower cold shot (doing_cold_shot_ == true)
|
||||
// keep repeating until the time is up
|
||||
if ((time_now - alert_timer_start_) > SHOWER_COLDSHOT_DURATION) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,20 +131,17 @@ void Shower::send_mqtt_stat(bool state, bool force) {
|
||||
void Shower::shower_alert_stop() {
|
||||
if (doing_cold_shot_) {
|
||||
LOG_DEBUG(F("Shower Alert stopped"));
|
||||
// Boiler::set_tapwarmwater_activated(true);
|
||||
Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "true");
|
||||
doing_cold_shot_ = false;
|
||||
// showerColdShotStopTimer.detach(); // disable the timer
|
||||
}
|
||||
}
|
||||
|
||||
// turn off hot water to send a shot of cold
|
||||
void Shower::shower_alert_start() {
|
||||
if (shower_alert_) {
|
||||
LOG_DEBUG(F("Shower Alert started!"));
|
||||
// Boiler::set_tapwarmwater_activated(false);
|
||||
LOG_DEBUG(F("Shower Alert started"));
|
||||
Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "false");
|
||||
doing_cold_shot_ = true;
|
||||
// start the timer for n seconds which will reset the water back to hot
|
||||
// showerColdShotStopTimer.attach(SHOWER_COLDSHOT_DURATION, _showerColdShotStop);
|
||||
alert_timer_start_ = uuid::get_uptime(); // timer starts now
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class Shower {
|
||||
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_OFFSET_TIME = 5000; // in ms. 5 seconds grace time, to calibrate actual time under the shower
|
||||
static constexpr uint32_t SHOWER_COLDSHOT_DURATION = 10; // in seconds. 10 seconds for cold water before turning back hot water
|
||||
static constexpr uint32_t SHOWER_COLDSHOT_DURATION = 10000; // 10 seconds for cold water before turning back hot water
|
||||
static constexpr uint32_t SHOWER_MAX_DURATION = 420000; // in ms. 7 minutes, before trigger a shot of cold water
|
||||
|
||||
void publish_values();
|
||||
@@ -66,6 +66,9 @@ class Shower {
|
||||
uint32_t timer_start_; // ms
|
||||
uint32_t timer_pause_; // ms
|
||||
uint32_t duration_; // ms
|
||||
|
||||
// cold shot
|
||||
uint32_t alert_timer_start_; // ms
|
||||
bool doing_cold_shot_; // true if we've just sent a jolt of cold water
|
||||
};
|
||||
|
||||
|
||||
@@ -399,6 +399,17 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
|
||||
shell.invoke_command("show mqtt");
|
||||
}
|
||||
|
||||
if (command == "shower_alert") {
|
||||
shell.printfln(F("Testing Shower Alert..."));
|
||||
|
||||
run_test("boiler");
|
||||
|
||||
DynamicJsonDocument doc(EMSESP_JSON_SIZE_LARGE_DYN);
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
// device type, command, data
|
||||
Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "false");
|
||||
}
|
||||
|
||||
if (command == "fr120") {
|
||||
shell.printfln(F("Testing adding a thermostat FR120..."));
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ namespace emsesp {
|
||||
// #define EMSESP_DEBUG_DEFAULT "mqtt2"
|
||||
// #define EMSESP_DEBUG_DEFAULT "mqtt_nested"
|
||||
// #define EMSESP_DEBUG_DEFAULT "ha"
|
||||
#define EMSESP_DEBUG_DEFAULT "board_profile"
|
||||
// #define EMSESP_DEBUG_DEFAULT "board_profile"
|
||||
#define EMSESP_DEBUG_DEFAULT "shower_alert"
|
||||
|
||||
|
||||
class Test {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user