Fix climate icon update
Partially solves https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/995#discussioncomment-6891454
This commit is contained in:
@@ -63,81 +63,18 @@ script:
|
||||
- id: !extend addon_climate_update_page_home
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: ESP_LOGV("script.addon_climate_update_page_home", "Starting");
|
||||
- if:
|
||||
condition:
|
||||
- binary_sensor.is_on: nextion_init
|
||||
then:
|
||||
- lambda: |-
|
||||
// Update home.entity variable
|
||||
ESP_LOGV("script.addon_climate_update_page_home", "Update home.entity variable: %s", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
|
||||
id(disp1).set_component_text_printf("home.entity", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
|
||||
|
||||
- if:
|
||||
condition:
|
||||
- lambda: !lambda 'return id(is_embedded_thermostat);'
|
||||
then:
|
||||
- lambda: |-
|
||||
// Update chips
|
||||
ESP_LOGV("script.addon_climate_update_page_home", "Update chips");
|
||||
ESP_LOGV("script.refresh_chips_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action));
|
||||
switch (int(id(thermostat_embedded).action)) // CLIMATE_ACTION_OFF = 0, CLIMATE_ACTION_COOLING = 2, CLIMATE_ACTION_HEATING = 3, CLIMATE_ACTION_IDLE = 4, CLIMATE_ACTION_DRYING = 5, CLIMATE_ACTION_FAN = 6
|
||||
{
|
||||
case 0: //CLIMATE_ACTION_OFF
|
||||
ESP_LOGV("script.refresh_chips_climate", "thermostat_embedded.mode=%i", int(id(thermostat_embedded).mode));
|
||||
switch (int(id(thermostat_embedded).mode)) // CLIMATE_MODE_OFF = 0, CLIMATE_MODE_HEAT_COOL = 1, CLIMATE_MODE_COOL = 2, CLIMATE_MODE_HEAT = 3, CLIMATE_MODE_FAN_ONLY = 4, CLIMATE_MODE_DRY = 5, CLIMATE_MODE_AUTO = 6
|
||||
{
|
||||
case 0: //CLIMATE_MODE_OFF
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uFFFF"); // (E424) Don't show icon when off
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
case 1: //CLIMATE_MODE_HEAT_COOL
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE069");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
case 2: //CLIMATE_MODE_COOL
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE716");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
case 3: //CLIMATE_MODE_HEAT
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE237");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 64164);
|
||||
break;
|
||||
case 4: //CLIMATE_MODE_FAN_ONLY
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE20F");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
case 5: //CLIMATE_MODE_DRY
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE58D");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
case 6: //CLIMATE_MODE_AUTO
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uEE8D");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
}
|
||||
case 2: //CLIMATE_ACTION_COOLING
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE716");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 1055);
|
||||
break;
|
||||
case 3: //CLIMATE_ACTION_HEATING
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE237");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 64164);
|
||||
break;
|
||||
case 4: //CLIMATE_ACTION_IDLE
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE50E"); // mdi:thermometer
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 35921);
|
||||
break;
|
||||
case 5: //CLIMATE_ACTION_DRYING
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE58D");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 64704);
|
||||
break;
|
||||
case 6: //CLIMATE_ACTION_FAN
|
||||
id(disp1).set_component_text_printf("home.icon_top_03", "%s", "\uE20F");
|
||||
id(disp1).set_component_font_color("home.icon_top_03", 1530);
|
||||
break;
|
||||
}
|
||||
- lambda: ESP_LOGV("script.addon_climate_update_page_home", "Finished");
|
||||
- lambda: |-
|
||||
ESP_LOGV("script.addon_climate_update_page_home", "Starting");
|
||||
// Update home.entity variable
|
||||
ESP_LOGV("script.addon_climate_update_page_home", "Update home.entity variable: %s", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
|
||||
id(disp1).set_component_text_printf("home.entity", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
|
||||
// Update chips
|
||||
if (id(is_embedded_thermostat))
|
||||
{
|
||||
ESP_LOGV("script.addon_climate_update_page_home", "Update chips");
|
||||
id(update_climate_icon).execute("home.icon_top_03", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
|
||||
}
|
||||
ESP_LOGV("script.addon_climate_update_page_home", "Finished");
|
||||
|
||||
- id: !extend addon_climate_service_call
|
||||
then:
|
||||
@@ -210,62 +147,7 @@ script:
|
||||
# Update target temp icon
|
||||
- lambda: |-
|
||||
ESP_LOGV("script.addon_climate_update_page_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action));
|
||||
switch (int(id(thermostat_embedded).action)) // CLIMATE_ACTION_OFF = 0, CLIMATE_ACTION_COOLING = 2, CLIMATE_ACTION_HEATING = 3, CLIMATE_ACTION_IDLE = 4, CLIMATE_ACTION_DRYING = 5, CLIMATE_ACTION_FAN = 6
|
||||
{
|
||||
case 0: //CLIMATE_ACTION_OFF
|
||||
ESP_LOGV("script.addon_climate_update_page_climate", "thermostat_embedded.mode=%i", int(id(thermostat_embedded).mode));
|
||||
switch (int(id(thermostat_embedded).mode)) // CLIMATE_MODE_OFF = 0, CLIMATE_MODE_HEAT_COOL = 1, CLIMATE_MODE_COOL = 2, CLIMATE_MODE_HEAT = 3, CLIMATE_MODE_FAN_ONLY = 4, CLIMATE_MODE_DRY = 5, CLIMATE_MODE_AUTO = 6
|
||||
{
|
||||
case 0: //CLIMATE_MODE_OFF
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uFFFF"); // (E424) Don't show icon when off
|
||||
id(disp1).set_component_font_color("climate.target_icon", 35921);
|
||||
break;
|
||||
case 1: //CLIMATE_MODE_HEAT_COOL
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE069");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 35921);
|
||||
break;
|
||||
case 2: //CLIMATE_MODE_COOL
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE716");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 1055);
|
||||
break;
|
||||
case 3: //CLIMATE_MODE_HEAT
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE237");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 64164);
|
||||
break;
|
||||
case 4: //CLIMATE_MODE_FAN_ONLY
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE20F");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 35921);
|
||||
break;
|
||||
case 5: //CLIMATE_MODE_DRY
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE58D");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 64704);
|
||||
break;
|
||||
case 6: //CLIMATE_MODE_AUTO
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uEE8D");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 35921);
|
||||
break;
|
||||
}
|
||||
case 2: //CLIMATE_ACTION_COOLING
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE716");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 1055);
|
||||
break;
|
||||
case 3: //CLIMATE_ACTION_HEATING
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE237");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 64164);
|
||||
break;
|
||||
case 4: //CLIMATE_ACTION_IDLE
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE50E"); // mdi:thermometer
|
||||
id(disp1).set_component_font_color("climate.target_icon", 35921);
|
||||
break;
|
||||
case 5: //CLIMATE_ACTION_DRYING
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE58D");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 64704);
|
||||
break;
|
||||
case 6: //CLIMATE_ACTION_FAN
|
||||
id(disp1).set_component_text_printf("climate.target_icon", "%s", "\uE20F");
|
||||
id(disp1).set_component_font_color("climate.target_icon", 1530);
|
||||
break;
|
||||
}
|
||||
id(update_climate_icon).execute("climate.target_icon", int(id(thermostat_embedded).action), int(id(thermostat_embedded).mode));
|
||||
|
||||
# Update buttons bar
|
||||
- lambda: |-
|
||||
|
||||
Reference in New Issue
Block a user