Move reboot button control to on_touch
So save a few more bytes of memory
This commit is contained in:
@@ -27,7 +27,7 @@ external_components:
|
||||
# path: packages/Blackymas/components
|
||||
type: git
|
||||
url: https://github.com/Blackymas/NSPanel_HA_Blueprint
|
||||
ref: dev # To do: Change to "main" when releasing
|
||||
ref: beta # To do: Change to "main" when releasing
|
||||
components:
|
||||
- nspanel_ha_blueprint
|
||||
refresh: 300s
|
||||
@@ -75,7 +75,6 @@ esphome:
|
||||
- switch.turn_off: screen_power
|
||||
- delay: 2s
|
||||
- switch.turn_on: screen_power
|
||||
- delay: 5s
|
||||
|
||||
on_shutdown:
|
||||
- priority: 0
|
||||
@@ -866,6 +865,24 @@ display:
|
||||
if (!id(is_uploading_tft)) {
|
||||
timer_reset_all->execute();
|
||||
switch (page_id) {
|
||||
case 0: // Boot
|
||||
switch (component_id) {
|
||||
case 4: // Reboot button
|
||||
if (!touch_event) { // Release
|
||||
App.safe_reboot();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8: // Settings
|
||||
switch (component_id) {
|
||||
case 9: // Reboot button
|
||||
if (!touch_event) { // Release
|
||||
App.safe_reboot();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 10: // light
|
||||
switch (component_id) {
|
||||
case 34: // power_button
|
||||
@@ -1164,23 +1181,6 @@ binary_sensor:
|
||||
component: "hw_bt_right"
|
||||
command: "short_click"
|
||||
|
||||
##### Restart NSPanel Button - Setting Page #####
|
||||
- name: Restart
|
||||
platform: nextion
|
||||
page_id: 8
|
||||
component_id: 9
|
||||
internal: true
|
||||
on_click:
|
||||
- button.press: restart_nspanel
|
||||
##### Restart NSPanel Button - Boot Page #####
|
||||
- name: Restart
|
||||
platform: nextion
|
||||
page_id: 0
|
||||
component_id: 4
|
||||
internal: true
|
||||
on_click:
|
||||
- button.press: restart_nspanel
|
||||
|
||||
## Delays initial info from HA to the display #####
|
||||
- name: Nextion display
|
||||
id: nextion_init
|
||||
|
||||
Reference in New Issue
Block a user