mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
add system commands showertimer, showeralert #2168
This commit is contained in:
@@ -48,6 +48,8 @@ MAKE_WORD(send)
|
|||||||
MAKE_WORD(telegram)
|
MAKE_WORD(telegram)
|
||||||
MAKE_WORD(bus_id)
|
MAKE_WORD(bus_id)
|
||||||
MAKE_WORD(tx_mode)
|
MAKE_WORD(tx_mode)
|
||||||
|
MAKE_WORD(showertimer)
|
||||||
|
MAKE_WORD(showeralert)
|
||||||
MAKE_WORD(ems)
|
MAKE_WORD(ems)
|
||||||
MAKE_WORD(devices)
|
MAKE_WORD(devices)
|
||||||
MAKE_WORD(shower)
|
MAKE_WORD(shower)
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ MAKE_WORD_TRANSLATION(commands_response, "get response", "Hole Antwort", "Verzoe
|
|||||||
MAKE_WORD_TRANSLATION(coldshot_cmd, "send a cold shot of water", "Zugabe einer Menge kalten Wassers", "", "", "uruchom tryśnięcie zimnej wody", "", "", "soğuk su gönder", "", "pošlite studenú dávku vody", "poslat studenou vodu") // TODO translate
|
MAKE_WORD_TRANSLATION(coldshot_cmd, "send a cold shot of water", "Zugabe einer Menge kalten Wassers", "", "", "uruchom tryśnięcie zimnej wody", "", "", "soğuk su gönder", "", "pošlite studenú dávku vody", "poslat studenou vodu") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(message_cmd, "send a message", "Eine Nachricht senden", "", "", "", "", "", "", "", "poslať správu", "odeslat zprávu") // TODO translate
|
MAKE_WORD_TRANSLATION(message_cmd, "send a message", "Eine Nachricht senden", "", "", "", "", "", "", "", "poslať správu", "odeslat zprávu") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(values_cmd, "list all values", "Liste alle Werte auf", "", "", "", "", "", "", "", "vypísať všetky hodnoty", "vypsat všechny hodnoty") // TODO translate
|
MAKE_WORD_TRANSLATION(values_cmd, "list all values", "Liste alle Werte auf", "", "", "", "", "", "", "", "vypísať všetky hodnoty", "vypsat všechny hodnoty") // TODO translate
|
||||||
|
MAKE_WORD_TRANSLATION(showertimer_cmd, "enable shower timer", "aktiviere Duschzeitmessung", "", "", "", "", "", "", "", "", "") // TODO translate
|
||||||
|
MAKE_WORD_TRANSLATION(showeralert_cmd, "enable shower alert", "aktiviere Duschzeitwarnung", "", "", "", "", "", "", "", "", "") // TODO translate
|
||||||
|
|
||||||
// tags
|
// tags
|
||||||
MAKE_WORD_TRANSLATION(tag_hc1, "hc1", "HK1", "hc1", "VK1", "OG1", "hc1", "hc1", "ID1", "hc1", "hc1", "hc1")
|
MAKE_WORD_TRANSLATION(tag_hc1, "hc1", "HK1", "hc1", "VK1", "OG1", "hc1", "hc1", "ID1", "hc1", "hc1", "hc1")
|
||||||
|
|||||||
@@ -196,6 +196,37 @@ bool System::command_syslog_level(const char * value, const int8_t id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
// shower timer
|
||||||
|
bool System::command_showertimer(const char * value, const int8_t id) {
|
||||||
|
bool b;
|
||||||
|
if (Helpers::value2bool(value, b)) {
|
||||||
|
EMSESP::webSettingsService.update([&](WebSettings & settings) {
|
||||||
|
if (settings.shower_timer != b) {
|
||||||
|
settings.shower_timer = b;
|
||||||
|
return StateUpdateResult::CHANGED;
|
||||||
|
}
|
||||||
|
return StateUpdateResult::UNCHANGED;
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// shower alert
|
||||||
|
bool System::command_showeralert(const char * value, const int8_t id) {
|
||||||
|
bool b;
|
||||||
|
if (Helpers::value2bool(value, b)) {
|
||||||
|
EMSESP::webSettingsService.update([&](WebSettings & settings) {
|
||||||
|
if (settings.shower_alert != b) {
|
||||||
|
settings.shower_alert = b;
|
||||||
|
return StateUpdateResult::CHANGED;
|
||||||
|
}
|
||||||
|
return StateUpdateResult::UNCHANGED;
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// send message - to log and MQTT
|
// send message - to log and MQTT
|
||||||
bool System::command_message(const char * value, const int8_t id) {
|
bool System::command_message(const char * value, const int8_t id) {
|
||||||
@@ -860,6 +891,8 @@ void System::commands_init() {
|
|||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(format), System::command_format, FL_(format_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(format), System::command_format, FL_(format_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, FL_(watch_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, FL_(watch_cmd));
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(message), System::command_message, FL_(message_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(message), System::command_message, FL_(message_cmd));
|
||||||
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(showertimer), System::command_showertimer, FL_(showertimer_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(showeralert), System::command_showeralert, FL_(showeralert_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
#if defined(EMSESP_TEST)
|
#if defined(EMSESP_TEST)
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), System::command_test, FL_(test_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), System::command_test, FL_(test_cmd));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ class System {
|
|||||||
static bool command_fetch(const char * value, const int8_t id);
|
static bool command_fetch(const char * value, const int8_t id);
|
||||||
static bool command_restart(const char * value, const int8_t id);
|
static bool command_restart(const char * value, const int8_t id);
|
||||||
static bool command_format(const char * value, const int8_t id);
|
static bool command_format(const char * value, const int8_t id);
|
||||||
|
static bool command_showertimer(const char * value, const int8_t id);
|
||||||
|
static bool command_showeralert(const char * value, const int8_t id);
|
||||||
static bool command_watch(const char * value, const int8_t id);
|
static bool command_watch(const char * value, const int8_t id);
|
||||||
static bool command_message(const char * value, const int8_t id);
|
static bool command_message(const char * value, const int8_t id);
|
||||||
static bool command_info(const char * value, const int8_t id, JsonObject output);
|
static bool command_info(const char * value, const int8_t id, JsonObject output);
|
||||||
|
|||||||
Reference in New Issue
Block a user