upd: service set_button to improve performance

This commit is contained in:
deejaybeam
2023-03-31 23:23:43 +02:00
parent d23fe9616c
commit df0855862f
2 changed files with 131 additions and 82 deletions

View File

@@ -2424,6 +2424,7 @@ variables:
command_play_rtttl: "esphome.{{ nspanel_name }}_play_rtttl"
command_set_settings_entity: "esphome.{{ nspanel_name }}_set_settings_entity"
command_show_all: "esphome.{{ nspanel_name }}_send_command_show_all"
command_set_button: "esphome.{{ nspanel_name }}_set_button"
###### SYNC SETTINGS #####
delay_boot: !input "delay"
@@ -4829,91 +4830,104 @@ action:
{%- else -%} 0
{%- endif -%}
##### SET Buttons Background ####
#
##### SET Button PIC #####
- service: "{{ command_printf }}"
data:
cmd: "{{ repeat.item.button }}pic.pic={{ btn_pic }}"
##### SET ICON Background #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_background_color }}"
data:
component: "{{ repeat.item.button }}icon"
message: "{{ btn_bg }}"
##### SET LABEL Background #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_background_color }}"
data:
component: "{{ repeat.item.button }}text"
message: "{{ btn_bg }}"
##### SET BRIGHTNESS Background Color #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_background_color }}"
data:
component: "{{ repeat.item.button }}bri"
message: "{{ btn_bg }}"
# ##### SET Buttons Background ####
# #
# ##### SET Button PIC #####
# - service: "{{ command_printf }}"
# data:
# cmd: "{{ repeat.item.button }}pic.pic={{ btn_pic }}"
# ##### SET ICON Background #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_background_color }}"
# data:
# component: "{{ repeat.item.button }}icon"
# message: "{{ btn_bg }}"
# ##### SET LABEL Background #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_background_color }}"
# data:
# component: "{{ repeat.item.button }}text"
# message: "{{ btn_bg }}"
# ##### SET BRIGHTNESS Background Color #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_background_color }}"
# data:
# component: "{{ repeat.item.button }}bri"
# message: "{{ btn_bg }}"
##### SET Buttons Font Color ####
#
##### SET ICON Font Color #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_font_color }}"
data:
component: "{{ repeat.item.button }}icon"
message: "{{ btn_icon_font }}"
##### SET LABEL Font Color #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_font_color }}"
data:
component: "{{ repeat.item.button }}text"
message: "{{ btn_txt_font }}"
##### SET BRIGHTNESS Font Color #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_font_color }}"
data:
component: "{{ repeat.item.button }}bri"
message: "{{ btn_bri_font }}"
# ##### SET Buttons Font Color ####
# #
# ##### SET ICON Font Color #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_font_color }}"
# data:
# component: "{{ repeat.item.button }}icon"
# message: "{{ btn_icon_font }}"
# ##### SET LABEL Font Color #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_font_color }}"
# data:
# component: "{{ repeat.item.button }}text"
# message: "{{ btn_txt_font }}"
# ##### SET BRIGHTNESS Font Color #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_font_color }}"
# data:
# component: "{{ repeat.item.button }}bri"
# message: "{{ btn_bri_font }}"
##### SET Buttons Text Value ####
#
##### "ICON" Value #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_text_printf }}"
data:
component: "{{ repeat.item.button }}icon"
message: "{{ btn_icon }}"
##### "LABEL" Value #####
- delay:
milliseconds: "{{ delay_value }}"
- service: "{{ command_text_printf }}"
data:
component: "{{ repeat.item.button }}text"
message: "{{ btn_label }}"
# ##### SET Buttons Text Value ####
# #
# ##### "ICON" Value #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_text_printf }}"
# data:
# component: "{{ repeat.item.button }}icon"
# message: "{{ btn_icon }}"
# ##### "LABEL" Value #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - service: "{{ command_text_printf }}"
# data:
# component: "{{ repeat.item.button }}text"
# message: "{{ btn_label }}"
# ##### "BRIGHTNESS" Value #####
# - delay:
# milliseconds: "{{ delay_value }}"
# - if:
# - condition: template
# value_template: "{{ btn_bri_txt == 0 }}"
# then:
# - service: "{{ command_text_printf }}"
# data:
# component: "{{ repeat.item.button }}bri"
# message: " "
# else:
# - service: "{{ command_text_printf }}"
# data:
# component: "{{ repeat.item.button }}bri"
# message: "{{ btn_bri_txt }}"
- service: "{{ command_set_button }}"
data:
btn_id: "{{ repeat.item.button }}"
btn_pic: "{{ btn_pic }}"
btn_bg: "{{ btn_bg }}"
btn_icon_font: "{{ btn_icon_font }}"
btn_txt_font: "{{ btn_txt_font }}"
btn_bri_font: "{{ btn_bri_font }}"
btn_icon: "{{ btn_icon }}"
btn_label: "{{ btn_label }}"
btn_bri_txt: "{{ btn_bri_txt }}"
##### "BRIGHTNESS" Value #####
- delay:
milliseconds: "{{ delay_value }}"
- if:
- condition: template
value_template: "{{ btn_bri_txt == 0 }}"
then:
- service: "{{ command_text_printf }}"
data:
component: "{{ repeat.item.button }}bri"
message: " "
else:
- service: "{{ command_text_printf }}"
data:
component: "{{ repeat.item.button }}bri"
message: "{{ btn_bri_txt }}"
###### SHOW All component when page loading done #####
- delay:
milliseconds: "{{ delay_value }}"