Fix: button not updating with external changes (#721)

* Fix: button not updating with external changes

* Removed debug code

* Revert trigger_id change
This commit is contained in:
Edward Firmo
2023-04-24 20:52:05 +02:00
committed by GitHub
parent 8ca88755c1
commit a252ddf74e

View File

@@ -4646,7 +4646,8 @@ trigger:
##### CLOSE - Trigger #####
#############################################################
condition: '{{ is_state(nextion_inited, "on") | default(false) if nextion_inited is string else false }}'
condition:
- '{{ is_state(nextion_inited, "on") | default(false) if nextion_inited is string else false }}'
#############################################################
##### START - Action #####
@@ -5743,7 +5744,7 @@ action:
## PAGE LIGHTSETTINGS ##
- alias: Light settings page
conditions: '{{ nspanel_event.page == nextion.pages.light }}'
sequence:
sequence: &refresh_page_lightsettings
- *variables-settings_entity
- if: '{{ settings_entity_domain == "light" }}'
then:
@@ -5844,7 +5845,7 @@ action:
## PAGE COVERSETTINGS ##
- alias: Cover settings page
conditions: '{{ nspanel_event.page == nextion.pages.cover }}'
sequence:
sequence: &refresh_page_coversettings
##### COVER - OPEN / CLOSE #####
- *variables-settings_entity
- if: '{{ settings_entity_domain == "cover" }}'
@@ -5950,7 +5951,7 @@ action:
## PAGE CLIMATE ##
- alias: Climate page
conditions: '{{ nspanel_event.page == nextion.pages.climate }}'
sequence:
sequence: &refresh_page_climate
- *variables-settings_entity
- variables:
settings_entity_dict: >
@@ -6953,8 +6954,8 @@ action:
- conditions: '{{ nspanel_event.page in nextion.pages.entitypages }}'
sequence: *refresh-entity_pages
##### UPDATE BUTTONS AND PAGES - button page / lightsettings page / coversettings page #####
- alias: 'Update buttons & pages'
##### UPDATE BUTTONS PAGES - button page / lightsettings page / coversettings page #####
- alias: 'Buttons entity updated'
conditions:
- condition: trigger
id:
@@ -6991,12 +6992,17 @@ action:
- current_state_entity31
- current_state_entity32
- '{{ trigger.to_state.state not in ["unavailable", "unknown", "", None] }}'
- condition: or
conditions:
- '{{ nspanel_event.page in nextion.pages.buttonpages }}'
- '{{ nspanel_event.page in [nextion.pages.light, nextion.pages.cover, nextion.pages.climate] }}'
sequence:
- alias: choose current page
choose:
- alias: buttonpage
conditions: '{{ nspanel_event.page in nextion.pages.buttonpages }}'
sequence:
- choose:
- alias: "Button pages"
conditions:
- '{{ nspanel_event.page in nextion.pages.buttonpages }}'
sequence: #*refresh_page_buttonpage
- *variables-page_buttons
- repeat:
for_each: >
@@ -7004,34 +7010,26 @@ action:
button_pages_buttons
| selectattr("page", "defined")
| selectattr("page", "eq", nspanel_event.page)
| selectattr("component", "defined")
| selectattr("component", "eq", nspanel_event.component)
| selectattr("entity", "defined")
| selectattr("entity", "eq", trigger.entity_id)
| list
}}
sequence: *display-button_page_button
- alias: page climate
conditions: '{{ nspanel_event.page == nextion.pages.climate and trigger.entity_id is match "climate." }}'
sequence:
- *variables-settings_entity
- if: '{{ trigger.entity_id == settings_entity_dict.entity }}'
then:
- variables:
hvac_mode: '{{ states(settings_entity_dict.entity) | default("unavailable") if settings_entity_dict.entity is string else "unavailable" }}'
heating_state: '{{ mui[language].climate.states.off if hvac_mode == "off" else mui[language].climate.states.on }}'
heating_bt_pic: '{{ nextion.pics.heating.button.off if hvac_mode == "off" else nextion.pics.heating.button.on }}'
- service: '{{ nextion.commands.text_printf }}'
data:
component: heating_state
message: '{{ heating_state }}'
continue_on_error: true
- *delay-default
- service: '{{ nextion.commands.printf }}'
data:
cmd: heating_bt_pic.pic={{ heating_bt_pic }}
continue_on_error: true
- alias: 'Light settings page'
conditions:
- '{{ nspanel_event.page == nextion.pages.light }}'
- '{{ trigger.entity_id is match "light." }}'
sequence: *refresh_page_lightsettings
- alias: 'Cover settings page'
conditions:
- '{{ nspanel_event.page == nextion.pages.cover }}'
- '{{ trigger.entity_id is match "cover." }}'
sequence: *refresh_page_coversettings
- alias: 'Climate page'
conditions:
- '{{ nspanel_event.page == nextion.pages.climate }}'
- '{{ trigger.entity_id is match "climate." }}'
sequence: *refresh_page_climate
########## TRIGGER - HOME PAGE ###########