Add nextion_components.h
This commit is contained in:
@@ -202,7 +202,7 @@ script:
|
||||
- lambda: |-
|
||||
// Update chips
|
||||
if (id(is_embedded_thermostat) and !id(is_uploading_tft))
|
||||
update_climate_icon->execute("home.icon_top_03", int(thermostat_embedded->action), int(thermostat_embedded->mode));
|
||||
update_climate_icon->execute("home.chip_climate", int(thermostat_embedded->action), int(thermostat_embedded->mode));
|
||||
|
||||
- id: !extend set_climate
|
||||
then:
|
||||
|
||||
@@ -243,11 +243,11 @@ api:
|
||||
disp1->set_component_text_printf(btnbri.c_str(), "%s", bri.c_str());
|
||||
else
|
||||
disp1->set_component_text_printf(btnbri.c_str(), " ");
|
||||
disp1->show_component(btnpic.c_str());
|
||||
disp1->show_component(btnicon.c_str());
|
||||
disp1->show_component(btntext.c_str());
|
||||
disp1->show_component(btnbri.c_str());
|
||||
disp1->show_component(id.c_str());
|
||||
set_component_visibility->execute(btnpic.c_str(), true);
|
||||
set_component_visibility->execute(btnicon.c_str(), true);
|
||||
set_component_visibility->execute(btntext.c_str(), true);
|
||||
set_component_visibility->execute(btnbri.c_str(), true);
|
||||
set_component_visibility->execute(id.c_str(), true);
|
||||
} else {
|
||||
ESP_LOGW("service.set_button", "Skipping button `%s.%s` update.", page.c_str(), id.c_str());
|
||||
}
|
||||
@@ -329,7 +329,7 @@ api:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (!id(is_uploading_tft))
|
||||
disp1->hide_component(id.c_str());
|
||||
set_component_visibility->execute(id.c_str(), false);
|
||||
|
||||
# Component Show Service
|
||||
# Enables dynamic interface changes by making specified components visible on the display again.
|
||||
@@ -352,7 +352,7 @@ api:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (!id(is_uploading_tft))
|
||||
disp1->show_component(id.c_str());
|
||||
set_component_visibility->execute(id.c_str(), true);
|
||||
|
||||
# Component Text Service
|
||||
# Updates text content for a specified component on the display, ideal for dynamic updates.
|
||||
@@ -465,24 +465,18 @@ api:
|
||||
visible: bool
|
||||
then:
|
||||
- lambda: |-
|
||||
static const char *const TAG = "service.icon";
|
||||
ESP_LOGI(TAG, "id: %s", id.c_str());
|
||||
ESP_LOGI(TAG, "id_empty: %s", YESNO(id.empty()));
|
||||
ESP_LOGI(TAG, "icon: %s", icon.c_str());
|
||||
ESP_LOGI(TAG, "icon_color: %i", icon_color.size());
|
||||
ESP_LOGI(TAG, "visible: %s", YESNO(visible));
|
||||
ESP_LOGI(TAG, "page: %s", current_page->state.c_str());
|
||||
if (!id(is_uploading_tft) and !(id.empty())) {
|
||||
if (!(icon.empty())) disp1->set_component_text_printf("%s_icon", id.c_str(), icon.c_str());
|
||||
if (!(icon.empty())) disp1->set_component_text_printf(id.c_str(), "%s", icon.c_str());
|
||||
if (icon_color.size() == 3)
|
||||
disp1->set_component_font_color((id + "_icon").c_str(), esphome::display::ColorUtil::color_to_565(esphome::Color(icon_color[0], icon_color[1], icon_color[2])));
|
||||
bool IsCurrentPage = true;
|
||||
size_t dotPos = id.find(".");
|
||||
if (dotPos != std::string::npos) {
|
||||
std::string left_side = id.substr(0, dotPos);
|
||||
if (left_side == "alarm_control_panel") left_side = "alarm";
|
||||
if (left_side != current_page->state) IsCurrentPage = false;
|
||||
}
|
||||
if (IsCurrentPage) {
|
||||
if (visible) {
|
||||
disp1->show_component(id.c_str());
|
||||
} else {
|
||||
disp1->hide_component(id.c_str());
|
||||
}
|
||||
}
|
||||
disp1->set_component_font_color(id.c_str(), esphome::display::ColorUtil::color_to_565(esphome::Color(icon_color[0], icon_color[1], icon_color[2])));
|
||||
set_component_visibility->execute(id.c_str(), visible);
|
||||
}
|
||||
|
||||
# Init Global Service
|
||||
@@ -644,21 +638,24 @@ api:
|
||||
|
||||
// Chips icon size
|
||||
ESP_LOGV(TAG, "Chips size");
|
||||
for (int i = 1; i <= 10; ++i) {
|
||||
disp1->send_command_printf("home.icon_top_%02d.font=%" PRIu32, i, chip_font);
|
||||
disp1->send_command_printf("home.chip_relay1.font=%" PRIu8, chip_font);
|
||||
disp1->send_command_printf("home.chip_relay2.font=%" PRIu8, chip_font);
|
||||
disp1->send_command_printf("home.chip_climate.font=%" PRIu8, chip_font);
|
||||
for (int i = 1; i <= 7; ++i) {
|
||||
disp1->send_command_printf("home.chip%02d.font=%" PRIu8, i, chip_font);
|
||||
}
|
||||
disp1->send_command_printf("home.wifi_icon.font=%" PRIu32, chip_font);
|
||||
disp1->send_command_printf("home.wifi_icon.font=%" PRIu8, chip_font);
|
||||
id(home_chip_font_id) = chip_font;
|
||||
|
||||
// Custom buttons icon size
|
||||
ESP_LOGV(TAG, "Custom buttons sizes");
|
||||
id(home_custom_buttons_font_id) = custom_buttons_font;
|
||||
for (int i = 1; i <= 7; ++i) {
|
||||
disp1->send_command_printf("home.button%02d.font=%i", i, id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.button%02d.font=%" PRIu8, i, id(home_custom_buttons_font_id));
|
||||
}
|
||||
disp1->send_command_printf("home.bt_notific.font=%i", id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.bt_qrcode.font=%i", id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.bt_entities.font=%i", id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.bt_notific.font=%" PRIu8, id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.bt_qrcode.font=%" PRIu8, id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.bt_entities.font=%" PRIu8, id(home_custom_buttons_font_id));
|
||||
|
||||
// Outdoor temperature font size
|
||||
ESP_LOGV(TAG, "Outdoor temperature font size");
|
||||
@@ -794,13 +791,13 @@ api:
|
||||
id(home_relay1_icon_color) = ColorUtil::color_to_565(esphome::Color(relay1_icon_color[0],
|
||||
relay1_icon_color[1],
|
||||
relay1_icon_color[2]));
|
||||
disp1->set_component_font_color("home.icon_top_01", id(home_relay1_icon_color));
|
||||
disp1->set_component_font_color("home.chip_relay1", id(home_relay1_icon_color));
|
||||
}
|
||||
if (relay2_icon_color.size() == 3) {
|
||||
id(home_relay2_icon_color) = ColorUtil::color_to_565(esphome::Color(relay2_icon_color[0],
|
||||
relay2_icon_color[1],
|
||||
relay2_icon_color[2]));
|
||||
disp1->set_component_font_color("home.icon_top_02", id(home_relay2_icon_color));
|
||||
disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color));
|
||||
}
|
||||
|
||||
// Refresh display
|
||||
@@ -942,7 +939,8 @@ api:
|
||||
disp1->set_component_background_color("bt_home_icon", (state == "armed_home") ? 19818 : 52857);
|
||||
disp1->set_component_font_color("bt_home_text", (state == "armed_home") ? 65535 : 0);
|
||||
disp1->set_component_font_color("bt_home_icon", (state == "armed_home") ? 65535 : 0);
|
||||
if (state == "armed_home") disp1->hide_component("bt_home"); else disp1->show_component("bt_home");
|
||||
set_component_visibility->execute("bt_home", (state != "armed_home"));
|
||||
|
||||
}
|
||||
if (supported_features & 2 or state == "armed_away") // Alarm - Button - Away
|
||||
{
|
||||
@@ -951,7 +949,7 @@ api:
|
||||
disp1->set_component_background_color("bt_away_icon", (state == "armed_away") ? 19818 : 52857);
|
||||
disp1->set_component_font_color("bt_away_text", (state == "armed_away") ? 65535 : 0);
|
||||
disp1->set_component_font_color("bt_away_icon", (state == "armed_away") ? 65535 : 0);
|
||||
if (state == "armed_away") disp1->hide_component("bt_away"); else disp1->show_component("bt_away");
|
||||
set_component_visibility->execute("bt_away", (state != "armed_away"));
|
||||
}
|
||||
if (supported_features & 4 or state == "armed_night") // Alarm - Button - Night
|
||||
{
|
||||
@@ -960,7 +958,7 @@ api:
|
||||
disp1->set_component_background_color("bt_night_icon", (state == "armed_night") ? 19818 : 52857);
|
||||
disp1->set_component_font_color("bt_night_text", (state == "armed_night") ? 65535 : 0);
|
||||
disp1->set_component_font_color("bt_night_icon", (state == "armed_night") ? 65535 : 0);
|
||||
if (state == "armed_night") disp1->hide_component("bt_night"); else disp1->show_component("bt_night");
|
||||
set_component_visibility->execute("bt_night", (state != "armed_night"));
|
||||
}
|
||||
if (supported_features & 32 or state == "armed_vacation") // Alarm - Button - Vacation
|
||||
{
|
||||
@@ -969,7 +967,7 @@ api:
|
||||
disp1->set_component_background_color("bt_vacat_icon", (state == "armed_vacation") ? 19818 : 52857);
|
||||
disp1->set_component_font_color("bt_vacat_text", (state == "armed_vacation") ? 65535 : 0);
|
||||
disp1->set_component_font_color("bt_vacat_icon", (state == "armed_vacation") ? 65535 : 0);
|
||||
if (state == "armed_vacation") disp1->hide_component("bt_vacat"); else disp1->show_component("bt_vacat");
|
||||
set_component_visibility->execute("bt_vacat", (state != "armed_vacation"));
|
||||
}
|
||||
if (supported_features & 16 or state == "armed_bypass") // Alarm - Button - Custom bypass
|
||||
{
|
||||
@@ -978,7 +976,7 @@ api:
|
||||
disp1->set_component_background_color("bt_bypass_icon", (state == "armed_bypass") ? 19818 : 52857);
|
||||
disp1->set_component_font_color("bt_bypass_text", (state == "armed_bypass") ? 65535 : 0);
|
||||
disp1->set_component_font_color("bt_bypass_icon", (state == "armed_bypass") ? 65535 : 0);
|
||||
if (state == "armed_bypass") disp1->hide_component("bt_bypass"); else disp1->show_component("bt_bypass");
|
||||
set_component_visibility->execute("bt_bypass", (state != "armed_bypass"));
|
||||
}
|
||||
if ( true ) // Alarm - Button - Disarm
|
||||
{
|
||||
@@ -987,7 +985,7 @@ api:
|
||||
disp1->set_component_background_color("bt_disarm_icon", (state == "disarmed") ? 19818 : 52857);
|
||||
disp1->set_component_font_color("bt_disarm_text", (state == "disarmed") ? 65535 : 0);
|
||||
disp1->set_component_font_color("bt_disarm_icon", (state == "disarmed") ? 65535 : 0);
|
||||
if (state == "disarmed") disp1->hide_component("bt_disarm"); else disp1->show_component("bt_disarm");
|
||||
set_component_visibility->execute("bt_disarm", (state != "disarmed"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,38 +1125,41 @@ api:
|
||||
// on/off button
|
||||
if (supported_features & 128 and state == "off") { //TURN_ON
|
||||
disp1->set_component_foreground_color("bt_on_off", 65535);
|
||||
disp1->show_component("bt_on_off");
|
||||
set_component_visibility->execute("bt_on_off", true);
|
||||
} else if (supported_features & 256 and state != "off") { //TURN_OFF
|
||||
disp1->set_component_foreground_color("bt_on_off", 10597);
|
||||
disp1->show_component("bt_on_off");
|
||||
} else disp1->hide_component("bt_on_off");
|
||||
set_component_visibility->execute("bt_on_off", true);
|
||||
} else
|
||||
set_component_visibility->execute("bt_on_off", false);
|
||||
|
||||
// play/pause button
|
||||
if ((supported_features & 512 or supported_features & 16384) and state != "playing" and state != "off") { //PLAY_MEDIA+PLAY
|
||||
disp1->set_component_text_printf("bt_play_pause", "%s", "\uE409"); // mdi:play
|
||||
disp1->show_component("bt_play_pause");
|
||||
set_component_visibility->execute("bt_play_pause", true);
|
||||
} else if (supported_features & 1 and state == "playing" ) { //PAUSE
|
||||
disp1->set_component_text_printf("bt_play_pause", "%s", "\uE3E3"); // mdi:pause
|
||||
disp1->show_component("bt_play_pause");
|
||||
} else disp1->hide_component("bt_play_pause");
|
||||
set_component_visibility->execute("bt_play_pause", true);
|
||||
} else
|
||||
set_component_visibility->execute("bt_play_pause", false);
|
||||
|
||||
// bt_prev button - PREVIOUS_TRACK
|
||||
if (supported_features & 16 and state != "off") disp1->show_component("bt_prev"); else disp1->hide_component("bt_prev");
|
||||
set_component_visibility->execute("bt_prev", (supported_features & 16 and state != "off"));
|
||||
// bt_next button - NEXT_TRACK
|
||||
if (supported_features & 32 and state != "off") disp1->show_component("bt_next"); else disp1->hide_component("bt_next");
|
||||
set_component_visibility->execute("bt_next", (supported_features & 32 and state != "off"));
|
||||
|
||||
// Stop button - STOP
|
||||
//if (supported_features & 4096 and (state == "playing" or state == "paused")) disp1->show_component("bt_stop"); else disp1->hide_component("bt_stop");
|
||||
//set_component_visibility->execute("bt_stop", (supported_features & 4096 and (state == "playing" or state == "paused")));
|
||||
|
||||
// mute/unmute button - VOLUME_MUTE
|
||||
disp1->set_component_value("is_muted", is_volume_muted ? 1 : 0);
|
||||
if (supported_features & 8 and is_volume_muted) { // unmute
|
||||
disp1->set_component_text_printf("bt_mute", "%s", "\uEE07"); // mdi:volume-variant-off
|
||||
disp1->show_component("bt_mute");
|
||||
set_component_visibility->execute("bt_mute", true);
|
||||
} else if (supported_features & 8) { // mute
|
||||
disp1->set_component_text_printf("bt_mute", "%s", "\uE57E"); // mdi:volume-low
|
||||
disp1->show_component("bt_mute");
|
||||
} else disp1->hide_component("bt_mute");
|
||||
set_component_visibility->execute("bt_mute", true);
|
||||
} else
|
||||
set_component_visibility->execute("bt_mute", false);
|
||||
|
||||
// VOLUME_SET
|
||||
if (supported_features & 4) {
|
||||
@@ -1167,15 +1168,15 @@ api:
|
||||
disp1->set_component_text_printf("vol_text", "%" PRIu32 "%%", volume_level);
|
||||
disp1->set_component_value("vol_slider", volume_level);
|
||||
}
|
||||
disp1->show_component("vol_slider");
|
||||
disp1->show_component("bt_vol_down");
|
||||
disp1->show_component("bt_vol_up");
|
||||
disp1->show_component("vol_text");
|
||||
set_component_visibility->execute("vol_slider", true);
|
||||
set_component_visibility->execute("bt_vol_down", true);
|
||||
set_component_visibility->execute("bt_vol_up", true);
|
||||
set_component_visibility->execute("vol_text", true);
|
||||
} else {
|
||||
disp1->hide_component("vol_slider");
|
||||
disp1->hide_component("bt_vol_down");
|
||||
disp1->hide_component("bt_vol_up");
|
||||
disp1->hide_component("vol_text");
|
||||
set_component_visibility->execute("vol_slider", false);
|
||||
set_component_visibility->execute("bt_vol_down", false);
|
||||
set_component_visibility->execute("bt_vol_up", false);
|
||||
set_component_visibility->execute("vol_text", false);
|
||||
}
|
||||
|
||||
if (media_duration > 0) {
|
||||
@@ -1186,14 +1187,14 @@ api:
|
||||
}
|
||||
disp1->set_component_value("prg_total", int(round(media_duration)));
|
||||
disp1->send_command_printf("prg_timer.en=%i", (state == "playing") ? 1 : 0);
|
||||
disp1->show_component("time_current");
|
||||
disp1->show_component("time_total");
|
||||
disp1->show_component("time_progress");
|
||||
set_component_visibility->execute("time_current", true);
|
||||
set_component_visibility->execute("time_total", true);
|
||||
set_component_visibility->execute("time_progress", true);
|
||||
} else {
|
||||
disp1->send_command_printf("prg_timer.en=0");
|
||||
disp1->hide_component("time_current");
|
||||
disp1->hide_component("time_total");
|
||||
disp1->hide_component("time_progress");
|
||||
set_component_visibility->execute("time_current", false);
|
||||
set_component_visibility->execute("time_total", false);
|
||||
set_component_visibility->execute("time_progress", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2317,7 +2318,6 @@ text_sensor:
|
||||
static const char *const TAG = "text_sensor.version_tft";
|
||||
ESP_LOGD(TAG, "TFT version: %s", x.c_str());
|
||||
if (current_page->state == "boot") {
|
||||
disp1->send_command_printf("tm_esphome.en=0");
|
||||
page_boot->execute();
|
||||
timer_reset_all->execute("boot");
|
||||
}
|
||||
@@ -2632,14 +2632,15 @@ script:
|
||||
static const char *const TAG = "script.page_boot";
|
||||
ESP_LOGV(TAG, "Construct boot page");
|
||||
set_brightness->execute(100);
|
||||
|
||||
disp1->set_component_text_printf("boot.esph_version", "${version}"); // ESPHome version
|
||||
#ifdef ARDUINO
|
||||
disp1->set_component_text_printf("framework", "Arduino");
|
||||
#elif defined(USE_ESP_IDF)
|
||||
disp1->set_component_text_printf("framework", "ESP-IDF");
|
||||
#endif
|
||||
disp1->send_command_printf("tm_esphome.en=0");
|
||||
if (current_page->state == "boot") {
|
||||
#ifdef ARDUINO
|
||||
disp1->set_component_text_printf("framework", "Arduino");
|
||||
#elif defined(USE_ESP_IDF)
|
||||
disp1->set_component_text_printf("framework", "ESP-IDF");
|
||||
#endif
|
||||
disp1->send_command_printf("tm_esphome.en=0");
|
||||
}
|
||||
|
||||
- id: page_buttonpage
|
||||
mode: restart
|
||||
@@ -2847,7 +2848,7 @@ script:
|
||||
if (id(screensaver_display_time)) {
|
||||
disp1->send_command_printf("screensaver.text.font=%i", id(screensaver_display_time_font));
|
||||
disp1->set_component_font_color("screensaver.text", id(screensaver_display_time_color));
|
||||
disp1->show_component("text");
|
||||
set_component_visibility->execute("screensaver.text", true);
|
||||
refresh_datetime->execute();
|
||||
} else {
|
||||
disp1->set_backlight_brightness(0.0f);
|
||||
@@ -2862,8 +2863,8 @@ script:
|
||||
static const char *const TAG = "script.page_settings";
|
||||
ESP_LOGV(TAG, "Construct settings page");
|
||||
//disp1->set_component_text_printf("bt_sleep", "%s", (id(sleep_mode).state) ? "\uEA19" : "\uEA18"); //mdi:toggle-switch-outline or mdi:toggle-switch-off-outline
|
||||
disp1->hide_component("lbl_sleep");
|
||||
disp1->hide_component("bt_sleep");
|
||||
set_component_visibility->execute("page_settings.lbl_sleep", false);
|
||||
set_component_visibility->execute("page_settings.bt_sleep", false);
|
||||
|
||||
- id: page_weather
|
||||
mode: restart
|
||||
@@ -2947,13 +2948,7 @@ script:
|
||||
bool is_notification = ((not notification_text->state.empty()) or (not notification_label->state.empty()));
|
||||
ESP_LOGV(TAG, "Notification: %s", YESNO(is_notification));
|
||||
disp1->send_command_printf("is_notification=%i", is_notification ? 1 : 0);
|
||||
if (current_page->state == "home") {
|
||||
if (is_notification) {
|
||||
disp1->show_component("bt_notific");
|
||||
} else {
|
||||
disp1->hide_component("bt_notific");
|
||||
}
|
||||
}
|
||||
set_component_visibility->execute("home.bt_notific", is_notification);
|
||||
- wait_until:
|
||||
condition:
|
||||
- lambda: return (blueprint_status->state > 99);
|
||||
@@ -2965,8 +2960,8 @@ script:
|
||||
then:
|
||||
- lambda: |-
|
||||
// Chips - Relays
|
||||
disp1->set_component_text_printf("home.icon_top_01", "%s", (relay_1->state) ? id(home_relay1_icon) : "\uFFFF");
|
||||
disp1->set_component_text_printf("home.icon_top_02", "%s", (relay_2->state) ? id(home_relay2_icon) : "\uFFFF");
|
||||
disp1->set_component_text_printf("home.chip_relay1", "%s", (relay_1->state) ? id(home_relay1_icon) : "\uFFFF");
|
||||
disp1->set_component_text_printf("home.chip_relay2", "%s", (relay_2->state) ? id(home_relay2_icon) : "\uFFFF");
|
||||
// Hardware buttons bars - Fallback mode
|
||||
if (id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay1_Local) disp1->send_command_printf("home.left_bt_pic.val=%i", (relay_1->state) ? 1 : 0);
|
||||
if (id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay2_Local) disp1->send_command_printf("home.right_bt_pic.val=%i", (relay_2->state) ? 1 : 0);
|
||||
@@ -3072,7 +3067,7 @@ script:
|
||||
- lambda: |-
|
||||
static const char *const TAG = "script.set_brightness";
|
||||
ESP_LOGD(TAG, "brightness: %.0f%%", brightness);
|
||||
if (brightness == display_brightness->state and current_page->state != "screensaver")
|
||||
if (brightness == display_brightness->state and current_page->state != "boot" and current_page->state != "screensaver")
|
||||
disp1->send_command_printf("wakeup_timer.en=1");
|
||||
else
|
||||
disp1->set_backlight_brightness(brightness / 100.0f);
|
||||
@@ -3115,7 +3110,7 @@ script:
|
||||
disp1->send_command_printf("slider_low.maxval=%i", total_steps);
|
||||
disp1->set_component_value("temp_offset", temp_offset);
|
||||
disp1->set_component_value("temp_step", temp_step);
|
||||
disp1->show_component("current_temp");
|
||||
set_component_visibility->execute("current_temp", true);
|
||||
if (current_temp > -999)
|
||||
disp1->set_component_text_printf("current_temp", "%.1f°", current_temp);
|
||||
else
|
||||
@@ -3123,50 +3118,65 @@ script:
|
||||
|
||||
if (target_temp > -999) { // Target temp enabled
|
||||
disp1->set_component_value("active_slider", 0);
|
||||
disp1->hide_component("slider_high");
|
||||
disp1->hide_component("slider_low");
|
||||
disp1->hide_component("target_low");
|
||||
disp1->set_component_text_printf("target_high", "%.1f°", target_temp);
|
||||
disp1->show_component("target_high");
|
||||
disp1->set_component_value("climateslider", round(((10*target_temp) - temp_offset) / temp_step));
|
||||
disp1->show_component("climateslider");
|
||||
set_component_visibility->execute("slider_high", false);
|
||||
set_component_visibility->execute("slider_low", false);
|
||||
set_component_visibility->execute("target_low", false);
|
||||
set_component_visibility->execute("target_high", true);
|
||||
set_component_visibility->execute("climateslider", true);
|
||||
} else {
|
||||
disp1->hide_component("slider_high");
|
||||
set_component_visibility->execute("climate.slider_high", false);
|
||||
if (target_temp_low > -999) { // Target temp low enabled
|
||||
disp1->set_component_value("active_slider", 2);
|
||||
disp1->set_component_text_printf("target_low", "%.1f°", target_temp_low);
|
||||
disp1->show_component("target_low");
|
||||
disp1->set_component_value("slider_low", round(((10*target_temp_low) - temp_offset) / temp_step));
|
||||
disp1->show_component("slider_low");
|
||||
set_component_visibility->execute("target_low", true);
|
||||
set_component_visibility->execute("slider_low", true);
|
||||
} else {
|
||||
disp1->hide_component("target_low");
|
||||
disp1->hide_component("slider_low");
|
||||
set_component_visibility->execute("target_low", false);
|
||||
set_component_visibility->execute("slider_low", false);
|
||||
}
|
||||
if (target_temp_high > -999) { // Target temp high enabled
|
||||
disp1->set_component_value("active_slider", 1);
|
||||
disp1->set_component_text_printf("target_high", "%.1f°", target_temp_high);
|
||||
disp1->show_component("target_high");
|
||||
disp1->set_component_value("slider_high", round(((10*target_temp_high) - temp_offset) / temp_step));
|
||||
disp1->show_component("slider_high");
|
||||
set_component_visibility->execute("target_high", true);
|
||||
set_component_visibility->execute("slider_high", true);
|
||||
} else {
|
||||
disp1->hide_component("target_high");
|
||||
disp1->hide_component("slider_high");
|
||||
set_component_visibility->execute("target_high", false);
|
||||
set_component_visibility->execute("slider_high", false);
|
||||
}
|
||||
}
|
||||
if (target_temp > -999 or target_temp_high > -999 or target_temp_low > -999) {
|
||||
disp1->set_component_text_printf("target_icon", "%s", climate_icon.c_str());
|
||||
disp1->show_component("target_icon");
|
||||
disp1->show_component("decrease_temp");
|
||||
disp1->show_component("increase_temp");
|
||||
set_component_visibility->execute("target_icon", true);
|
||||
set_component_visibility->execute("decrease_temp", true);
|
||||
set_component_visibility->execute("increase_temp", true);
|
||||
} else {
|
||||
disp1->hide_component("target_icon");
|
||||
disp1->hide_component("decrease_temp");
|
||||
disp1->hide_component("increase_temp");
|
||||
set_component_visibility->execute("target_icon", false);
|
||||
set_component_visibility->execute("decrease_temp", false);
|
||||
set_component_visibility->execute("increase_temp", false);
|
||||
}
|
||||
disp1->set_component_value("embedded", (embedded_climate) ? 1 : 0);
|
||||
}
|
||||
ESP_LOGD(TAG, "Finished");
|
||||
|
||||
- id: set_component_visibility
|
||||
mode: queued
|
||||
parameters:
|
||||
component_id: string
|
||||
show: bool
|
||||
then:
|
||||
- lambda: |-
|
||||
nspanel_ha_blueprint::NextionComponent component = nspanel_ha_blueprint::extractNextionComponent(component_id, current_page->state);
|
||||
if (component.is_current_page) {
|
||||
if (show)
|
||||
disp1->show_component(component.component_id);
|
||||
else
|
||||
disp1->hide_component(component.component_id);
|
||||
}
|
||||
|
||||
- id: setup_sequence
|
||||
mode: restart
|
||||
then:
|
||||
@@ -3283,8 +3293,8 @@ script:
|
||||
}
|
||||
// Chips icon size
|
||||
ESP_LOGV(TAG, "Adjusting icon's sizes");
|
||||
for (int i = 1; i <= 10; ++i) {
|
||||
disp1->send_command_printf("home.icon_top_%02d.font=%i", i, id(home_chip_font_id));
|
||||
for (int i = 1; i <= 7; ++i) {
|
||||
disp1->send_command_printf("home.chip%02d.font=%i", i, id(home_chip_font_id));
|
||||
}
|
||||
// Custom buttons icon size
|
||||
ESP_LOGV(TAG, "Adjusting custom buttons sizes");
|
||||
@@ -3296,8 +3306,8 @@ script:
|
||||
disp1->send_command_printf("home.bt_entities.font=%i", id(home_custom_buttons_font_id));
|
||||
disp1->send_command_printf("home.wifi_icon.font=%i", id(home_chip_font_id));
|
||||
ESP_LOGV(TAG, "Restoring relay's icon colors");
|
||||
disp1->set_component_font_color("home.icon_top_01", id(home_relay1_icon_color));
|
||||
disp1->set_component_font_color("home.icon_top_02", id(home_relay2_icon_color));
|
||||
disp1->set_component_font_color("home.chip_relay1", id(home_relay1_icon_color));
|
||||
disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color));
|
||||
timer_reset_all->execute("boot");
|
||||
notification_clear->execute();
|
||||
id(setup_sequence_completed) = true;
|
||||
|
||||
Reference in New Issue
Block a user