Removed service upload_tft
Please use this instead: ```yaml service: esphome.xxxxx_upload_tft_url data: url: "default" ```
This commit is contained in:
@@ -37,20 +37,31 @@ button:
|
||||
|
||||
api:
|
||||
services:
|
||||
##### SERVICE TO UPDATE THE HMI FILE ##############
|
||||
- service: upload_tft
|
||||
then:
|
||||
- logger.log: "Service: upload_tft"
|
||||
- lambda: |-
|
||||
upload_tft->execute("${nextion_update_url}");
|
||||
|
||||
##### SERVICE TO UPDATE THE TFT FILE from URL #####
|
||||
- service: upload_tft_url
|
||||
variables:
|
||||
url: string
|
||||
then:
|
||||
- logger.log: "Service: upload_tft_url"
|
||||
- lambda: |-
|
||||
static const char *const TAG = "service.upload_tft_url";
|
||||
ESP_LOGVV(TAG, "Starting...");
|
||||
|
||||
auto toLowerAndTrim(const std::string& input) -> std::string {
|
||||
std::string result = input;
|
||||
// Convert to lowercase
|
||||
std::transform(result.begin(), result.end(), result.begin(),
|
||||
[](unsigned char c){ return std::tolower(c); });
|
||||
|
||||
// Trim trailing spaces
|
||||
auto endPos = result.find_last_not_of(" \t");
|
||||
if (std::string::npos != endPos) {
|
||||
result = result.substr(0, endPos + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
std::string clean_url = toLowerAndTrim(url.c_str());
|
||||
if ( clean_url.empty() or clean_url == "default") url = "${nextion_update_url}";
|
||||
upload_tft->execute(url.c_str());
|
||||
|
||||
display:
|
||||
|
||||
Reference in New Issue
Block a user