This commit is contained in:
MichaelDvP
2024-06-20 21:49:00 +02:00
21 changed files with 122 additions and 20 deletions

View File

@@ -65,6 +65,14 @@
#define EMSESP_DEFAULT_BOILER_HEATINGOFF false
#endif
#ifndef EMSESP_DEFAULT_REMOTE_TIMEOUT
#define EMSESP_DEFAULT_REMOTE_TIMEOUT 24
#endif
#ifndef EMSESP_DEFAULT_REMOTE_TIMEOUT_EN
#define EMSESP_DEFAULT_REMOTE_TIMEOUT_EN false
#endif
#ifndef EMSESP_DEFAULT_SHOWER_TIMER
#define EMSESP_DEFAULT_SHOWER_TIMER false
#endif

View File

@@ -28,10 +28,14 @@ int16_t Roomctrl::remotetemp_[HCS] = {EMS_VALUE_INT16_NOTSET, EMS_VALUE_INT16
uint8_t Roomctrl::remotehum_[HCS] = {EMS_VALUE_UINT8_NOTSET, EMS_VALUE_UINT8_NOTSET, EMS_VALUE_UINT8_NOTSET, EMS_VALUE_UINT8_NOTSET};
uint8_t Roomctrl::sendtype_[HCS] = {SendType::TEMP, SendType::TEMP, SendType::TEMP, SendType::TEMP};
uint8_t Roomctrl::type_[HCS] = {RemoteType::NONE, RemoteType::NONE, RemoteType::NONE, RemoteType::NONE};
uint32_t Roomctrl::timeout_ = 0;
/**
* set the temperature,
*/
void Roomctrl::set_timeout(uint8_t t) {
timeout_ = t * 3600;
}
void Roomctrl::set_remotetemp(const uint8_t type, const uint8_t hc, const int16_t temp) {
if (!type_[hc] && !type) {
return;
@@ -96,7 +100,7 @@ void Roomctrl::send(uint8_t addr) {
return;
}
if (!switch_off_[hc] && (uuid::get_uptime() - receive_time_[hc]) > TIMEOUT) {
if (!switch_off_[hc] && timeout_ && (uuid::get_uptime() - receive_time_[hc]) > timeout_) {
remotetemp_[hc] = EMS_VALUE_INT16_NOTSET;
switch_off_[hc] = true;
sendtype_[hc] = SendType::TEMP;
@@ -366,6 +370,7 @@ void Roomctrl::ack_write() {
data[0] = TxService::TX_WRITE_SUCCESS;
EMSuart::transmit(data, 1);
}
void Roomctrl::replyF7(uint8_t addr, uint8_t dst, uint8_t offset, uint8_t typehh, uint8_t typeh, uint8_t typel, uint8_t hc) {
uint8_t data[12];
data[0] = addr | EMSbus::ems_mask();

View File

@@ -34,6 +34,7 @@ class Roomctrl {
static bool is_remote(const uint8_t hc) {
return (hc < 4 && remotetemp_[hc] != EMS_VALUE_INT16_NOTSET);
}
static void set_timeout(uint8_t t);
private:
static constexpr uint32_t SEND_INTERVAL = 15000; // 15 sec
@@ -59,6 +60,7 @@ class Roomctrl {
static uint8_t remotehum_[HCS];
static uint8_t sendtype_[HCS];
static uint8_t type_[HCS]; // type is product-id 113 for RC20 or 109 for Junkers FB10
static uint32_t timeout_;
};
} // namespace emsesp

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.0-test.15"
#define EMSESP_APP_VERSION "3.7.0-test.16"

View File

@@ -43,6 +43,8 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
root["syslog_host"] = settings.syslog_host;
root["syslog_port"] = settings.syslog_port;
root["boiler_heatingoff"] = settings.boiler_heatingoff;
root["remote_timeout"] = settings.remote_timeout;
root["remote_timeout_en"] = settings.remote_timeout_enabled;
root["shower_timer"] = settings.shower_timer;
root["shower_alert"] = settings.shower_alert;
root["shower_alert_coldshot"] = settings.shower_alert_coldshot;
@@ -238,7 +240,7 @@ 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;
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;
@@ -300,9 +302,12 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
settings.trace_raw = root["trace_raw"] | EMSESP_DEFAULT_TRACELOG_RAW;
EMSESP::trace_raw(settings.trace_raw);
settings.notoken_api = root["notoken_api"] | EMSESP_DEFAULT_NOTOKEN_API;
settings.solar_maxflow = root["solar_maxflow"] | EMSESP_DEFAULT_SOLAR_MAXFLOW;
settings.boiler_heatingoff = root["boiler_heatingoff"] | EMSESP_DEFAULT_BOILER_HEATINGOFF;
settings.notoken_api = root["notoken_api"] | EMSESP_DEFAULT_NOTOKEN_API;
settings.solar_maxflow = root["solar_maxflow"] | EMSESP_DEFAULT_SOLAR_MAXFLOW;
settings.boiler_heatingoff = root["boiler_heatingoff"] | EMSESP_DEFAULT_BOILER_HEATINGOFF;
settings.remote_timeout = root["remote_timeout"] | EMSESP_DEFAULT_REMOTE_TIMEOUT;
settings.remote_timeout_enabled = root["remote_timeout_en"] | EMSESP_DEFAULT_REMOTE_TIMEOUT_EN;
emsesp::Roomctrl::set_timeout(settings.remote_timeout_enabled ? settings.remote_timeout : 0);
settings.fahrenheit = root["fahrenheit"];
EMSESP::system_.fahrenheit(settings.fahrenheit);

View File

@@ -34,11 +34,13 @@ class WebSettings {
uint8_t tx_mode;
uint8_t ems_bus_id;
bool boiler_heatingoff;
uint8_t remote_timeout;
bool remote_timeout_enabled;
bool shower_timer;
bool shower_alert;
uint8_t shower_alert_trigger; // minutes
uint8_t shower_alert_trigger; // minutes
uint8_t shower_alert_coldshot; // seconds
uint32_t shower_min_duration; // seconds
uint32_t shower_min_duration; // seconds
bool syslog_enabled;
int8_t syslog_level; // uuid::log::Level
uint32_t syslog_mark_interval;