@@ -398,9 +398,6 @@ api:
|
||||
disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color));
|
||||
}
|
||||
|
||||
// Refresh relays display
|
||||
refresh_relays->execute();
|
||||
|
||||
// Buttons bars settings
|
||||
id(buttons_bars_pages) = button_bar_pages;
|
||||
update_bitwise_setting(id(buttons_settings), button_left, ButtonSettings::ButtonLeft_Enabled);
|
||||
@@ -415,8 +412,8 @@ api:
|
||||
button_bar_color_off[1],
|
||||
button_bar_color_off[2]));
|
||||
|
||||
// Refresh buttons bars display
|
||||
refresh_hardware_buttons_bars->execute();
|
||||
// Refresh relays display
|
||||
refresh_relays->execute();
|
||||
}
|
||||
blueprint_status->publish_state(int(blueprint_status->raw_state) | (1 << 4));
|
||||
# Sets up the "Home" page in ESPHome with customized settings and UI elements as defined in the project blueprint.
|
||||
@@ -2397,35 +2394,42 @@ script:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (!id(is_uploading_tft) and ((id(buttons_bars_pages) & (1 << get_page_id(current_page->state.c_str()))) != 0)) {
|
||||
// Hardware buttons bars - Fallback mode
|
||||
bool bt_left_enabled = id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled;
|
||||
bool bt_left_local = ((id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay1_Local) and relay_1->state);
|
||||
bool bt_left_from_api = id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State;
|
||||
bool bt_right_enabled = id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled;
|
||||
bool bt_right_local = ((id(relay_settings) & nspanel_ha_blueprint::RelaySettings::Relay2_Local) and relay_2->state);
|
||||
bool bt_right_from_api = id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State;
|
||||
switch (int(display_mode->state)) {
|
||||
case 1: // EU model
|
||||
if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button
|
||||
disp1->fill_area(48, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(47, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
if (bt_left_enabled) { // Left button
|
||||
disp1->fill_area(48, 307, 118, 3, (bt_left_local or bt_left_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(47, 308, 120, 1, (bt_left_local or bt_left_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
}
|
||||
if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button
|
||||
disp1->fill_area(289, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(288, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
if (bt_right_enabled) { // Right button
|
||||
disp1->fill_area(289, 307, 118, 3, (bt_right_local or bt_right_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(288, 308, 120, 1, (bt_right_local or bt_right_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
}
|
||||
break;
|
||||
case 2: // US Portrait
|
||||
if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button
|
||||
disp1->fill_area(17, 466, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(16, 467, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
if (bt_left_enabled) { // Left button
|
||||
disp1->fill_area(17, 466, 118, 3, (bt_left_local or bt_left_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(16, 467, 120, 1, (bt_left_local or bt_left_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
}
|
||||
if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button
|
||||
disp1->fill_area(184, 466, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(183, 467, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
if (bt_right_enabled) { // Right button
|
||||
disp1->fill_area(184, 466, 118, 3, (bt_right_local or bt_right_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(183, 467, 120, 1, (bt_right_local or bt_right_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
}
|
||||
break;
|
||||
case 3: // US Landscape
|
||||
if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button
|
||||
disp1->fill_area(467, 174, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(468, 173, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
if (bt_left_enabled) { // Left button
|
||||
disp1->fill_area(467, 174, 3, 118, (bt_left_local or bt_left_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(468, 173, 1, 120, (bt_left_local or bt_left_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
}
|
||||
if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button
|
||||
disp1->fill_area(467, 28, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(468, 27, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
if (bt_right_enabled) { // Right button
|
||||
disp1->fill_area(467, 28, 3, 118, (bt_right_local or bt_right_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
disp1->fill_area(468, 27, 1, 120, (bt_right_local or bt_right_from_api) ? id(buttons_color_on) : id(buttons_color_off));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2438,9 +2442,7 @@ script:
|
||||
// Chips - Relays
|
||||
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);
|
||||
refresh_hardware_buttons_bars->execute();
|
||||
|
||||
- id: refresh_wifi_icon
|
||||
mode: restart
|
||||
|
||||
Reference in New Issue
Block a user