Home page: Removing unnecessary calls to panel (#629)
Trying to gain a bit on performance by not sending calls to the panel when not needed (element not available, etc.).
This commit is contained in:
@@ -2317,6 +2317,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l
|
|||||||
|
|
||||||
mode: parallel
|
mode: parallel
|
||||||
max: 5000
|
max: 5000
|
||||||
|
|
||||||
trace:
|
trace:
|
||||||
stored_traces: 10
|
stored_traces: 10
|
||||||
|
|
||||||
@@ -2356,7 +2357,7 @@ variables:
|
|||||||
date_format: !input "date_format"
|
date_format: !input "date_format"
|
||||||
time_format: !input "time_format"
|
time_format: !input "time_format"
|
||||||
time: "{{ as_timestamp(now()) | timestamp_custom(time_format) }}"
|
time: "{{ as_timestamp(now()) | timestamp_custom(time_format) }}"
|
||||||
meridiem: "{{ as_timestamp(now()) | timestamp_custom('%p') if time_format == '%-I:%M' else '' }}"
|
meridiem: "{{ as_timestamp(now()) | timestamp_custom('%p') if time_format == '%-I:%M' }}"
|
||||||
sun_is_up: "{{ is_state('sun.sun', 'above_horizon') }}"
|
sun_is_up: "{{ is_state('sun.sun', 'above_horizon') }}"
|
||||||
|
|
||||||
notification_sound: "switch.{{ nspanel_name }}_notification_sound"
|
notification_sound: "switch.{{ nspanel_name }}_notification_sound"
|
||||||
@@ -3693,20 +3694,6 @@ condition: "{{ is_state(nextion_inited_trigger, 'on') | default(false) if nextio
|
|||||||
##### START - Action #####
|
##### START - Action #####
|
||||||
#############################################################
|
#############################################################
|
||||||
action:
|
action:
|
||||||
- variables:
|
|
||||||
#settings_entity_value: "{{ states(settings_entity) }}"
|
|
||||||
settings_entity_value: "{{ states(settings_entity) | default('unavailable') if settings_entity is string else 'unavailable' }}"
|
|
||||||
settings_entity_split: "{{ settings_entity_value.split(',') if settings_entity_value is string and settings_entity_value not in ['unavailable', 'unknown', None] else [] }}"
|
|
||||||
settings_entity_count: "{{ settings_entity_split | count if settings_entity_split else 0 }}"
|
|
||||||
entity_long: "{{ settings_entity_split[0] if settings_entity_count >= 1 else 'unknown' }}"
|
|
||||||
entity_back: "{{ settings_entity_split[1] if settings_entity_count >= 2 else 'unknown' }}"
|
|
||||||
entity_long_name: "{{ settings_entity_split[2] if settings_entity_count >= 3 else 'unknown' }}"
|
|
||||||
entity_long_icon: "{{ settings_entity_split[3] if settings_entity_count >= 4 else 'unknown' }}"
|
|
||||||
entity_long_icon_color: "{{ settings_entity_split[4] if settings_entity_count >= 5 else 'unknown' }}"
|
|
||||||
entity_long_domain: "{{ entity_long.split('.')[0] if entity_long.split('.') | count > 0 else 'unknown' }}"
|
|
||||||
|
|
||||||
########################################################################################################################
|
|
||||||
|
|
||||||
# main - alias: "choose alias (name)"
|
# main - alias: "choose alias (name)"
|
||||||
- alias: Main choices
|
- alias: Main choices
|
||||||
choose:
|
choose:
|
||||||
@@ -3716,12 +3703,25 @@ action:
|
|||||||
- condition: trigger
|
- condition: trigger
|
||||||
id: settings_entity
|
id: settings_entity
|
||||||
- "{{ trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}"
|
- "{{ trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}"
|
||||||
- "{{ entity_long_domain in ['light', 'cover', 'climate'] }}"
|
|
||||||
sequence:
|
sequence:
|
||||||
- service: "{{ nextion.commands.printf }}"
|
- &variables-settings_entity
|
||||||
data:
|
variables:
|
||||||
cmd: "page {{ nextion.pages[entity_long_domain] }}"
|
settings_entity_value: "{{ states(settings_entity) | default('unavailable') if settings_entity is string else 'unavailable' }}"
|
||||||
continue_on_error: true
|
settings_entity_split: "{{ settings_entity_value.split(',') if settings_entity_value is string and settings_entity_value not in ['unavailable', 'unknown', None] else [] }}"
|
||||||
|
settings_entity_count: "{{ settings_entity_split | count if settings_entity_split else 0 }}"
|
||||||
|
entity_long: "{{ settings_entity_split[0] if settings_entity_count >= 1 else 'unknown' }}"
|
||||||
|
entity_back: "{{ settings_entity_split[1] if settings_entity_count >= 2 else 'unknown' }}"
|
||||||
|
entity_long_name: "{{ settings_entity_split[2] if settings_entity_count >= 3 else 'unknown' }}"
|
||||||
|
entity_long_icon: "{{ settings_entity_split[3] if settings_entity_count >= 4 else 'unknown' }}"
|
||||||
|
entity_long_icon_color: "{{ settings_entity_split[4] if settings_entity_count >= 5 else 'unknown' }}"
|
||||||
|
- variables:
|
||||||
|
entity_long_domain: "{{ entity_long.split('.')[0] if entity_long.split('.') | count > 0 else 'unknown' }}"
|
||||||
|
- if: "{{ entity_long_domain in ['light', 'cover', 'climate'] }}"
|
||||||
|
then:
|
||||||
|
- service: "{{ nextion.commands.printf }}"
|
||||||
|
data:
|
||||||
|
cmd: "page {{ nextion.pages[entity_long_domain] }}"
|
||||||
|
continue_on_error: true
|
||||||
|
|
||||||
##### BOOT NSPANEL - boot init #####
|
##### BOOT NSPANEL - boot init #####
|
||||||
- alias: Boot init
|
- alias: Boot init
|
||||||
@@ -3786,6 +3786,7 @@ action:
|
|||||||
display_target_temperature_state: "{{ states(display_target_temperature) | default('unavailable') if display_target_temperature is string else 'unavailable' }}"
|
display_target_temperature_state: "{{ states(display_target_temperature) | default('unavailable') if display_target_temperature is string else 'unavailable' }}"
|
||||||
- if: "{{ is_number(display_target_temperature_state) }}"
|
- if: "{{ is_number(display_target_temperature_state) }}"
|
||||||
then:
|
then:
|
||||||
|
- *variables-settings_entity
|
||||||
- service: climate.set_temperature
|
- service: climate.set_temperature
|
||||||
data:
|
data:
|
||||||
entity_id: "{{ entity_long }}"
|
entity_id: "{{ entity_long }}"
|
||||||
@@ -3831,71 +3832,77 @@ action:
|
|||||||
component: home.time
|
component: home.time
|
||||||
message: "{{ time }}"
|
message: "{{ time }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
### TIME Meridiem Font Color ###
|
- if: "{{ meridiem }}"
|
||||||
- *delay-default
|
then:
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
### TIME Meridiem Font Color ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.meridiem
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
message: "{{ page_home.general.time.label.color_rgb if is_number(page_home.general.time.label.color_rgb) else ((page_home.general.time.label.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.time.label.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.time.label.color_rgb[2] //(2**3)) }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.meridiem
|
||||||
### TIME Meridiem Font ###
|
message: "{{ page_home.general.time.label.color_rgb if is_number(page_home.general.time.label.color_rgb) else ((page_home.general.time.label.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.time.label.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.time.label.color_rgb[2] //(2**3)) }}"
|
||||||
- *delay-default
|
continue_on_error: true
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
### TIME Meridiem Font ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.meridiem
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
message: "{{ meridiem }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.meridiem
|
||||||
|
message: "{{ meridiem }}"
|
||||||
|
continue_on_error: true
|
||||||
|
|
||||||
##### NSPanel Outdoor Temp #####
|
##### NSPanel Outdoor Temp #####
|
||||||
- variables:
|
- variables:
|
||||||
outdoor_temp_state: "{{ states(outdoortemp) | default('unavailable') if outdoortemp is string else 'unavailable' }}"
|
outdoor_temp_state: "{{ states(outdoortemp) | default('unavailable') if outdoortemp is string else 'unavailable' }}"
|
||||||
outdoor_temp: "{{ outdoor_temp_state if is_number(outdoor_temp_state) else state_attr(weather_entity, 'temperature') | default('unavailable') if weather_entity is string else 'unavailable' }}"
|
outdoor_temp: "{{ outdoor_temp_state if is_number(outdoor_temp_state) else state_attr(weather_entity, 'temperature') | default('unavailable') if weather_entity is string else 'unavailable' }}"
|
||||||
### LABEL Outdoor Temp Font Color ###
|
- if: "{{ is_number(outdoor_temp) }}"
|
||||||
- *delay-default
|
then:
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
### LABEL Outdoor Temp Font Color ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.outdoor_temp
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
message: "{{ page_home.general.outdoor_temp.label.color_rgb if is_number(page_home.general.outdoor_temp.label.color_rgb) else ((page_home.general.outdoor_temp.label.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.outdoor_temp.label.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.outdoor_temp.label.color_rgb[2] //(2**3)) }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.outdoor_temp
|
||||||
### LABEL Outdoor Temp Font ###
|
message: "{{ page_home.general.outdoor_temp.label.color_rgb if is_number(page_home.general.outdoor_temp.label.color_rgb) else ((page_home.general.outdoor_temp.label.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.outdoor_temp.label.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.outdoor_temp.label.color_rgb[2] //(2**3)) }}"
|
||||||
- *delay-default
|
continue_on_error: true
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
### LABEL Outdoor Temp Font ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.outdoor_temp
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
message: "{{ (outdoor_temp | round(1) ~ temperature_units) if is_number(outdoor_temp) else (mui[language].unavailable if outdoor_temp in ['unavailable', 'unknown', None] else outdoor_temp) }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.outdoor_temp
|
||||||
|
message: "{{ outdoor_temp | round(1) ~ temperature_units }}"
|
||||||
|
continue_on_error: true
|
||||||
|
|
||||||
##### NSPanel Indoor Temp #####
|
##### NSPanel Indoor Temp #####
|
||||||
- variables:
|
- variables:
|
||||||
indoor_temp_state: "{{ states(indoortemp) | default('unavailable') if indoortemp is string else 'unavailable' }}"
|
indoor_temp_state: "{{ states(indoortemp) | default('unavailable') if indoortemp is string else 'unavailable' }}"
|
||||||
### ICON Indoor Temp Font Color ###
|
- if: "{{ is_number(indoor_temp_state) }}"
|
||||||
- *delay-default
|
then:
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
### ICON Indoor Temp Font Color ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.indoortempicon
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
message: "{{ page_home.general.indoor_temp.icon.color_rgb if is_number(page_home.general.indoor_temp.icon.color_rgb) else ((page_home.general.indoor_temp.icon.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.indoor_temp.icon.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.indoor_temp.icon.color_rgb[2] //(2**3)) }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.indoortempicon
|
||||||
### ICON Indoor Temp Font ###
|
message: "{{ page_home.general.indoor_temp.icon.color_rgb if is_number(page_home.general.indoor_temp.icon.color_rgb) else ((page_home.general.indoor_temp.icon.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.indoor_temp.icon.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.indoor_temp.icon.color_rgb[2] //(2**3)) }}"
|
||||||
- *delay-default
|
continue_on_error: true
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
### ICON Indoor Temp Font ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.indoortempicon
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
message: "{{ page_home.general.indoor_temp.icon.icon }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.indoortempicon
|
||||||
### LABEL Indoor Temp Font Color ###
|
message: "{{ page_home.general.indoor_temp.icon.icon }}"
|
||||||
- *delay-default
|
continue_on_error: true
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
### LABEL Indoor Temp Font Color ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.current_temp
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
message: "{{ page_home.general.indoor_temp.label.color_rgb if is_number(page_home.general.indoor_temp.label.color_rgb) else ((page_home.general.indoor_temp.label.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.indoor_temp.label.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.indoor_temp.label.color_rgb[2] //(2**3)) }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.current_temp
|
||||||
### LABEL Indoor Temp Font ###
|
message: "{{ page_home.general.indoor_temp.label.color_rgb if is_number(page_home.general.indoor_temp.label.color_rgb) else ((page_home.general.indoor_temp.label.color_rgb[0] //(2**3)) *(2**11))+((page_home.general.indoor_temp.label.color_rgb[1] //(2**2)) *(2**5))+(page_home.general.indoor_temp.label.color_rgb[2] //(2**3)) }}"
|
||||||
- *delay-default
|
continue_on_error: true
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
### LABEL Indoor Temp Font ###
|
||||||
data:
|
- *delay-default
|
||||||
component: home.current_temp
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
message: "{{ (indoor_temp_state | round(1) ~ temperature_units) if is_number(indoor_temp_state) else (mui[language].unavailable if indoor_temp_state in ['unavailable', 'unknown', None] else indoor_temp_state) }}"
|
data:
|
||||||
continue_on_error: true
|
component: home.current_temp
|
||||||
|
message: "{{ (indoor_temp_state | round(1) ~ temperature_units) if is_number(indoor_temp_state) else (mui[language].unavailable if indoor_temp_state in ['unavailable', 'unknown', None] else indoor_temp_state) }}"
|
||||||
|
continue_on_error: true
|
||||||
|
|
||||||
##### Weather Icon Home Page #####
|
##### Weather Icon Home Page #####
|
||||||
- *delay-default
|
- *delay-default
|
||||||
@@ -4013,19 +4020,24 @@ action:
|
|||||||
- &display-home_page_status_bar
|
- &display-home_page_status_bar
|
||||||
if: "{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}"
|
if: "{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}"
|
||||||
then:
|
then:
|
||||||
### ICON Font Color ###
|
- variables:
|
||||||
- *delay-default
|
repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}"
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
repeat_item_state_is_on: "{{ repeat_item_state in ['on', 'open'] }}"
|
||||||
data:
|
- if: "{{ repeat_item_state_is_on }}"
|
||||||
component: "{{ 'home.icon_top_%02d' | format(repeat.index) }}"
|
then:
|
||||||
message: "{{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) else ((repeat.item.icon_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.icon_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.icon_color_rgb[2] //(2**3)) }}"
|
### ICON Font Color ###
|
||||||
continue_on_error: true
|
- *delay-default
|
||||||
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
|
data:
|
||||||
|
component: "{{ 'home.icon_top_%02d' | format(repeat.index) }}"
|
||||||
|
message: "{{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) else ((repeat.item.icon_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.icon_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.icon_color_rgb[2] //(2**3)) }}"
|
||||||
|
continue_on_error: true
|
||||||
### ICON Font ###
|
### ICON Font ###
|
||||||
- *delay-default
|
- *delay-default
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
data:
|
data:
|
||||||
component: "{{ 'home.icon_top_%02d' | format(repeat.index) }}"
|
component: "{{ 'home.icon_top_%02d' | format(repeat.index) }}"
|
||||||
message: "{{ repeat.item.icon if is_state(repeat.item.entity, 'on') | default(False) else nextion.icons.blank }}"
|
message: "{{ repeat.item.icon if repeat_item_state_is_on else nextion.icons.blank }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
# {{ is_state(repeat.item.entity, 'on') | default(False) if repeat.item.entity is string else 'unavailable' }}
|
# {{ is_state(repeat.item.entity, 'on') | default(False) if repeat.item.entity is string else 'unavailable' }}
|
||||||
|
|
||||||
@@ -4052,7 +4064,7 @@ action:
|
|||||||
- &display-home_page_value
|
- &display-home_page_value
|
||||||
if: "{{ repeat.item.entity is string and repeat.item.entity is match 'sensor.' and states(repeat.item.entity) not in ['unavailable', 'unknown', None] }}"
|
if: "{{ repeat.item.entity is string and repeat.item.entity is match 'sensor.' and states(repeat.item.entity) not in ['unavailable', 'unknown', None] }}"
|
||||||
then:
|
then:
|
||||||
- if: "{{ repeat.item.entity_icon | length > 0 }}"
|
- if: "{{ repeat.item.icon | length > 0 }}"
|
||||||
then:
|
then:
|
||||||
### ICON Font Color ###
|
### ICON Font Color ###
|
||||||
- *delay-default
|
- *delay-default
|
||||||
@@ -4068,42 +4080,50 @@ action:
|
|||||||
component: "{{ 'home.value%02d_icon' | format(repeat.index) }}"
|
component: "{{ 'home.value%02d_icon' | format(repeat.index) }}"
|
||||||
message: "{{ repeat.item.icon }}"
|
message: "{{ repeat.item.icon }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
### LABEL Font Color ###
|
- variables:
|
||||||
- *delay-default
|
repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}"
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
repeat_item_state_available: "{{ repeat_item_state not in ['unavailable', 'unknown', None] }}"
|
||||||
data:
|
- if: "{{ repeat_item_state_available }}"
|
||||||
component: "{{ 'home.value%02d_state' | format(repeat.index) }}"
|
then:
|
||||||
message: "{{ repeat.item.label_color_rgb if is_number(repeat.item.label_color_rgb) else ((repeat.item.label_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.label_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.label_color_rgb[2] //(2**3)) }}"
|
### LABEL Font Color ###
|
||||||
continue_on_error: true
|
- *delay-default
|
||||||
### LABEL Font ###
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
- *delay-default
|
data:
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
component: "{{ 'home.value%02d_state' | format(repeat.index) }}"
|
||||||
data:
|
message: "{{ repeat.item.label_color_rgb if is_number(repeat.item.label_color_rgb) else ((repeat.item.label_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.label_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.label_color_rgb[2] //(2**3)) }}"
|
||||||
component: "{{ 'home.value%02d_state' | format(repeat.index) }}"
|
continue_on_error: true
|
||||||
message: "{{ (states(repeat.item.entity) | round(1) ~ (state_attr(repeat.item.entity, 'unit_of_measurement') if state_attr(repeat.item.entity, 'unit_of_measurement') else '')) if is_number(states(repeat.item.entity)) else states(repeat.item.entity) | default('unknown') }}"
|
### LABEL Font ###
|
||||||
continue_on_error: true
|
- *delay-default
|
||||||
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
|
data:
|
||||||
|
component: "{{ 'home.value%02d_state' | format(repeat.index) }}"
|
||||||
|
message: "{{ (repeat_item_state | round(1) ~ state_attr(repeat.item.entity, 'unit_of_measurement') | default('')) if is_number(repeat_item_state) else repeat_item_state }}"
|
||||||
|
continue_on_error: true
|
||||||
|
|
||||||
##### Set notify icon #####
|
##### Set notify icon #####
|
||||||
- variables:
|
- variables:
|
||||||
notification_unread_state: "{{ states(notification_unread) | default('unavailable') if notification_unread is string else 'unavailable' }}"
|
notification_unread_state: "{{ states(notification_unread) | default('unavailable') if notification_unread is string else 'unavailable' }}"
|
||||||
notification_text_state: "{{ states(notification_text) | default(None) if notification_text is string else None }}"
|
- if: "{{ notification_unread_state in ['on', 'off'] }}"
|
||||||
set_button04_icon: "{{ page_home.buttons[3].icon if notification_unread_state in ['on', 'off'] and notification_text_state | length > 0 else nextion.icons.blank }}"
|
then:
|
||||||
set_button04_icon_font: "{{ (page_home.buttons[3].color_rgb[notification_unread_state] if is_number(page_home.buttons[3].color_rgb[notification_unread_state]) else ((page_home.buttons[3].color_rgb[notification_unread_state][0] //(2**3)) *(2**11))+((page_home.buttons[3].color_rgb[notification_unread_state][1] //(2**2)) *(2**5))+(page_home.buttons[3].color_rgb[notification_unread_state][2] //(2**3))) if notification_unread_state in ['on', 'off'] and notification_text_state | length > 0 else nextion.colors.grey_light }}"
|
- variables:
|
||||||
##### SET ICON Font - Notify #####
|
notification_text_state: "{{ states(notification_text) | default(None) if notification_text is string else None }}"
|
||||||
- *delay-default
|
set_button04_icon: "{{ page_home.buttons[3].icon if notification_unread_state == 'on' and notification_text_state | length > 0 else nextion.icons.blank }}"
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
set_button04_icon_font: "{{ (page_home.buttons[3].color_rgb[notification_unread_state] if is_number(page_home.buttons[3].color_rgb[notification_unread_state]) else ((page_home.buttons[3].color_rgb[notification_unread_state][0] //(2**3)) *(2**11))+((page_home.buttons[3].color_rgb[notification_unread_state][1] //(2**2)) *(2**5))+(page_home.buttons[3].color_rgb[notification_unread_state][2] //(2**3))) if notification_unread_state in ['on', 'off'] and notification_text_state | length > 0 else nextion.colors.grey_light }}"
|
||||||
data:
|
##### SET ICON Font - Notify #####
|
||||||
component: home.button04_icon
|
- *delay-default
|
||||||
message: "{{ set_button04_icon }}"
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
continue_on_error: true
|
data:
|
||||||
|
component: home.button04_icon
|
||||||
|
message: "{{ set_button04_icon }}"
|
||||||
|
continue_on_error: true
|
||||||
|
|
||||||
##### SET ICON Font Color - Notify #####
|
##### SET ICON Font Color - Notify #####
|
||||||
- *delay-default
|
- *delay-default
|
||||||
- service: "{{ nextion.commands.font_color }}"
|
- service: "{{ nextion.commands.font_color }}"
|
||||||
data:
|
data:
|
||||||
component: home.button04_icon
|
component: home.button04_icon
|
||||||
message: "{{ set_button04_icon_font }}"
|
message: "{{ set_button04_icon_font }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
|
|
||||||
###### QR Code - Icon ######
|
###### QR Code - Icon ######
|
||||||
- *delay-default
|
- *delay-default
|
||||||
@@ -4447,6 +4467,7 @@ action:
|
|||||||
- alias: Light settings page
|
- alias: Light settings page
|
||||||
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.light }}"
|
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.light }}"
|
||||||
sequence:
|
sequence:
|
||||||
|
- *variables-settings_entity
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
data:
|
data:
|
||||||
component: lightsettings.light_name
|
component: lightsettings.light_name
|
||||||
@@ -4535,6 +4556,7 @@ action:
|
|||||||
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.cover }}"
|
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.cover }}"
|
||||||
sequence:
|
sequence:
|
||||||
##### COVER - OPEN / CLOSE #####
|
##### COVER - OPEN / CLOSE #####
|
||||||
|
- *variables-settings_entity
|
||||||
- variables:
|
- variables:
|
||||||
coversettings_icon_font: "{{ entity_long_icon if entity_long_icon | length > 0 else nextion.icons.buttons.cover }}"
|
coversettings_icon_font: "{{ entity_long_icon if entity_long_icon | length > 0 else nextion.icons.buttons.cover }}"
|
||||||
coversettings_icon_font_color: "{{ entity_long_icon_color if is_state(entity_long, 'open') else nextion.colors.grey_light }}"
|
coversettings_icon_font_color: "{{ entity_long_icon_color if is_state(entity_long, 'open') else nextion.colors.grey_light }}"
|
||||||
@@ -4797,6 +4819,7 @@ action:
|
|||||||
- alias: Climate page
|
- alias: Climate page
|
||||||
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.climate }}"
|
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.climate }}"
|
||||||
sequence:
|
sequence:
|
||||||
|
- *variables-settings_entity
|
||||||
- variables:
|
- variables:
|
||||||
hvac_mode: "{{ states(entity_long) | default('unavailable') if entity_long is string else 'unavailable' }}"
|
hvac_mode: "{{ states(entity_long) | default('unavailable') if entity_long is string else 'unavailable' }}"
|
||||||
outdoor_temp_state: "{{ states(outdoortemp) | default('unavailable') if outdoortemp is string else 'unavailable' }}"
|
outdoor_temp_state: "{{ states(outdoortemp) | default('unavailable') if outdoortemp is string else 'unavailable' }}"
|
||||||
@@ -5014,7 +5037,7 @@ action:
|
|||||||
message: "{{ mui[language].unavailable }}"
|
message: "{{ mui[language].unavailable }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
- *delay-default
|
- *delay-default
|
||||||
|
|
||||||
## PAGE NOTIFICATION ##
|
## PAGE NOTIFICATION ##
|
||||||
- alias: Notification page
|
- alias: Notification page
|
||||||
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.notification }}"
|
conditions: "{{ trigger.event.data.new_state.state == nextion.pages.notification }}"
|
||||||
@@ -5148,13 +5171,13 @@ action:
|
|||||||
- variables:
|
- variables:
|
||||||
##### Entity - Page Button - Toggle Entity #####
|
##### Entity - Page Button - Toggle Entity #####
|
||||||
last_click_state: "{{ states(last_click) | default('unavailable') if last_click is string else 'unavailable' }}"
|
last_click_state: "{{ states(last_click) | default('unavailable') if last_click is string else 'unavailable' }}"
|
||||||
last_click_coordinates: "{{ last_click_state.replace('releasebuttonpage', '').split('button') if last_click_state not in ['unavailable', 'unknown', None] else [-1, -1] }}"
|
last_click_coordinates: "{{ last_click_state.replace('releasebuttonpage', '').split('button') if last_click_state not in ['unavailable', 'unknown', None] else None }}"
|
||||||
last_click_entity_index: "{{ (last_click_coordinates[0] | int(-99) -1)*8 + last_click_coordinates[1] | int(-99) - 1 }}"
|
last_click_entity_index: "{{ (last_click_coordinates[0] | int(-99) -1)*8 + last_click_coordinates[1] | int(-99) - 1 if last_click_coordinates and last_click_coordinates | count >= 1 else -1 }}"
|
||||||
- condition: "{{ last_click_entity_index >= 0 }}"
|
- condition: "{{ last_click_entity_index >= 0 }}"
|
||||||
- variables:
|
- variables:
|
||||||
last_click_button: "{{ button_pages_buttons[last_click_entity_index] | default([]) }}"
|
last_click_button: "{{ button_pages_buttons[last_click_entity_index] | default([]) }}"
|
||||||
entity_short: "{{ last_click_button.entity | default('unavailable') if last_click_button and last_click_button.entity is defined }}"
|
entity_short: "{{ last_click_button.entity | default('unavailable') if last_click_button and last_click_button.entity is defined }}"
|
||||||
entity_domain: "{{ (entity_short.split('.')[0] | default('unknown')) if entity_short is string and entity_short | length > 0 else 'unknown' }}"
|
entity_domain: "{{ (entity_short.split('.')[0] | default('unknown')) if entity_short is string and entity_short | length > 0 and entity_short.split('.') | count > 0 else 'unknown' }}"
|
||||||
- condition: "{{ entity_domain not in ['unknown', 'person', 'binary_sensor', 'sensor'] }}"
|
- condition: "{{ entity_domain not in ['unknown', 'person', 'binary_sensor', 'sensor'] }}"
|
||||||
- if: "{{ entity_domain == 'climate' }}"
|
- if: "{{ entity_domain == 'climate' }}"
|
||||||
then:
|
then:
|
||||||
@@ -5290,6 +5313,7 @@ action:
|
|||||||
id: light_settings
|
id: light_settings
|
||||||
- "{{ nextion.pages.current == nextion.pages.light }}"
|
- "{{ nextion.pages.current == nextion.pages.light }}"
|
||||||
sequence:
|
sequence:
|
||||||
|
- *variables-settings_entity
|
||||||
- choose:
|
- choose:
|
||||||
##### Page Lightsettings - Brightness Slider MOVE #####
|
##### Page Lightsettings - Brightness Slider MOVE #####
|
||||||
- conditions:
|
- conditions:
|
||||||
@@ -5376,6 +5400,7 @@ action:
|
|||||||
id: cover_settings
|
id: cover_settings
|
||||||
- "{{ nextion.pages.current == nextion.pages.cover }}"
|
- "{{ nextion.pages.current == nextion.pages.cover }}"
|
||||||
sequence:
|
sequence:
|
||||||
|
- *variables-settings_entity
|
||||||
- choose:
|
- choose:
|
||||||
##### Page Coversettings - Cover Slider MOVE #####
|
##### Page Coversettings - Cover Slider MOVE #####
|
||||||
- conditions:
|
- conditions:
|
||||||
@@ -5444,6 +5469,7 @@ action:
|
|||||||
id: climate_settings
|
id: climate_settings
|
||||||
- "{{ nextion.pages.current == nextion.pages.climate }}"
|
- "{{ nextion.pages.current == nextion.pages.climate }}"
|
||||||
sequence:
|
sequence:
|
||||||
|
- *variables-settings_entity
|
||||||
- variables:
|
- variables:
|
||||||
entity_long_state: "{{ states(entity_long) | default('unavailable') if entity_long is string else 'unavailable' }}"
|
entity_long_state: "{{ states(entity_long) | default('unavailable') if entity_long is string else 'unavailable' }}"
|
||||||
- choose:
|
- choose:
|
||||||
|
|||||||
Reference in New Issue
Block a user