Code clean-up
This commit is contained in:
@@ -71,17 +71,17 @@ script:
|
||||
- lambda: |-
|
||||
// Update home.climate_entity variable
|
||||
id(entity_id) = (id(is_embedded_thermostat)) ? "embedded_climate" : "";
|
||||
id(disp1).set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0);
|
||||
disp1->set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0);
|
||||
// Update chips
|
||||
if (id(is_embedded_thermostat))
|
||||
id(update_climate_icon).execute("home.icon_top_03", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
|
||||
id(update_climate_icon).execute("home.icon_top_03", int(thermostat_embedded->action), int(thermostat_embedded->mode));
|
||||
|
||||
- id: !extend addon_climate_service_call
|
||||
then:
|
||||
- lambda: |-
|
||||
id(is_addon_climate_visible) = true;
|
||||
id(disp1).set_component_value("climate.embedded", 1);
|
||||
auto call = id(thermostat_embedded).make_call();
|
||||
disp1->set_component_value("climate.embedded", 1);
|
||||
auto call = thermostat_embedded->make_call();
|
||||
if (key == "set_temperature")
|
||||
call.set_target_temperature(stof(value) / 10);
|
||||
else if (key == "hvac_mode")
|
||||
@@ -96,44 +96,44 @@ script:
|
||||
- id: !extend addon_climate_update_page_climate
|
||||
then:
|
||||
- lambda: |-
|
||||
if (id(current_page).state == "climate" and id(is_addon_climate_visible))
|
||||
if (current_page->state == "climate" and id(is_addon_climate_visible))
|
||||
{
|
||||
id(disp1).set_component_text_printf("page_label", id(addon_climate_friendly_name).c_str());
|
||||
disp1->set_component_text_printf("page_label", id(addon_climate_friendly_name).c_str());
|
||||
float temp_step = ${temp_step};
|
||||
float temp_offset = ${temp_min};
|
||||
float temp_max = ${temp_max};
|
||||
float total_steps = (temp_max-temp_offset)/temp_step;
|
||||
id(set_climate)->execute
|
||||
set_climate->execute
|
||||
(
|
||||
id(thermostat_embedded).current_temperature, // current_temp
|
||||
id(thermostat_embedded).target_temperature, // target_temp
|
||||
thermostat_embedded->current_temperature, // current_temp
|
||||
thermostat_embedded->target_temperature, // target_temp
|
||||
int(round(${temp_step}*10)), // temp_step
|
||||
int(round(total_steps)), // total_steps //int(round((10*id(thermostat_embedded).target_temperature-temp_offset)/temp_step)), // slider_val
|
||||
int(round(total_steps)), // total_steps //int(round((10*thermostat_embedded->target_temperature-temp_offset)/temp_step)), // slider_val
|
||||
int(round(${temp_min}*10)), // temp_offset
|
||||
"", // climate_icon
|
||||
true // embedded_climate
|
||||
);
|
||||
|
||||
// Update target temp icon
|
||||
id(update_climate_icon).execute("climate.target_icon", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
|
||||
update_climate_icon->execute("climate.target_icon", int(thermostat_embedded->action), int(thermostat_embedded->mode));
|
||||
|
||||
// Update buttons bar
|
||||
// Hide not supported hotspots
|
||||
id(disp1).hide_component("button01");
|
||||
id(disp1).hide_component("button02");
|
||||
if (${addon_climate_heat}) id(disp1).show_component("button03"); else id(disp1).hide_component("button03"); //Heat
|
||||
if (${addon_climate_cool}) id(disp1).show_component("button04"); else id(disp1).hide_component("button04"); //Cool
|
||||
id(disp1).hide_component("button05");
|
||||
id(disp1).hide_component("button06");
|
||||
id(disp1).show_component("button07"); //Off
|
||||
disp1->hide_component("button01");
|
||||
disp1->hide_component("button02");
|
||||
if (${addon_climate_heat}) disp1->show_component("button03"); else disp1->hide_component("button03"); //Heat
|
||||
if (${addon_climate_cool}) disp1->show_component("button04"); else disp1->hide_component("button04"); //Cool
|
||||
disp1->hide_component("button05");
|
||||
disp1->hide_component("button06");
|
||||
disp1->show_component("button07"); //Off
|
||||
// Set buttons colors
|
||||
id(disp1).set_component_font_color("climate.button01_icon", 6339);
|
||||
id(disp1).set_component_font_color("climate.button02_icon", 6339);
|
||||
id(disp1).set_component_font_color("climate.button03_icon", (id(thermostat_embedded).mode==climate::CLIMATE_MODE_HEAT) ? 64164 : ((${addon_climate_heat}) ? 48631 : 6339));
|
||||
id(disp1).set_component_font_color("climate.button04_icon", (id(thermostat_embedded).mode==climate::CLIMATE_MODE_COOL) ? 1055 : ((${addon_climate_cool}) ? 48631 : 6339));
|
||||
id(disp1).set_component_font_color("climate.button05_icon", 6339);
|
||||
id(disp1).set_component_font_color("climate.button06_icon", 6339);
|
||||
id(disp1).set_component_font_color("climate.button07_icon", (id(thermostat_embedded).mode==climate::CLIMATE_MODE_OFF) ? 10597 : 35921);
|
||||
disp1->set_component_font_color("climate.button01_icon", 6339);
|
||||
disp1->set_component_font_color("climate.button02_icon", 6339);
|
||||
disp1->set_component_font_color("climate.button03_icon", (thermostat_embedded->mode==climate::CLIMATE_MODE_HEAT) ? 64164 : ((${addon_climate_heat}) ? 48631 : 6339));
|
||||
disp1->set_component_font_color("climate.button04_icon", (thermostat_embedded->mode==climate::CLIMATE_MODE_COOL) ? 1055 : ((${addon_climate_cool}) ? 48631 : 6339));
|
||||
disp1->set_component_font_color("climate.button05_icon", 6339);
|
||||
disp1->set_component_font_color("climate.button06_icon", 6339);
|
||||
disp1->set_component_font_color("climate.button07_icon", (thermostat_embedded->mode==climate::CLIMATE_MODE_OFF) ? 10597 : 35921);
|
||||
}
|
||||
|
||||
- id: !extend addon_climate_set_climate_friendly_name
|
||||
|
||||
Reference in New Issue
Block a user