Support to Fahrenheit with esp-idf

This commit is contained in:
Edward Firmo
2023-12-18 13:21:19 +01:00
parent a1e488c72f
commit b086ccc16d
2 changed files with 28 additions and 27 deletions

View File

@@ -22,28 +22,28 @@ substitutions:
api:
services:
##### SERVICE TO UPDATE THE TFT FILE from URL #####
##### It will use the default url if url is empty or "default"
- service: upload_tft_url
variables:
url: string
then:
- lambda: |-
static const char *const TAG = "service.upload_tft_url";
ESP_LOGVV(TAG, "Starting...");
##### SERVICE TO UPDATE THE TFT FILE from URL #####
##### It will use the default url if url is empty or "default"
- service: upload_tft_url
variables:
url: string
then:
- lambda: |-
static const char *const TAG = "service.upload_tft_url";
ESP_LOGVV(TAG, "Starting...");
std::string clean_url = url;
// Convert to lowercase
std::transform(clean_url.begin(), clean_url.end(), clean_url.begin(),
[](unsigned char c){ return std::tolower(c); });
// Trim trailing spaces
auto endPos = clean_url.find_last_not_of(" \t");
if (std::string::npos != endPos) {
clean_url = clean_url.substr(0, endPos + 1);
}
std::string clean_url = url;
// Convert to lowercase
std::transform(clean_url.begin(), clean_url.end(), clean_url.begin(),
[](unsigned char c){ return std::tolower(c); });
// Trim trailing spaces
auto endPos = clean_url.find_last_not_of(" \t");
if (std::string::npos != endPos) {
clean_url = clean_url.substr(0, endPos + 1);
}
if ( clean_url.empty() or clean_url == "default") url = tft_list->state;
upload_tft->execute(url.c_str());
if ( clean_url.empty() or clean_url == "default") url = tft_list->state;
upload_tft->execute(url.c_str());
button:
##### UPDATE TFT DISPLAY #####

View File

@@ -364,9 +364,9 @@ api:
- wait_until:
condition:
- not:
- text_sensor.state: # Is boot page visible?
id: current_page
state: 'boot'
- text_sensor.state: # Is boot page visible?
id: current_page
state: 'boot'
timeout: 2s
- if:
condition:
@@ -1257,7 +1257,8 @@ sensor:
reference_resistance: 10kOhm
filters:
- lambda: |-
if ("${temp_units}" == "°F" or "${temp_units}" == "F" or "${temp_units}" == "°f" or "${temp_units}" == "f")
std::string temp_unit = "${temp_units}";
if (temp_unit == "°F" or temp_unit == "F" or temp_unit == "°f" or temp_unit == "f")
return (x * (9.0/5.0)) + 32.0 + temperature_correction->state;
else
return x + temperature_correction->state;
@@ -2588,9 +2589,9 @@ script:
- wait_until:
condition:
- not:
- text_sensor.state: # Is boot page visible?
id: current_page
state: 'boot'
- text_sensor.state: # Is boot page visible?
id: current_page
state: 'boot'
timeout: 15s
- lambda: |-
static const char *const TAG = "script.boot_sequence";