11 Commits

Author SHA1 Message Date
Edward Firmo
4096c1cf67 Merge pull request #1333 from bkbartk/dev
fix button picture fallback
2023-11-24 21:19:36 +01:00
bkbartk
0ecc8ac016 fix button picture fallback
when localfallback is enabled,
and the switch is turned off
relay_1-> state = off(false)
so the action won't be applied and it takes a second for the HA automation to update the icon.

so this check should not be here, it should only for fallback and then choose 1/0 based on the state.

remark(I cannot test off to on atm as my custom change then opens the detail page, but I have no reason to think this won't work)
2023-11-24 21:13:23 +01:00
Edward Firmo
0a3b201ee7 Merge pull request #1327 from bkbartk/dev
make screen power available in HA
2023-11-24 20:49:22 +01:00
Edward Firmo
0584b07275 Remove unnecessary code 2023-11-24 18:39:35 +01:00
Edward Firmo
dc6bc5d04f Revert back comments 2023-11-24 18:35:35 +01:00
Edward Firmo
8b5d7bfb05 Move "Nextion display - Power" to Diagnostic and disabled 2023-11-24 18:33:55 +01:00
Edward Firmo
18078ca1c0 Rename switch to "Nextion display - Power" 2023-11-24 18:33:09 +01:00
Edward Firmo
feacca7391 Wait for display setup when turning on 2023-11-24 18:22:03 +01:00
Edward Firmo
c6141b97f6 Set display not available when power off 2023-11-24 17:24:59 +01:00
Edward Firmo
be37fc3941 New switch "Screen Power" 2023-11-24 17:23:09 +01:00
bkbartk
3f9f0c00de make screen power available
sorry,

I'm stubborn, but I sometimes prefer this over the 15 sec press
2023-11-24 09:08:00 +01:00
2 changed files with 29 additions and 6 deletions

View File

@@ -93,6 +93,7 @@ packages:
- 4.1.2 patch:
- Fix light icon color not being used for buttons
- Add option to wake-up to Climate page
- New switch "Nextion display - Power" which can turn the screen on/off
 
## Details of noteworthy changes
@@ -157,6 +158,7 @@ See here: https://github.com/Blackymas/NSPanel_HA_Blueprint/labels/roadmap
- Display current temperature on buttons even when climate is off (#1268)
- Button pages shows entity's icon when available (#1269)
- Home page buttons shows entity's icon when available (#1276)
- New switch "Nextion display - Power" which can turn the screen on/off (#1327)
## New Contributors
@misery

View File

@@ -735,6 +735,12 @@ display:
##### START - GLOBALS CONFIGURATION #####
globals:
##### Is boot sequence completed? #####
- id: boot_sequence_completed
type: bool
restore_value: false
initial_value: 'false'
###### Last volume level from Home Assistant ######
- id: last_volume_level
type: uint
@@ -1273,15 +1279,29 @@ switch:
id: refresh_relays
##### DISPLAY ALWAYS ON #####
- name: ${device_name} Screen Power
- name: ${device_name} Nextion display - Power
platform: gpio
id: screen_power
entity_category: config
entity_category: diagnostic
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
internal: true
internal: false
disabled_by_default: true
on_turn_on:
- wait_until:
condition:
- lambda: !lambda return disp1->is_setup();
timeout: 20s
- lambda: |-
if (id(boot_sequence_completed)) {
nextion_init->publish_state(true);
disp1->goto_page(wakeup_page_name->state.c_str());
}
on_turn_off:
- lambda: |-
nextion_init->publish_state(false);
##### Relay Local control #####
- name: ${device_name} Relay 1 Local
@@ -1722,8 +1742,8 @@ script:
if (relay_2->state) disp1->set_component_text_printf("home.icon_top_02", "%s", id(home_relay2_icon).c_str());
else disp1->set_component_text_printf("home.icon_top_02", "\uFFFF");
// Hardware buttons - Fallback mode
if (relay_1->state and relay1_local->state) disp1->send_command_printf("home.left_bt_pic.val=%i", (relay_1->state) ? 1 : 0);
if (relay_2->state and relay2_local->state) disp1->send_command_printf("home.right_bt_pic.val=%i", (relay_2->state) ? 1 : 0);
if (relay1_local->state) disp1->send_command_printf("home.left_bt_pic.val=%i", (relay_1->state) ? 1 : 0);
if (relay2_local->state) disp1->send_command_printf("home.right_bt_pic.val=%i", (relay_2->state) ? 1 : 0);
- id: refresh_wifi_icon
mode: restart
@@ -2529,7 +2549,7 @@ script:
{"type", "boot"},
{"step", "start"}
});
delay(1000);
if (!id(boot_sequence_completed)) delay(1000);
// Set dimming values
display_brightness->publish_state(id(display_brightness_global));
display_dim_brightness->publish_state(id(display_dim_brightness_global));
@@ -2556,6 +2576,7 @@ script:
disp1->set_component_text_printf("home.icon_top_02", "%s", id(home_relay2_icon).c_str());
timer_reset_all->execute("boot");
notification_clear->execute();
id(boot_sequence_completed) = true;
ESP_LOGD(TAG, "Boot sequence finished!");
- id: notification_clear