mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-13 05:34:34 +00:00
auto-formatting
This commit is contained in:
+1
-2
@@ -677,7 +677,7 @@ void System::store_settings(WebSettings & settings) {
|
||||
locale_ = settings.locale;
|
||||
system_name_ = settings.system_name;
|
||||
developer_mode_ = settings.developer_mode;
|
||||
disable_reset_ = settings.disable_reset;
|
||||
disable_reset_ = settings.disable_reset;
|
||||
}
|
||||
|
||||
// Starts up core services
|
||||
@@ -2876,7 +2876,6 @@ bool System::command_txpause(const char * value, const int8_t id) {
|
||||
|
||||
// format command - factory reset, removing all config files
|
||||
bool System::command_format(const char * value, const int8_t id) {
|
||||
|
||||
if (EMSESP::system_.disable_reset()) {
|
||||
LOG_NOTICE("Factory reset disabled");
|
||||
return false;
|
||||
|
||||
@@ -417,10 +417,10 @@ std::string WebCustomEntityService::get_metrics_prometheus() {
|
||||
|
||||
// build the json for specific entity
|
||||
void WebCustomEntityService::get_value_json(JsonObject output, CustomEntityItem const & entity) {
|
||||
output["name"] = (const char *)entity.name;
|
||||
output["fullname"] = (const char *)entity.name;
|
||||
output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems";
|
||||
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
|
||||
output["name"] = (const char *)entity.name;
|
||||
output["fullname"] = (const char *)entity.name;
|
||||
output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems";
|
||||
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
|
||||
output["readable"] = true;
|
||||
output["writeable"] = entity.writeable;
|
||||
output["visible"] = true;
|
||||
|
||||
+11
-11
@@ -64,17 +64,17 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
|
||||
// list is already sorted by device type
|
||||
JsonArray devices = root["devices"].to<JsonArray>();
|
||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||
JsonObject obj = devices.add<JsonObject>();
|
||||
obj["id"] = emsdevice->unique_id(); // a unique id
|
||||
obj["tn"] = emsdevice->device_type_2_device_name_translated(); // translated device type name
|
||||
obj["t"] = emsdevice->device_type(); // device type number
|
||||
obj["b"] = emsdevice->brand_to_char(); // brand (std::string → copied into doc, safe across async serialize)
|
||||
obj["n"] = emsdevice->name(); // custom name
|
||||
obj["d"] = emsdevice->device_id(); // deviceid
|
||||
obj["p"] = emsdevice->product_id(); // productid
|
||||
obj["v"] = emsdevice->version(); // version
|
||||
obj["e"] = emsdevice->count_entities(); // number of entities
|
||||
obj["url"] = emsdevice->device_type_name(); // non-translated, lower-case, used for API URL in customization page
|
||||
JsonObject obj = devices.add<JsonObject>();
|
||||
obj["id"] = emsdevice->unique_id(); // a unique id
|
||||
obj["tn"] = emsdevice->device_type_2_device_name_translated(); // translated device type name
|
||||
obj["t"] = emsdevice->device_type(); // device type number
|
||||
obj["b"] = emsdevice->brand_to_char(); // brand (std::string → copied into doc, safe across async serialize)
|
||||
obj["n"] = emsdevice->name(); // custom name
|
||||
obj["d"] = emsdevice->device_id(); // deviceid
|
||||
obj["p"] = emsdevice->product_id(); // productid
|
||||
obj["v"] = emsdevice->version(); // version
|
||||
obj["e"] = emsdevice->count_entities(); // number of entities
|
||||
obj["url"] = emsdevice->device_type_name(); // non-translated, lower-case, used for API URL in customization page
|
||||
}
|
||||
|
||||
// add any custom entities
|
||||
|
||||
@@ -213,7 +213,7 @@ void WebSchedulerService::get_value_json(JsonObject output, const ScheduleItem &
|
||||
} else {
|
||||
output["time"] = scheduleItem.time;
|
||||
}
|
||||
output["cmd_name"] = scheduleItem.cmd_name;
|
||||
output["cmd_name"] = scheduleItem.cmd_name;
|
||||
output["readable"] = true;
|
||||
output["writeable"] = true;
|
||||
output["visible"] = true;
|
||||
|
||||
@@ -121,8 +121,8 @@ class WebSettings {
|
||||
uint8_t eth_clock_mode;
|
||||
|
||||
bool developer_mode; // developer mode
|
||||
bool disable_reset; // disable reset
|
||||
|
||||
bool disable_reset; // disable reset
|
||||
|
||||
static void read(WebSettings & settings, JsonObject root);
|
||||
static StateUpdateResult update(JsonObject root, WebSettings & settings);
|
||||
|
||||
|
||||
@@ -172,8 +172,8 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
||||
}
|
||||
|
||||
root["developer_mode"] = EMSESP::system_.developer_mode();
|
||||
root["disable_reset"] = EMSESP::system_.disable_reset();
|
||||
|
||||
root["disable_reset"] = EMSESP::system_.disable_reset();
|
||||
|
||||
// Also used in SystemMonitor.tsx
|
||||
root["status"] = EMSESP::system_.systemStatus(); // send the status. See System.h for status codes
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_PENDING_RESTART) {
|
||||
|
||||
Reference in New Issue
Block a user