@@ -2121,16 +2121,14 @@ script:
|
||||
- lambda: |-
|
||||
if (id(embedded_indoor_temp) or !wifi_component->is_connected() or !api_server->is_connected()) {
|
||||
const std::string temp_units = "${temp_units}";
|
||||
if (!temp_units.empty()) {
|
||||
const char last_char = std::tolower(temp_units.back()); // Access the last character and convert to lowercase
|
||||
char buffer[15]; // Buffer for formatted temperature string
|
||||
if (last_char == 'f') {
|
||||
snprintf(buffer, sizeof(buffer), "%.0f${temp_units}", (id(temp_nspanel).state * 9.0 / 5.0) + 32); // Fahrenheit with no decimal
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "%.1f${temp_units}", id(temp_nspanel).state); // Celsius with one decimal
|
||||
}
|
||||
id(disp1)->set_component_text("home.indr_temp", adjustDecimalSeparator(buffer, id(mui_decimal_separator)).c_str());
|
||||
const bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
|
||||
char buffer[15]; // Buffer for formatted temperature string
|
||||
if (temp_unit_fahrenheit) {
|
||||
snprintf(buffer, sizeof(buffer), "%.0f${temp_units}", (id(temp_nspanel).state * 9.0 / 5.0) + 32); // Fahrenheit with no decimal
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "%.1f${temp_units}", id(temp_nspanel).state); // Celsius with one decimal
|
||||
}
|
||||
id(disp1)->set_component_text("home.indr_temp", adjustDecimalSeparator(buffer, id(mui_decimal_separator)).c_str());
|
||||
}
|
||||
|
||||
- id: display_wrapped_text
|
||||
|
||||
Reference in New Issue
Block a user