mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-28 17:49:08 +03:00
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev
This commit is contained in:
@@ -148,8 +148,8 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
const char * device_p = device_s;
|
||||
const char * data_p = nullptr;
|
||||
strlcpy(device_s, d, device_end - d + 1);
|
||||
data_p = device_end + 1;
|
||||
int8_t id_d = -1;
|
||||
data_p = device_end + 1;
|
||||
int8_t id_d = -1;
|
||||
uint8_t device_type = EMSdevice::device_name_2_device_type(device_p);
|
||||
if (device_type > EMSdevice::DeviceType::BOILER) {
|
||||
data_p = parse_command_string(data_p, id_d);
|
||||
|
||||
@@ -1601,7 +1601,7 @@ void EMSESP::start() {
|
||||
// start the file system
|
||||
#ifndef EMSESP_STANDALONE
|
||||
if (!LittleFS.begin(true)) {
|
||||
Serial.println("LittleFS Mount Failed. Using default settings.");
|
||||
LOG_INFO("LittleFS Mount Failed. Using default settings.");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1612,9 +1612,7 @@ void EMSESP::start() {
|
||||
File root = LittleFS.open("/config");
|
||||
bool factory_settings = !root;
|
||||
if (!root) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
Serial.println("No config found, assuming factory settings");
|
||||
#endif
|
||||
LOG_INFO("No config found, assuming factory settings");
|
||||
}
|
||||
root.close();
|
||||
#else
|
||||
@@ -1644,8 +1642,6 @@ void EMSESP::start() {
|
||||
system_.system_restart();
|
||||
};
|
||||
|
||||
|
||||
|
||||
webSettingsService.begin(); // load EMS-ESP Application settings...
|
||||
|
||||
// do any system upgrades
|
||||
|
||||
@@ -411,7 +411,8 @@ uint32_t Helpers::hextoint(const char * hex) {
|
||||
// get current character then increment
|
||||
char byte = *hex++;
|
||||
// transform hex character to the 4bit equivalent number, using the ascii table indexes
|
||||
if (byte == ' ') byte = *hex++; // skip spaces
|
||||
if (byte == ' ')
|
||||
byte = *hex++; // skip spaces
|
||||
if (byte >= '0' && byte <= '9')
|
||||
byte = byte - '0';
|
||||
else if (byte >= 'a' && byte <= 'f')
|
||||
|
||||
@@ -1170,7 +1170,7 @@ bool System::check_upgrade(bool factory_settings) {
|
||||
// see if we're missing a version, will be < 3.5.0b13 from Dec 23 2022
|
||||
missing_version = (settingsVersion.empty() || (settingsVersion.length() < 5));
|
||||
if (missing_version) {
|
||||
LOG_WARNING("No version information found (%s)", settingsVersion.c_str());
|
||||
LOG_WARNING("No version information found");
|
||||
settingsVersion = "3.5.0"; // this was the last stable version without version info
|
||||
}
|
||||
}
|
||||
@@ -1200,13 +1200,13 @@ bool System::check_upgrade(bool factory_settings) {
|
||||
|
||||
// if we're coming from 3.4.4 or 3.5.0b14 which had no version stored then we need to apply new settings
|
||||
if (missing_version) {
|
||||
LOG_INFO("Setting MQTT Entity ID format to v3.4 format");
|
||||
LOG_INFO("Upgrade: Setting MQTT Entity ID format to v3.4 format");
|
||||
EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) {
|
||||
mqttSettings.entity_format = 0; // use old Entity ID format from v3.4
|
||||
return StateUpdateResult::CHANGED;
|
||||
});
|
||||
} else if (settings_version.major() == 3 && settings_version.minor() <= 6) {
|
||||
LOG_INFO("Setting MQTT Entity ID format to v3.6 format");
|
||||
LOG_INFO("Upgrade: Setting MQTT Entity ID format to v3.6 format");
|
||||
EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) {
|
||||
if (mqttSettings.entity_format == 1) {
|
||||
mqttSettings.entity_format = 3; // use old Entity ID format from v3.6
|
||||
@@ -1223,7 +1223,7 @@ bool System::check_upgrade(bool factory_settings) {
|
||||
EMSESP::esp8266React.getNetworkSettingsService()->update([&](NetworkSettings & networkSettings) {
|
||||
if (networkSettings.tx_power == 20) {
|
||||
networkSettings.tx_power = WIFI_POWER_19_5dBm; // use 19.5 as we don't have 20 anymore
|
||||
LOG_INFO("Setting WiFi TX Power to Auto");
|
||||
LOG_INFO("Upgrade: Setting WiFi TX Power to Auto");
|
||||
return StateUpdateResult::CHANGED;
|
||||
}
|
||||
return StateUpdateResult::UNCHANGED;
|
||||
@@ -1237,7 +1237,7 @@ bool System::check_upgrade(bool factory_settings) {
|
||||
save_version = false;
|
||||
}
|
||||
|
||||
// if we did a change, set the new version and reboot
|
||||
// if we did a change, set the new version and save it, then reboot
|
||||
if (save_version) {
|
||||
EMSESP::webSettingsService.update([&](WebSettings & settings) {
|
||||
settings.version = EMSESP_APP_VERSION;
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.7.0-dev.27"
|
||||
#define EMSESP_APP_VERSION "3.7.0-dev.28"
|
||||
|
||||
@@ -198,7 +198,7 @@ bool WebSchedulerService::get_value_info(JsonObject output, const char * cmd) {
|
||||
output["onchange"] = scheduleItem.time;
|
||||
} else if (scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_TIMER) {
|
||||
output["timer"] = scheduleItem.time;
|
||||
} else if (scheduleItem.flags != 0){
|
||||
} else if (scheduleItem.flags != 0) {
|
||||
output["time"] = scheduleItem.time;
|
||||
}
|
||||
output["command"] = scheduleItem.cmd;
|
||||
@@ -489,7 +489,7 @@ void WebSchedulerService::loop() {
|
||||
}
|
||||
|
||||
for (ScheduleItem & scheduleItem : *scheduleItems_) {
|
||||
if (scheduleItem.active && scheduleItem.flags == 0) {
|
||||
if (scheduleItem.active && scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_IMMEDIATE) {
|
||||
command(scheduleItem.name.c_str(), scheduleItem.cmd, compute(scheduleItem.value));
|
||||
scheduleItem.active = false;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,18 @@
|
||||
#define EMSESP_SCHEDULER_FILE "/config/emsespScheduler.json"
|
||||
#define EMSESP_SCHEDULER_SERVICE_PATH "/rest/schedule" // GET and POST
|
||||
|
||||
// bit flags for the schedule items. Matches those in interface/src/app/main/SchedulerDialog.tsx
|
||||
// 0-127 (0->0x7F) is day schedule
|
||||
// 128/0x80 is timer
|
||||
// 129/0x81 is on change
|
||||
// 130/0x82 is on condition
|
||||
// 132/0x84 is immediate
|
||||
#define SCHEDULEFLAG_SCHEDULE_TIMER 0x80 // 7th bit for Timer
|
||||
#define SCHEDULEFLAG_SCHEDULE_ONCHANGE 0x81 // 7th+1st bit for OnChange
|
||||
#define SCHEDULEFLAG_SCHEDULE_CONDITION 0x82 // 7th+2nd bit for Condition
|
||||
#define MAX_STARTUP_RETRIES 3 // retry the start-up commands x times
|
||||
#define SCHEDULEFLAG_SCHEDULE_IMMEDIATE 0x84 // 7th+3rd bit for Condition
|
||||
|
||||
#define MAX_STARTUP_RETRIES 3 // retry the start-up commands x times
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ WebSettingsService::WebSettingsService(AsyncWebServer * server, FS * fs, Securit
|
||||
}
|
||||
|
||||
void WebSettings::read(WebSettings & settings, JsonObject root) {
|
||||
root["version"] = settings.version;
|
||||
root["locale"] = settings.locale;
|
||||
root["tx_mode"] = settings.tx_mode;
|
||||
root["ems_bus_id"] = settings.ems_bus_id;
|
||||
|
||||
Reference in New Issue
Block a user