Revert temperature_unit_is_fahrenheit

This commit is contained in:
Edward Firmo
2024-01-25 17:01:13 +01:00
parent b1b2eef001
commit 5403776b9a
2 changed files with 24 additions and 5 deletions

View File

@@ -322,7 +322,7 @@ api:
embedded_climate: bool
embedded_climate_friendly_name: string
embedded_indoor_temperature: bool
temperature_unit_is_fahrenheit: bool # Deprecated
temperature_unit_is_fahrenheit: bool
mui_please_confirm: string
mui_unavailable: string
screensaver_time: bool
@@ -334,6 +334,7 @@ api:
embedded_climate: !lambda "return embedded_climate;"
embedded_climate_friendly_name: !lambda "return embedded_climate_friendly_name;"
embedded_indoor_temperature: !lambda "return embedded_indoor_temperature;"
temperature_unit_is_fahrenheit: !lambda "return temperature_unit_is_fahrenheit;"
mui_please_confirm: !lambda "return mui_please_confirm;"
mui_unavailable: !lambda "return mui_unavailable;"
screensaver_time: !lambda "return screensaver_time;"
@@ -831,6 +832,12 @@ globals:
restore_value: true
initial_value: 'false'
##### Temperature unit #####
- id: temp_unit_fahrenheit
type: bool
restore_value: true
initial_value: 'false'
##### Date/time formats #####
- id: home_date_color
type: uint
@@ -1850,9 +1857,9 @@ script:
- lambda: |-
if (id(embedded_indoor_temp) or (!wifi_component->is_connected()) or (!api_server->is_connected())) {
float unit_based_temperature = temp_nspanel->state;
if ("${temp_units}" == "°F" or "${temp_units}" == "°f" or "${temp_units}" == "F" or "${temp_units}" == "f")
if (id(temp_unit_fahrenheit))
unit_based_temperature = (unit_based_temperature * 9 / 5) + 32;
disp1->set_component_text_printf("home.current_temp", "%.1f${temp_units}", unit_based_temperature);
disp1->set_component_text_printf("home.current_temp", "%.1f°%s", unit_based_temperature, id(temp_unit_fahrenheit) ? "F" : "C");
}
- id: display_wrapped_text
@@ -1915,6 +1922,7 @@ script:
embedded_climate: bool
embedded_climate_friendly_name: string
embedded_indoor_temperature: bool
temperature_unit_is_fahrenheit: bool
mui_please_confirm: string
mui_unavailable: string
screensaver_time: bool
@@ -1934,6 +1942,7 @@ script:
// Indoor temperature
ESP_LOGV(TAG, "Set indoor temperature");
id(embedded_indoor_temp) = embedded_indoor_temperature;
id(temp_unit_fahrenheit) = temperature_unit_is_fahrenheit;
display_embedded_temp->execute();
// MUI strings