Do not update indoortemp when embedded temp changes

Solves #1911
This commit is contained in:
Edward Firmo
2024-03-14 10:56:56 +01:00
parent 6e57b20edf
commit 0be79ea5c4
2 changed files with 22 additions and 28 deletions

View File

@@ -1025,7 +1025,7 @@ globals:
- id: embedded_indoor_temp
type: bool
restore_value: true
initial_value: 'false'
initial_value: 'true'
##### Date/time formats #####
- id: home_date_color
@@ -1875,15 +1875,17 @@ script:
mode: restart
then:
- lambda: |-
float unit_based_temperature = id(temp_nspanel).state;
char buffer[15]; // Buffer for formatted temperature string
if ("${temp_units}"[0] == 'F' || "${temp_units}"[0] == 'f' || "${temp_units}"[1] == 'F' || "${temp_units}"[1] == 'f') {
unit_based_temperature = (unit_based_temperature * 9.0 / 5.0) + 32; // Convert to Fahrenheit if necessary
snprintf(buffer, sizeof(buffer), "%.0f°F", unit_based_temperature); // Fahrenheit with no decimal
} else {
snprintf(buffer, sizeof(buffer), "%.1f°C", unit_based_temperature); // Celsius with one decimal
if (id(embedded_indoor_temp) or !wifi_component->is_connected() or !api_server->is_connected()) {
float unit_based_temperature = id(temp_nspanel).state;
char buffer[15]; // Buffer for formatted temperature string
if ("${temp_units}"[0] == 'F' || "${temp_units}"[0] == 'f' || "${temp_units}"[1] == 'F' || "${temp_units}"[1] == 'f') {
unit_based_temperature = (unit_based_temperature * 9.0 / 5.0) + 32; // Convert to Fahrenheit if necessary
snprintf(buffer, sizeof(buffer), "%.0f${temp_units}", unit_based_temperature); // Fahrenheit with no decimal
} else {
snprintf(buffer, sizeof(buffer), "%.1f${temp_units}", unit_based_temperature); // Celsius with one decimal
}
id(disp1)->set_component_text("home.indr_temp", adjustDecimalSeparator(buffer, id(mui_decimal_separator)).c_str());
}
id(disp1)->set_component_text("home.indr_temp", adjustDecimalSeparator(buffer, id(mui_decimal_separator)).c_str());
- id: display_wrapped_text
mode: parallel