mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-09 18:19:36 +00:00
Merge pull request #3113 from MichaelDvP/core3
merge dev changes into Core3
This commit is contained in:
@@ -1841,16 +1841,9 @@ void EMSESP::loop() {
|
||||
webLogService.loop(); // log in Web UI
|
||||
|
||||
// run the loop, unless we're in the middle of an OTA upload
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_NORMAL || EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_INVALID_GPIO) {
|
||||
// check for GPIO Errors - this is called once when booting
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_INVALID_GPIO) {
|
||||
static bool only_once = false;
|
||||
if (!only_once) {
|
||||
LOG_ERROR("Invalid GPIOs used. Please check your settings and the system log");
|
||||
only_once = true;
|
||||
}
|
||||
}
|
||||
|
||||
// if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_NORMAL || EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_INVALID_GPIO) {
|
||||
if (EMSESP::system_.systemStatus() != SYSTEM_STATUS::SYSTEM_STATUS_PENDING_UPLOAD
|
||||
&& EMSESP::system_.systemStatus() != SYSTEM_STATUS::SYSTEM_STATUS_UPLOADING) {
|
||||
// loop through the services
|
||||
webStatusService.loop(); // periodic refresh of cached versions.json
|
||||
rxservice_.loop(); // process any incoming Rx telegrams
|
||||
@@ -1865,6 +1858,14 @@ void EMSESP::loop() {
|
||||
}
|
||||
scheduled_fetch_values(); // force a query on the EMS devices to fetch latest data at a set interval (1 min)
|
||||
}
|
||||
// check for GPIO Errors - this is called once when booting
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_INVALID_GPIO) {
|
||||
static bool only_once = false;
|
||||
if (!only_once) {
|
||||
LOG_ERROR("Invalid GPIOs used. Please check your settings and the system log");
|
||||
only_once = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_PENDING_UPLOAD) {
|
||||
// start an upload from a URL, assuming the URL exists and set from a previous pass
|
||||
@@ -1877,6 +1878,17 @@ void EMSESP::loop() {
|
||||
}
|
||||
}
|
||||
|
||||
// reset status after 5 Minutes
|
||||
if (EMSESP::system_.systemStatus() != SYSTEM_STATUS::SYSTEM_STATUS_NORMAL) {
|
||||
static uint32_t starttime = 0;
|
||||
if (starttime == 0) {
|
||||
starttime = uuid::get_uptime_ms();
|
||||
} else if (uuid::get_uptime_ms() - starttime > 300000) {
|
||||
starttime = 0;
|
||||
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
// telnet service
|
||||
#ifndef EMSESP_STANDALONE
|
||||
if (system_.telnet_enabled()) {
|
||||
|
||||
@@ -4195,7 +4195,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
|
||||
if (model == EMSdevice::EMS_DEVICE_FLAG_CR120 && mode_ == HeatingCircuit::Mode::MANUAL) {
|
||||
offset = 22; // manual offset CR120
|
||||
} else if (mode_ == HeatingCircuit::Mode::MANUAL) {
|
||||
offset = 10; // manual offset
|
||||
offset = hc->hpoperatingstate == 2 ? 17 : 10; // cooling or manual offset
|
||||
} else {
|
||||
offset = 8; // auto offset
|
||||
// special case to reactivate auto temperature, see #737, #746
|
||||
|
||||
@@ -76,13 +76,15 @@ StateUpdateResult WebScheduler::update(JsonObject root, WebScheduler & webSchedu
|
||||
for (ScheduleItem & scheduleItem : webScheduler.scheduleItems) {
|
||||
char key[sizeof(scheduleItem.name) + 2];
|
||||
snprintf(key, sizeof(key), "s:%s", scheduleItem.name);
|
||||
EMSESP::nvs_.remove(key);
|
||||
if (EMSESP::nvs_.isKey(key)) {
|
||||
EMSESP::nvs_.remove(key);
|
||||
}
|
||||
}
|
||||
webScheduler.scheduleItems.clear();
|
||||
EMSESP::webSchedulerService.ha_reset();
|
||||
|
||||
// build up the list of schedule items
|
||||
auto scheduleItems = root["schedule"].as<JsonArray>();
|
||||
auto scheduleItems = root["schedule"].as<JsonArray>();
|
||||
for (const JsonObject schedule : scheduleItems) {
|
||||
// create each schedule item, overwriting any previous settings
|
||||
// ignore the id (as this is only used in the web for table rendering)
|
||||
@@ -491,7 +493,7 @@ void WebSchedulerService::loop() {
|
||||
for (ScheduleItem & scheduleItem : *scheduleItems_) {
|
||||
if (scheduleItem.active && scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_IMMEDIATE) {
|
||||
command(scheduleItem.name, scheduleItem.cmd.c_str(), compute_cmd_value(scheduleItem.cmd, scheduleItem.value));
|
||||
// scheduleItem.active = false;
|
||||
scheduleItem.active = false;
|
||||
publish_single(scheduleItem.name, false);
|
||||
if (EMSESP::mqtt_.get_publish_onchange(0)) {
|
||||
publish();
|
||||
|
||||
@@ -179,6 +179,10 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
||||
// we're ready to do the actual restart ASAP
|
||||
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_RESTART_REQUESTED);
|
||||
}
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_ERROR_UPLOAD) {
|
||||
// error is reported, back to normal state
|
||||
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_NORMAL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user