Add boot progress bar
This commit is contained in:
@@ -125,7 +125,7 @@ script:
|
|||||||
bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
|
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_printf("page_label", id(addon_climate_friendly_name).c_str());
|
disp1->set_component_text("page_label", id(addon_climate_friendly_name).c_str());
|
||||||
float temp_step = traits.get_visual_target_temperature_step();
|
float temp_step = traits.get_visual_target_temperature_step();
|
||||||
float temp_offset = traits.get_visual_min_temperature();
|
float temp_offset = traits.get_visual_min_temperature();
|
||||||
float temp_max = traits.get_visual_max_temperature();
|
float temp_max = traits.get_visual_max_temperature();
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ api:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (!id(is_uploading_tft)) {
|
if (!id(is_uploading_tft)) {
|
||||||
nspanel_ha_blueprint::HomeAssistantEntity entity_id = nspanel_ha_blueprint::extractHomeAssistantEntity(entity);
|
HomeAssistantEntity entity_id = extractHomeAssistantEntity(entity);
|
||||||
if (entity_id.domain != "invalid" or entity == "embedded_climate") {
|
if (entity_id.domain != "invalid" or entity == "embedded_climate") {
|
||||||
detailed_entity->publish_state(entity);
|
detailed_entity->publish_state(entity);
|
||||||
if (entity_id.domain == "alarm_control_panel") entity_id.domain = "alarm";
|
if (entity_id.domain == "alarm_control_panel") entity_id.domain = "alarm";
|
||||||
@@ -351,9 +351,7 @@ api:
|
|||||||
|
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (!id(is_uploading_tft)) {
|
if (!id(is_uploading_tft)) {
|
||||||
using namespace nspanel_ha_blueprint;
|
|
||||||
using namespace esphome::display;
|
using namespace esphome::display;
|
||||||
|
|
||||||
// Relay settings
|
// Relay settings
|
||||||
update_bitwise_setting(id(relay_settings), relay1_local_control, RelaySettings::Relay1_Local);
|
update_bitwise_setting(id(relay_settings), relay1_local_control, RelaySettings::Relay1_Local);
|
||||||
update_bitwise_setting(id(relay_settings), relay1_fallback, RelaySettings::Relay1_Fallback);
|
update_bitwise_setting(id(relay_settings), relay1_fallback, RelaySettings::Relay1_Fallback);
|
||||||
@@ -417,6 +415,7 @@ api:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (!id(is_uploading_tft)) {
|
if (!id(is_uploading_tft)) {
|
||||||
|
using namespace esphome::display;
|
||||||
// Localization
|
// Localization
|
||||||
id(mui_time_format) = time_format;
|
id(mui_time_format) = time_format;
|
||||||
if (meridiem.size() == 2) {
|
if (meridiem.size() == 2) {
|
||||||
@@ -425,8 +424,8 @@ api:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Date/Time colors
|
// Date/Time colors
|
||||||
id(home_date_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(date_color[0], date_color[1], date_color[2]));
|
id(home_date_color) = ColorUtil::color_to_565(esphome::Color(date_color[0], date_color[1], date_color[2]));
|
||||||
id(home_time_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(time_color[0], time_color[1], time_color[2]));
|
id(home_time_color) = ColorUtil::color_to_565(esphome::Color(time_color[0], time_color[1], time_color[2]));
|
||||||
disp1->set_component_font_color("home.date", id(home_date_color));
|
disp1->set_component_font_color("home.date", id(home_date_color));
|
||||||
disp1->set_component_font_color("home.time", id(home_time_color));
|
disp1->set_component_font_color("home.time", id(home_time_color));
|
||||||
|
|
||||||
@@ -455,20 +454,22 @@ api:
|
|||||||
// QRCode button
|
// QRCode button
|
||||||
set_component_visibility->execute("home.bt_qrcode", qrcode);
|
set_component_visibility->execute("home.bt_qrcode", qrcode);
|
||||||
disp1->set_component_text("home.bt_qrcode", qrcode_icon.c_str());
|
disp1->set_component_text("home.bt_qrcode", qrcode_icon.c_str());
|
||||||
disp1->set_component_font_color("home.bt_qrcode", esphome::display::ColorUtil::color_to_565(esphome::Color(qrcode_icon_color[0], qrcode_icon_color[1], qrcode_icon_color[2])));
|
disp1->set_component_font_color("home.bt_qrcode", ColorUtil::color_to_565(esphome::Color(qrcode_icon_color[0],
|
||||||
|
qrcode_icon_color[1],
|
||||||
|
qrcode_icon_color[2])));
|
||||||
|
|
||||||
// Entities pages button
|
// Entities pages button
|
||||||
disp1->set_component_text("home.bt_entities", entities_pages_icon.c_str());
|
disp1->set_component_text("home.bt_entities", entities_pages_icon.c_str());
|
||||||
disp1->set_component_font_color("home.bt_entities", esphome::display::ColorUtil::color_to_565(esphome::Color(entities_pages_icon_color[0],
|
disp1->set_component_font_color("home.bt_entities", ColorUtil::color_to_565(esphome::Color(entities_pages_icon_color[0],
|
||||||
entities_pages_icon_color[1],
|
entities_pages_icon_color[1],
|
||||||
entities_pages_icon_color[2])));
|
entities_pages_icon_color[2])));
|
||||||
|
|
||||||
// Utilities button
|
// Utilities button
|
||||||
disp1->send_command_printf("is_utilities=%i", utilities ? 1 : 0);
|
disp1->send_command_printf("is_utilities=%i", utilities ? 1 : 0);
|
||||||
disp1->set_component_text("home.bt_utilities", utilities_icon.c_str());
|
disp1->set_component_text("home.bt_utilities", utilities_icon.c_str());
|
||||||
disp1->set_component_font_color("home.bt_utilities", esphome::display::ColorUtil::color_to_565(esphome::Color(utilities_icon_color[0],
|
disp1->set_component_font_color("home.bt_utilities", ColorUtil::color_to_565(esphome::Color(utilities_icon_color[0],
|
||||||
utilities_icon_color[1],
|
utilities_icon_color[1],
|
||||||
utilities_icon_color[2])));
|
utilities_icon_color[2])));
|
||||||
|
|
||||||
blueprint_status->publish_state(int(blueprint_status->raw_state) | (1 << 1));
|
blueprint_status->publish_state(int(blueprint_status->raw_state) | (1 << 1));
|
||||||
}
|
}
|
||||||
@@ -778,18 +779,19 @@ api:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (!id(is_uploading_tft) and !(id.empty())) {
|
if (!id(is_uploading_tft) and !(id.empty())) {
|
||||||
|
using namespace esphome::display;
|
||||||
if (!(icon.empty())) disp1->set_component_text((id + "_icon").c_str(), icon.c_str());
|
if (!(icon.empty())) disp1->set_component_text((id + "_icon").c_str(), icon.c_str());
|
||||||
if (icon_color.size() == 3)
|
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],
|
disp1->set_component_font_color((id + "_icon").c_str(), ColorUtil::color_to_565(esphome::Color(icon_color[0],
|
||||||
icon_color[1],
|
icon_color[1],
|
||||||
icon_color[2])));
|
icon_color[2])));
|
||||||
|
|
||||||
if (!(name.empty())) disp1->set_component_text((id + "_label").c_str(), name.c_str());
|
if (!(name.empty())) disp1->set_component_text((id + "_label").c_str(), name.c_str());
|
||||||
if (!(value.empty())) disp1->set_component_text(id.c_str(), adjustDecimalSeparator(value, id(mui_decimal_separator)).c_str());
|
if (!(value.empty())) disp1->set_component_text(id.c_str(), adjustDecimalSeparator(value, id(mui_decimal_separator)).c_str());
|
||||||
if (value_color.size() == 3)
|
if (value_color.size() == 3)
|
||||||
disp1->set_component_font_color(id.c_str(), esphome::display::ColorUtil::color_to_565(esphome::Color(value_color[0],
|
disp1->set_component_font_color(id.c_str(), ColorUtil::color_to_565(esphome::Color(value_color[0],
|
||||||
value_color[1],
|
value_color[1],
|
||||||
value_color[2])));
|
value_color[2])));
|
||||||
if (current_page->state.find("entitypage") == 0 and !(value.empty())) { // Adjust value's font on entities pages
|
if (current_page->state.find("entitypage") == 0 and !(value.empty())) { // Adjust value's font on entities pages
|
||||||
// Adjusted length starts at 0
|
// Adjusted length starts at 0
|
||||||
float adjusted_length = 0.0;
|
float adjusted_length = 0.0;
|
||||||
@@ -835,7 +837,7 @@ display:
|
|||||||
- id: disp1
|
- id: disp1
|
||||||
platform: nextion
|
platform: nextion
|
||||||
uart_id: tf_uart
|
uart_id: tf_uart
|
||||||
# start_up_page: 8 # Boot page
|
start_up_page: 8 # Boot page
|
||||||
on_setup:
|
on_setup:
|
||||||
lambda: |-
|
lambda: |-
|
||||||
nextion_init->publish_state(true);
|
nextion_init->publish_state(true);
|
||||||
@@ -1095,9 +1097,9 @@ binary_sensor:
|
|||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
or:
|
or:
|
||||||
- lambda: return (id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay1_Local);
|
- lambda: return (id(relay_settings) & RelaySettings::Relay1_Local);
|
||||||
- and:
|
- and:
|
||||||
- lambda: return (id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay1_Fallback);
|
- lambda: return (id(relay_settings) & RelaySettings::Relay1_Fallback);
|
||||||
- or:
|
- or:
|
||||||
- not:
|
- not:
|
||||||
- api.connected:
|
- api.connected:
|
||||||
@@ -1135,9 +1137,9 @@ binary_sensor:
|
|||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
or:
|
or:
|
||||||
- lambda: return (id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay2_Local);
|
- lambda: return (id(relay_settings) & RelaySettings::Relay2_Local);
|
||||||
- and:
|
- and:
|
||||||
- lambda: return (id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay2_Fallback);
|
- lambda: return (id(relay_settings) & RelaySettings::Relay2_Fallback);
|
||||||
- or:
|
- or:
|
||||||
- not:
|
- not:
|
||||||
- api.connected:
|
- api.connected:
|
||||||
@@ -1592,8 +1594,7 @@ switch:
|
|||||||
- lambda: !lambda return disp1->is_setup();
|
- lambda: !lambda return disp1->is_setup();
|
||||||
timeout: 20s
|
timeout: 20s
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
nextion_init->publish_state(disp1->is_setup());
|
goto_page->execute("boot");
|
||||||
goto_page->execute(wakeup_page_name->state.c_str());
|
|
||||||
on_turn_off:
|
on_turn_off:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
nextion_init->publish_state(false);
|
nextion_init->publish_state(false);
|
||||||
@@ -1648,7 +1649,7 @@ text_sensor:
|
|||||||
on_value:
|
on_value:
|
||||||
lambda: |-
|
lambda: |-
|
||||||
if (!id(is_uploading_tft)) {
|
if (!id(is_uploading_tft)) {
|
||||||
page_changed->execute(x.c_str());
|
page_changed->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
- id: notification_label
|
- id: notification_label
|
||||||
@@ -1916,10 +1917,10 @@ script:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (id(is_uploading_tft)) global_settings->stop();
|
if (id(is_uploading_tft)) global_settings->stop();
|
||||||
|
if (blueprint_status->state <= 99) goto_page->execute("boot");
|
||||||
// Blueprint version
|
// Blueprint version
|
||||||
nspanel_ha_blueprint::copyStringToCharArray(id(version_blueprint), blueprint_version);
|
copyStringToCharArray(id(version_blueprint), blueprint_version);
|
||||||
disp1->set_component_text("boot.bluep_version", blueprint_version.c_str());
|
disp1->set_component_text("boot.bluep_version", blueprint_version.c_str());
|
||||||
// if (current_page->state == "boot") page_boot->execute();
|
|
||||||
check_versions->execute();
|
check_versions->execute();
|
||||||
|
|
||||||
// MUI strings
|
// MUI strings
|
||||||
@@ -1929,7 +1930,9 @@ script:
|
|||||||
// Screen saver page (sleep)
|
// Screen saver page (sleep)
|
||||||
id(screensaver_display_time) = screensaver_time;
|
id(screensaver_display_time) = screensaver_time;
|
||||||
id(screensaver_display_time_font) = screensaver_time_font;
|
id(screensaver_display_time_font) = screensaver_time_font;
|
||||||
id(screensaver_display_time_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(screensaver_time_color[0], screensaver_time_color[1], screensaver_time_color[2]));
|
id(screensaver_display_time_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(screensaver_time_color[0],
|
||||||
|
screensaver_time_color[1],
|
||||||
|
screensaver_time_color[2]));
|
||||||
page_screensaver->execute();
|
page_screensaver->execute();
|
||||||
|
|
||||||
// Entities pages alignment
|
// Entities pages alignment
|
||||||
@@ -1940,39 +1943,8 @@ script:
|
|||||||
|
|
||||||
if (current_page->state != "boot") {
|
if (current_page->state != "boot") {
|
||||||
// Update current page
|
// Update current page
|
||||||
page_changed->execute(current_page->state.c_str());
|
page_changed->execute();
|
||||||
}
|
}
|
||||||
disp1->set_component_text("boot.bluep_version", blueprint_version.c_str());
|
|
||||||
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
- text_sensor.state: # Is boot page visible?
|
|
||||||
id: current_page
|
|
||||||
state: boot
|
|
||||||
then:
|
|
||||||
- wait_until:
|
|
||||||
condition:
|
|
||||||
- not:
|
|
||||||
- text_sensor.state: # Is boot page visible?
|
|
||||||
id: current_page
|
|
||||||
state: boot
|
|
||||||
timeout: 2s
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
- text_sensor.state: # Avoid this being called twice by multiple boot triggers
|
|
||||||
id: current_page
|
|
||||||
state: boot
|
|
||||||
then:
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
switch.is_on: notification_sound
|
|
||||||
then:
|
|
||||||
- rtttl.play:
|
|
||||||
rtttl: 'two short:d=4,o=5,b=100:16e6,16e6'
|
|
||||||
- lambda: |-
|
|
||||||
ESP_LOGD("script.global_settings", "Jump to wake-up page: %s", wakeup_page_name->state.c_str());
|
|
||||||
goto_page->execute(wakeup_page_name->state.c_str());
|
|
||||||
timer_reset_all->execute();
|
|
||||||
|
|
||||||
- id: goto_page
|
- id: goto_page
|
||||||
mode: restart
|
mode: restart
|
||||||
@@ -1980,6 +1952,7 @@ script:
|
|||||||
page: string
|
page: string
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
ESP_LOGW("DEBUG", "goto_page: from %s to %s", current_page->state.c_str(), page.c_str());
|
||||||
if (current_page->state != page)
|
if (current_page->state != page)
|
||||||
disp1->goto_page(page.c_str());
|
disp1->goto_page(page.c_str());
|
||||||
|
|
||||||
@@ -2064,16 +2037,17 @@ script:
|
|||||||
then:
|
then:
|
||||||
- logger.log: Page boot called
|
- logger.log: Page boot called
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
boot_progress->execute(0);
|
||||||
set_brightness->execute(100);
|
set_brightness->execute(100);
|
||||||
update_tft_info->execute();
|
update_tft_info->execute();
|
||||||
disp1->set_component_text_printf("boot.esph_version", "${version}"); // ESPHome version
|
disp1->set_component_text_printf("boot.esph_version", "${version}"); // ESPHome version
|
||||||
if (current_page->state == "boot") {
|
boot_progress->execute(1);
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
disp1->set_component_text("framework", "Arduino");
|
disp1->set_component_text("framework", "Arduino");
|
||||||
#elif defined(USE_ESP_IDF)
|
#elif defined(USE_ESP_IDF)
|
||||||
disp1->set_component_text("framework", "ESP-IDF");
|
disp1->set_component_text("framework", "ESP-IDF");
|
||||||
#endif
|
#endif
|
||||||
}
|
boot_progress->execute(2);
|
||||||
- logger.log: Wait for Wi-Fi
|
- logger.log: Wait for Wi-Fi
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
@@ -2083,11 +2057,14 @@ script:
|
|||||||
condition:
|
condition:
|
||||||
- lambda: return (wifi_component->is_connected());
|
- lambda: return (wifi_component->is_connected());
|
||||||
then: # Wi-Fi connected
|
then: # Wi-Fi connected
|
||||||
|
- logger.log: Wi-Fi connected
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
boot_progress->execute(3);
|
||||||
if (current_page->state == "boot") {
|
if (current_page->state == "boot") {
|
||||||
disp1->set_component_text("ip_addr", network::get_ip_address().str().c_str()); // To do: get_ip_addresses()[0]
|
disp1->set_component_text("ip_addr", network::get_ip_address().str().c_str()); // To do: get_ip_addresses()[0]
|
||||||
set_brightness->execute(100);
|
set_brightness->execute(100);
|
||||||
}
|
}
|
||||||
|
- logger.log: Wait for API
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: return (api_server->is_connected());
|
- lambda: return (api_server->is_connected());
|
||||||
@@ -2096,25 +2073,31 @@ script:
|
|||||||
condition:
|
condition:
|
||||||
- lambda: return (api_server->is_connected());
|
- lambda: return (api_server->is_connected());
|
||||||
then: # API connected
|
then: # API connected
|
||||||
|
- logger.log: API connected
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
esphome::api::CustomAPIDevice ha_event;
|
boot_progress->execute(4);
|
||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
if (blueprint_status->state <= 99) {
|
||||||
{
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
{"device_name", device_name->state.c_str()},
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{"type", "boot"},
|
{
|
||||||
{"step", "start"}
|
{"device_name", device_name->state.c_str()},
|
||||||
});
|
{"type", "boot"},
|
||||||
|
{"step", "start"}
|
||||||
|
});
|
||||||
|
}
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: return (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99);
|
- lambda: return (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99);
|
||||||
timeout: 2s
|
timeout: 5s
|
||||||
|
- rtttl.play: "DEBUG:d=8,o=5,b=100:e6"
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
set_brightness->execute(display_brightness->state);
|
boot_progress->execute(5);
|
||||||
disp1->send_command_printf("brightness=%i", int(display_brightness->state));
|
disp1->send_command_printf("brightness=%i", int(display_brightness->state));
|
||||||
disp1->set_component_value("settings.brightslider", int(display_brightness->state));
|
disp1->set_component_value("settings.brightslider", int(display_brightness->state));
|
||||||
disp1->send_command_printf("brightness_dim=%i", int(display_dim_brightness->state));
|
disp1->send_command_printf("brightness_dim=%i", int(display_dim_brightness->state));
|
||||||
disp1->set_component_value("settings.dimslider", int(display_dim_brightness->state));
|
disp1->set_component_value("settings.dimslider", int(display_dim_brightness->state));
|
||||||
disp1->send_command_printf("brightness_sleep=%i", int(display_sleep_brightness->state));
|
disp1->send_command_printf("brightness_sleep=%i", int(display_sleep_brightness->state));
|
||||||
|
boot_progress->execute(6);
|
||||||
nextion_init->publish_state(disp1->is_setup());
|
nextion_init->publish_state(disp1->is_setup());
|
||||||
if (api_server->is_connected() and disp1->is_setup()) {
|
if (api_server->is_connected() and disp1->is_setup()) {
|
||||||
esphome::api::CustomAPIDevice ha_event;
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
@@ -2125,6 +2108,7 @@ script:
|
|||||||
{"step", "nextion_init"}
|
{"step", "nextion_init"}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
boot_progress->execute(7);
|
||||||
// Chips icon size
|
// Chips icon size
|
||||||
for (int i = 1; i <= 7; ++i) {
|
for (int i = 1; i <= 7; ++i) {
|
||||||
disp1->send_command_printf("home.chip%02d.font=%i", i, id(home_chip_font_id));
|
disp1->send_command_printf("home.chip%02d.font=%i", i, id(home_chip_font_id));
|
||||||
@@ -2139,17 +2123,34 @@ script:
|
|||||||
disp1->set_component_font("home.wifi_icon", id(home_chip_font_id));
|
disp1->set_component_font("home.wifi_icon", id(home_chip_font_id));
|
||||||
disp1->set_component_font_color("home.chip_relay1", id(home_relay1_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));
|
disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color));
|
||||||
timer_reset_all->execute();
|
boot_progress->execute(8);
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- not:
|
- lambda: return (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99);
|
||||||
- text_sensor.state: # Is boot page visible?
|
|
||||||
id: current_page
|
|
||||||
state: boot
|
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
|
- delay: 5s
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (current_page->state == "boot") {
|
boot_progress->execute(9);
|
||||||
goto_page->execute(wakeup_page_name->state.c_str());
|
if (notification_sound->state) buzzer->play("two short:d=4,o=5,b=100:16e6,16e6");
|
||||||
|
boot_progress->execute(10);
|
||||||
|
set_brightness->execute(display_brightness->state);
|
||||||
|
ESP_LOGD("script.page_boot", "Jump to wake-up page: %s", wakeup_page_name->state.c_str());
|
||||||
|
goto_page->execute(wakeup_page_name->state.c_str());
|
||||||
|
|
||||||
|
- id: boot_progress
|
||||||
|
mode: restart
|
||||||
|
parameters:
|
||||||
|
step: uint
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
timer_reset_all->execute();
|
||||||
|
if (step == 10) {
|
||||||
|
ESP_LOGD("script.boot_progress", "Progress: Completed");
|
||||||
|
disp1->set_component_value("boot.progress", 100);
|
||||||
|
} else {
|
||||||
|
step = int(round((blueprint_status->state + (step/10))/2));
|
||||||
|
ESP_LOGD("script.boot_progress", "Progress: %i%%", step);
|
||||||
|
disp1->set_component_value("boot.progress", step);
|
||||||
}
|
}
|
||||||
|
|
||||||
- id: page_buttonpage
|
- id: page_buttonpage
|
||||||
@@ -2184,29 +2185,24 @@ script:
|
|||||||
|
|
||||||
- id: page_changed
|
- id: page_changed
|
||||||
mode: restart
|
mode: restart
|
||||||
parameters:
|
|
||||||
page: string
|
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
// Report new page to logs
|
// Report new page to logs
|
||||||
ESP_LOGD("script.page_changed", "New page: %s", page.c_str());
|
ESP_LOGD("script.page_changed", "New page: %s", current_page->state.c_str());
|
||||||
// Go to boot page if not initiated
|
|
||||||
if (not nextion_init->state) {
|
|
||||||
goto_page->execute("boot");
|
|
||||||
}
|
|
||||||
// Reset globals
|
// Reset globals
|
||||||
if (page != "alarm" &&
|
if (current_page->state != "alarm" &&
|
||||||
page != "climate" &&
|
current_page->state != "climate" &&
|
||||||
page != "cover" &&
|
current_page->state != "cover" &&
|
||||||
page != "fan" &&
|
current_page->state != "fan" &&
|
||||||
page != "light" &&
|
current_page->state != "light" &&
|
||||||
page != "media_player" &&
|
current_page->state != "media_player" &&
|
||||||
page != "confirm" &&
|
current_page->state != "confirm" &&
|
||||||
page != "keyb_num") {
|
current_page->state != "keyb_num") {
|
||||||
detailed_entity->publish_state("");
|
detailed_entity->publish_state("");
|
||||||
disp1->send_command_printf("back_page_id=0");
|
disp1->send_command_printf("back_page_id=0");
|
||||||
}
|
}
|
||||||
if (page != "media_player") {
|
if (current_page->state != "media_player") {
|
||||||
id(last_volume_level) = 0;
|
id(last_volume_level) = 0;
|
||||||
id(last_media_duration) = 0;
|
id(last_media_duration) = 0;
|
||||||
id(last_media_position) = 0;
|
id(last_media_position) = 0;
|
||||||
@@ -2219,7 +2215,7 @@ script:
|
|||||||
refresh_hardware_buttons_bars->execute();
|
refresh_hardware_buttons_bars->execute();
|
||||||
|
|
||||||
// Reset timers
|
// Reset timers
|
||||||
timer_reset_all->execute();
|
if (current_page->state != "screensaver") timer_reset_all->execute();
|
||||||
|
|
||||||
// Report new page to Home Assistant
|
// Report new page to Home Assistant
|
||||||
esphome::api::CustomAPIDevice ha_event;
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
@@ -2227,40 +2223,40 @@ script:
|
|||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
{"type", "page_changed"},
|
{"type", "page_changed"},
|
||||||
{"page", page.c_str()},
|
{"page", current_page->state.c_str()},
|
||||||
{"entity", detailed_entity->state.c_str()}
|
{"entity", detailed_entity->state.c_str()}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Call page constructor
|
// Call page constructor
|
||||||
if (page == "alarm") page_alarm->execute();
|
if (current_page->state == "alarm") page_alarm->execute();
|
||||||
else if (page == "blank") page_blank->execute();
|
else if (current_page->state == "blank") page_blank->execute();
|
||||||
else if (page == "boot") page_boot->execute();
|
else if (current_page->state == "boot") page_boot->execute();
|
||||||
else if (page == "buttonpage01") page_buttonpage01->execute();
|
else if (current_page->state == "buttonpage01") page_buttonpage01->execute();
|
||||||
else if (page == "buttonpage02") page_buttonpage02->execute();
|
else if (current_page->state == "buttonpage02") page_buttonpage02->execute();
|
||||||
else if (page == "buttonpage03") page_buttonpage03->execute();
|
else if (current_page->state == "buttonpage03") page_buttonpage03->execute();
|
||||||
else if (page == "buttonpage04") page_buttonpage04->execute();
|
else if (current_page->state == "buttonpage04") page_buttonpage04->execute();
|
||||||
else if (page == "climate") page_climate->execute();
|
else if (current_page->state == "climate") page_climate->execute();
|
||||||
else if (page == "confirm") page_confirm->execute();
|
else if (current_page->state == "confirm") page_confirm->execute();
|
||||||
else if (page == "cover") page_cover->execute();
|
else if (current_page->state == "cover") page_cover->execute();
|
||||||
else if (page == "entitypage01") page_entitypage01->execute();
|
else if (current_page->state == "entitypage01") page_entitypage01->execute();
|
||||||
else if (page == "entitypage02") page_entitypage02->execute();
|
else if (current_page->state == "entitypage02") page_entitypage02->execute();
|
||||||
else if (page == "entitypage03") page_entitypage03->execute();
|
else if (current_page->state == "entitypage03") page_entitypage03->execute();
|
||||||
else if (page == "entitypage04") page_entitypage04->execute();
|
else if (current_page->state == "entitypage04") page_entitypage04->execute();
|
||||||
else if (page == "fan") page_fan->execute();
|
else if (current_page->state == "fan") page_fan->execute();
|
||||||
else if (page == "home") page_home->execute();
|
else if (current_page->state == "home") page_home->execute();
|
||||||
else if (page == "keyb_num") page_keyb_num->execute();
|
else if (current_page->state == "keyb_num") page_keyb_num->execute();
|
||||||
else if (page == "light") page_light->execute();
|
else if (current_page->state == "light") page_light->execute();
|
||||||
else if (page == "media_player") page_media_player->execute();
|
else if (current_page->state == "media_player") page_media_player->execute();
|
||||||
else if (page == "notification") page_notification->execute();
|
else if (current_page->state == "notification") page_notification->execute();
|
||||||
else if (page == "qrcode") page_qrcode->execute();
|
else if (current_page->state == "qrcode") page_qrcode->execute();
|
||||||
else if (page == "screensaver") page_screensaver->execute();
|
else if (current_page->state == "screensaver") page_screensaver->execute();
|
||||||
else if (page == "settings") page_settings->execute();
|
else if (current_page->state == "settings") page_settings->execute();
|
||||||
else if (page == "utilities") page_utilities->execute();
|
else if (current_page->state == "utilities") page_utilities->execute();
|
||||||
else if (page == "weather01") page_weather01->execute();
|
else if (current_page->state == "weather01") page_weather01->execute();
|
||||||
else if (page == "weather02") page_weather02->execute();
|
else if (current_page->state == "weather02") page_weather02->execute();
|
||||||
else if (page == "weather03") page_weather03->execute();
|
else if (current_page->state == "weather03") page_weather03->execute();
|
||||||
else if (page == "weather04") page_weather04->execute();
|
else if (current_page->state == "weather04") page_weather04->execute();
|
||||||
else if (page == "weather05") page_weather05->execute();
|
else if (current_page->state == "weather05") page_weather05->execute();
|
||||||
- delay: 1s
|
- delay: 1s
|
||||||
- script.execute: refresh_hardware_buttons_bars
|
- script.execute: refresh_hardware_buttons_bars
|
||||||
|
|
||||||
@@ -2710,7 +2706,7 @@ script:
|
|||||||
show: bool
|
show: bool
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
nspanel_ha_blueprint::NextionComponent component = nspanel_ha_blueprint::extractNextionComponent(component_id, current_page->state);
|
NextionComponent component = extractNextionComponent(component_id, current_page->state);
|
||||||
if (component.is_current_page) disp1->send_command_printf("vis %s,%i", component.component_id.c_str(), show ? 1 : 0);
|
if (component.is_current_page) disp1->send_command_printf("vis %s,%i", component.component_id.c_str(), show ? 1 : 0);
|
||||||
|
|
||||||
- id: stop_all
|
- id: stop_all
|
||||||
|
|||||||
@@ -159,6 +159,14 @@ Text unavailable
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 1
|
Max. Text Size : 1
|
||||||
|
|
||||||
|
Progress Bar progress
|
||||||
|
Attributes
|
||||||
|
ID : 17
|
||||||
|
Scope : global
|
||||||
|
Dragging : 0
|
||||||
|
Send Component ID: disabled
|
||||||
|
Value : 0
|
||||||
|
|
||||||
Dual-state Button bt_reboot
|
Dual-state Button bt_reboot
|
||||||
Attributes
|
Attributes
|
||||||
ID : 4
|
ID : 4
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ Page home
|
|||||||
|
|
||||||
Events
|
Events
|
||||||
Preinitialize Event
|
Preinitialize Event
|
||||||
|
if(boot.progress.val<100)
|
||||||
|
{
|
||||||
|
page boot
|
||||||
|
}
|
||||||
printh 92
|
printh 92
|
||||||
prints "current_page",0
|
prints "current_page",0
|
||||||
printh 00
|
printh 00
|
||||||
|
|||||||
@@ -166,6 +166,14 @@ Text unavailable
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 1
|
Max. Text Size : 1
|
||||||
|
|
||||||
|
Progress Bar progress
|
||||||
|
Attributes
|
||||||
|
ID : 17
|
||||||
|
Scope : global
|
||||||
|
Dragging : 0
|
||||||
|
Send Component ID: disabled
|
||||||
|
Value : 0
|
||||||
|
|
||||||
Dual-state Button bt_reboot
|
Dual-state Button bt_reboot
|
||||||
Attributes
|
Attributes
|
||||||
ID : 4
|
ID : 4
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ Page home
|
|||||||
|
|
||||||
Events
|
Events
|
||||||
Preinitialize Event
|
Preinitialize Event
|
||||||
|
if(boot.progress.val<100)
|
||||||
|
{
|
||||||
|
page boot
|
||||||
|
}
|
||||||
printh 92
|
printh 92
|
||||||
prints "current_page",0
|
prints "current_page",0
|
||||||
printh 00
|
printh 00
|
||||||
|
|||||||
@@ -159,6 +159,14 @@ Text unavailable
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 1
|
Max. Text Size : 1
|
||||||
|
|
||||||
|
Progress Bar progress
|
||||||
|
Attributes
|
||||||
|
ID : 17
|
||||||
|
Scope : global
|
||||||
|
Dragging : 0
|
||||||
|
Send Component ID: disabled
|
||||||
|
Value : 0
|
||||||
|
|
||||||
Dual-state Button bt_reboot
|
Dual-state Button bt_reboot
|
||||||
Attributes
|
Attributes
|
||||||
ID : 4
|
ID : 4
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ Page home
|
|||||||
|
|
||||||
Events
|
Events
|
||||||
Preinitialize Event
|
Preinitialize Event
|
||||||
|
if(boot.progress.val<100)
|
||||||
|
{
|
||||||
|
page boot
|
||||||
|
}
|
||||||
printh 92
|
printh 92
|
||||||
prints "current_page",0
|
prints "current_page",0
|
||||||
printh 00
|
printh 00
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user