@@ -173,8 +173,8 @@ script:
|
|||||||
auto CelsiusToFahrenheit = [](float celsius) -> float {
|
auto CelsiusToFahrenheit = [](float celsius) -> float {
|
||||||
return (celsius * 9 / 5) + 32;
|
return (celsius * 9 / 5) + 32;
|
||||||
};
|
};
|
||||||
std::string temp_units = "${temp_units}";
|
const std::string temp_units = "${temp_units}";
|
||||||
bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
|
const bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
|
||||||
ClimateTraits traits = thermostat_embedded->get_traits();
|
ClimateTraits traits = thermostat_embedded->get_traits();
|
||||||
|
|
||||||
disp1->set_component_text("page_label", id(addon_climate_friendly_name).c_str());
|
disp1->set_component_text("page_label", id(addon_climate_friendly_name).c_str());
|
||||||
@@ -187,7 +187,7 @@ script:
|
|||||||
float temp_current = thermostat_embedded->current_temperature;
|
float temp_current = thermostat_embedded->current_temperature;
|
||||||
if (temp_unit_fahrenheit) {
|
if (temp_unit_fahrenheit) {
|
||||||
//temp_step = CelsiusToFahrenheit(temp_step);
|
//temp_step = CelsiusToFahrenheit(temp_step);
|
||||||
temp_step = temp_step * 1.8;
|
temp_step = std::ceil(temp_step * 1.8);
|
||||||
temp_offset = CelsiusToFahrenheit(temp_offset);
|
temp_offset = CelsiusToFahrenheit(temp_offset);
|
||||||
temp_max = CelsiusToFahrenheit(temp_max);
|
temp_max = CelsiusToFahrenheit(temp_max);
|
||||||
temp_target = CelsiusToFahrenheit(temp_target);
|
temp_target = CelsiusToFahrenheit(temp_target);
|
||||||
|
|||||||
@@ -2121,17 +2121,15 @@ script:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (id(embedded_indoor_temp) or !wifi_component->is_connected() or !api_server->is_connected()) {
|
if (id(embedded_indoor_temp) or !wifi_component->is_connected() or !api_server->is_connected()) {
|
||||||
const std::string temp_units = "${temp_units}";
|
const std::string temp_units = "${temp_units}";
|
||||||
if (!temp_units.empty()) {
|
const bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
|
||||||
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
|
char buffer[15]; // Buffer for formatted temperature string
|
||||||
if (last_char == 'f') {
|
if (temp_unit_fahrenheit) {
|
||||||
snprintf(buffer, sizeof(buffer), "%.0f${temp_units}", (id(temp_nspanel).state * 9.0 / 5.0) + 32); // Fahrenheit with no decimal
|
snprintf(buffer, sizeof(buffer), "%.0f${temp_units}", (id(temp_nspanel).state * 9.0 / 5.0) + 32); // Fahrenheit with no decimal
|
||||||
} else {
|
} else {
|
||||||
snprintf(buffer, sizeof(buffer), "%.1f${temp_units}", id(temp_nspanel).state); // Celsius with one decimal
|
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(disp1)->set_component_text("home.indr_temp", adjustDecimalSeparator(buffer, id(mui_decimal_separator)).c_str());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- id: display_wrapped_text
|
- id: display_wrapped_text
|
||||||
mode: parallel
|
mode: parallel
|
||||||
|
|||||||
Reference in New Issue
Block a user