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