mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-15 12:26:33 +03:00
formatting
This commit is contained in:
@@ -174,10 +174,10 @@ class AnalogSensor {
|
|||||||
return sensors_.size();
|
return sensors_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool update(uint8_t gpio, const char * name, double offset, double factor, uint8_t uom, int8_t type, bool deleted, bool is_system);
|
bool update(uint8_t gpio, const char * name, double offset, double factor, uint8_t uom, int8_t type, bool deleted, bool is_system);
|
||||||
bool get_value_info(JsonObject output, const char * cmd, const int8_t id = -1);
|
bool get_value_info(JsonObject output, const char * cmd, const int8_t id = -1);
|
||||||
void store_counters();
|
void store_counters();
|
||||||
std::string get_metrics_prometheus();
|
std::string get_metrics_prometheus();
|
||||||
static const std::vector<uint8_t> & exclude_types() {
|
static const std::vector<uint8_t> & exclude_types() {
|
||||||
return exclude_types_;
|
return exclude_types_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,34 +49,34 @@ class DeviceValue {
|
|||||||
// also used with HA as uom
|
// also used with HA as uom
|
||||||
// shows also the HA device class being used
|
// shows also the HA device class being used
|
||||||
enum DeviceValueUOM : uint8_t {
|
enum DeviceValueUOM : uint8_t {
|
||||||
NONE = 0, // 0
|
NONE = 0, // 0
|
||||||
DEGREES, // 1 - °C - temperature
|
DEGREES, // 1 - °C - temperature
|
||||||
DEGREES_R, // 2 - °C (relative temperature) - temperature
|
DEGREES_R, // 2 - °C (relative temperature) - temperature
|
||||||
PERCENT, // 3 - % - power factor
|
PERCENT, // 3 - % - power factor
|
||||||
LMIN, // 4 - l/min - volume flow rate
|
LMIN, // 4 - l/min - volume flow rate
|
||||||
KWH, // 5 - kWh - energy
|
KWH, // 5 - kWh - energy
|
||||||
WH, // 6 - Wh - energy
|
WH, // 6 - Wh - energy
|
||||||
HOURS, // 7 - h - duration
|
HOURS, // 7 - h - duration
|
||||||
MINUTES, // 8 - m - duration
|
MINUTES, // 8 - m - duration
|
||||||
UA, // 9 - µA - current
|
UA, // 9 - µA - current
|
||||||
BAR, // 10 - bar - pressure
|
BAR, // 10 - bar - pressure
|
||||||
KW, // 11 - kW - power
|
KW, // 11 - kW - power
|
||||||
W, // 12 - W - power
|
W, // 12 - W - power
|
||||||
KB, // 13 - kB - data size
|
KB, // 13 - kB - data size
|
||||||
SECONDS, // 14 - s - duration
|
SECONDS, // 14 - s - duration
|
||||||
DBM, // 15 - dBm - signal strength
|
DBM, // 15 - dBm - signal strength
|
||||||
FAHRENHEIT, // 16 - °F - temperature
|
FAHRENHEIT, // 16 - °F - temperature
|
||||||
MV, // 17 - mV - voltage
|
MV, // 17 - mV - voltage
|
||||||
SQM, // 18 - m² - area
|
SQM, // 18 - m² - area
|
||||||
M3, // 19 - m³ - volume
|
M3, // 19 - m³ - volume
|
||||||
L, // 20 - L - volume
|
L, // 20 - L - volume
|
||||||
KMIN, // 21 - K*min
|
KMIN, // 21 - K*min
|
||||||
K, // 22 - K - temperature
|
K, // 22 - K - temperature
|
||||||
VOLTS, // 23 - V - voltage
|
VOLTS, // 23 - V - voltage
|
||||||
MBAR, // 24 - mbar - atmospheric pressure
|
MBAR, // 24 - mbar - atmospheric pressure
|
||||||
LH, // 25 - l/h - volume flow rate
|
LH, // 25 - l/h - volume flow rate
|
||||||
CTKWH, // 26 - ct/kWh - monetary
|
CTKWH, // 26 - ct/kWh - monetary
|
||||||
HERTZ, // 27 - Hz - frequency
|
HERTZ, // 27 - Hz - frequency
|
||||||
CONNECTIVITY, // 28 - used in HA - connectivity
|
CONNECTIVITY, // 28 - used in HA - connectivity
|
||||||
TIMESTAMP, // 29 - used in HA - timestamp
|
TIMESTAMP, // 29 - used in HA - timestamp
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void Network::begin() {
|
|||||||
WiFi.persistent(false);
|
WiFi.persistent(false);
|
||||||
WiFi.setAutoReconnect(false);
|
WiFi.setAutoReconnect(false);
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.disconnect(true, true); // wipe old settings in NVS
|
WiFi.disconnect(true, true); // wipe old settings in NVS
|
||||||
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||||
WiFi.setHostname(hostname_.c_str()); // updates shared default_hostname buffer
|
WiFi.setHostname(hostname_.c_str()); // updates shared default_hostname buffer
|
||||||
WiFi.enableSTA(true); // creates the STA netif
|
WiFi.enableSTA(true); // creates the STA netif
|
||||||
|
|||||||
@@ -1532,8 +1532,8 @@ bool System::check_upgrade() {
|
|||||||
return StateUpdateResult::UNCHANGED;
|
return StateUpdateResult::UNCHANGED;
|
||||||
});
|
});
|
||||||
// Scheduler name is now mandatory, update FS
|
// Scheduler name is now mandatory, update FS
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
bool schedule_changed = false;
|
bool schedule_changed = false;
|
||||||
EMSESP::webSchedulerService.update([&](WebScheduler & scheduler) {
|
EMSESP::webSchedulerService.update([&](WebScheduler & scheduler) {
|
||||||
for (ScheduleItem & scheduleItem : scheduler.scheduleItems) {
|
for (ScheduleItem & scheduleItem : scheduler.scheduleItems) {
|
||||||
if (scheduleItem.name[0] == '\0') {
|
if (scheduleItem.name[0] == '\0') {
|
||||||
@@ -2970,7 +2970,7 @@ bool System::uploadFirmwareURL(const char * url) {
|
|||||||
|
|
||||||
String scheme = saved_url.substring(0, 8);
|
String scheme = saved_url.substring(0, 8);
|
||||||
scheme.toLowerCase();
|
scheme.toLowerCase();
|
||||||
const bool is_https = scheme.startsWith("https://");
|
const bool is_https = scheme.startsWith("https://");
|
||||||
const int scheme_len = is_https ? 8 : 7; // "https://" vs "http://"
|
const int scheme_len = is_https ? 8 : 7; // "https://" vs "http://"
|
||||||
|
|
||||||
WiFiClient basic_client;
|
WiFiClient basic_client;
|
||||||
@@ -2992,11 +2992,11 @@ bool System::uploadFirmwareURL(const char * url) {
|
|||||||
ssl_client.setBufferSizes(16384, 1024);
|
ssl_client.setBufferSizes(16384, 1024);
|
||||||
ssl_client.setSessionTimeout(120);
|
ssl_client.setSessionTimeout(120);
|
||||||
}
|
}
|
||||||
basic_client.setTimeout(15000); // socket-level read timeout
|
basic_client.setTimeout(15000); // socket-level read timeout
|
||||||
ssl_client.setTimeout(15000); // Stream::readBytes timeout used by Update
|
ssl_client.setTimeout(15000); // Stream::readBytes timeout used by Update
|
||||||
ssl_client.setClient(&basic_client, is_https); // enableSSL = false for plain HTTP
|
ssl_client.setClient(&basic_client, is_https); // enableSSL = false for plain HTTP
|
||||||
|
|
||||||
const uint16_t port = is_https ? 443 : 80;
|
const uint16_t port = is_https ? 443 : 80;
|
||||||
String url_remain = saved_url.substring(scheme_len);
|
String url_remain = saved_url.substring(scheme_len);
|
||||||
int redirect_count = 0;
|
int redirect_count = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -417,8 +417,8 @@ bool WebStatusService::refresh_versions_cache() {
|
|||||||
#else
|
#else
|
||||||
// detect scheme from EMSESP_VERSIONS_URL (case-insensitive). One code path for HTTP and HTTPS,
|
// detect scheme from EMSESP_VERSIONS_URL (case-insensitive). One code path for HTTP and HTTPS,
|
||||||
// using ESP_SSLClient as a plain TCP passthrough when SSL is disabled.
|
// using ESP_SSLClient as a plain TCP passthrough when SSL is disabled.
|
||||||
String url = EMSESP_VERSIONS_URL;
|
String url = EMSESP_VERSIONS_URL;
|
||||||
String lower = url;
|
String lower = url;
|
||||||
lower.toLowerCase();
|
lower.toLowerCase();
|
||||||
const bool is_https = lower.startsWith("https://");
|
const bool is_https = lower.startsWith("https://");
|
||||||
if (!is_https && !lower.startsWith("http://")) {
|
if (!is_https && !lower.startsWith("http://")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user