From 0b856cbb836426d9c52b25ef1f763ee82de62de7 Mon Sep 17 00:00:00 2001 From: Blackymas Date: Fri, 17 Feb 2023 08:21:55 +0100 Subject: [PATCH] rebuild buttons v.1 --- nspanel_blueprint.yaml | 1182 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 1180 insertions(+), 2 deletions(-) diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 6a48244..6381d7f 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -411,6 +411,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity01_icon: + name: Icon "Button 01" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity01_confirm: name: Confirm execution of the button press (Optional) default: false @@ -443,6 +449,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity02_icon: + name: Icon "Button 02" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity02_confirm: name: Confirm execution of the button press (Optional) default: false @@ -475,6 +487,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity03_icon: + name: Icon "Button 03" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity03_confirm: name: Confirm execution of the button press (Optional) default: false @@ -507,6 +525,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity04_icon: + name: Icon "Button 04" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity04_confirm: name: Confirm execution of the button press (Optional) default: false @@ -539,6 +563,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity05_icon: + name: Icon "Button 05" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity05_confirm: name: Confirm execution of the button press (Optional) default: false @@ -571,6 +601,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity06_icon: + name: Icon "Button 06" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity06_confirm: name: Confirm execution of the button press (Optional) default: false @@ -603,6 +639,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity07_icon: + name: Icon "Button 07" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity07_confirm: name: Confirm execution of the button press (Optional) default: false @@ -635,6 +677,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity08_icon: + name: Icon "Button 08" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity08_confirm: name: Confirm execution of the button press (Optional) default: false @@ -667,6 +715,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity09_icon: + name: Icon "Button 09" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity09_confirm: name: Confirm execution of the button press (Optional) default: false @@ -699,6 +753,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity10_icon: + name: Icon "Button 10" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity10_confirm: name: Confirm execution of the button press (Optional) default: false @@ -731,6 +791,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity11_icon: + name: Icon "Button 11" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity11_confirm: name: Confirm execution of the button press (Optional) default: false @@ -763,6 +829,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity12_icon: + name: Icon "Button 12" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity12_confirm: name: Confirm execution of the button press (Optional) default: false @@ -795,6 +867,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity13_icon: + name: Icon "Button 13" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity13_confirm: name: Confirm execution of the button press (Optional) default: false @@ -827,6 +905,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity14_icon: + name: Icon "Button 14" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity14_confirm: name: Confirm execution of the button press (Optional) default: false @@ -859,6 +943,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity15_icon: + name: Icon "Button 15" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity15_confirm: name: Confirm execution of the button press (Optional) default: false @@ -891,6 +981,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity16_icon: + name: Icon "Button 16" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity16_confirm: name: Confirm execution of the button press (Optional) default: false @@ -923,6 +1019,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity17_icon: + name: Icon "Button 17" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity17_confirm: name: Confirm execution of the button press (Optional) default: false @@ -955,6 +1057,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity18_icon: + name: Icon "Button 18" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity18_confirm: name: Confirm execution of the button press (Optional) default: false @@ -987,6 +1095,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity19_icon: + name: Icon "Button 19" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity19_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1019,6 +1133,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity20_icon: + name: Icon "Button 20" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity20_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1051,6 +1171,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity21_icon: + name: Icon "Button 21" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity21_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1083,6 +1209,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity22_icon: + name: Icon "Button 22" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity22_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1115,6 +1247,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity23_icon: + name: Icon "Button 23" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity23_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1147,6 +1285,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity24_icon: + name: Icon "Button 24" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity24_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1179,6 +1323,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity25_icon: + name: Icon "Button 25" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity25_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1211,6 +1361,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity26_icon: + name: Icon "Button 26" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity26_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1243,6 +1399,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity27_icon: + name: Icon "Button 27" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity27_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1275,6 +1437,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity28_icon: + name: Icon "Button 28" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity28_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1307,6 +1475,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity29_icon: + name: Icon "Button 29" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity29_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1339,6 +1513,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity30_icon: + name: Icon "Button 30" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity30_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1371,6 +1551,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity31_icon: + name: Icon "Button 31" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity31_confirm: name: Confirm execution of the button press (Optional) default: false @@ -1403,6 +1589,12 @@ The goal was to create a version that allows everyone to use the NSpanel fully l default: [] selector: text: {} + entity32_icon: + name: Icon "Button 32" (Optional) + description: '* *Button icon - sets an icon for the button (e.g.: ) - if not set, no icon is shown*' + default: [] + selector: + text: {} entity32_confirm: name: Confirm execution of the button press (Optional) default: false @@ -2156,6 +2348,8 @@ variables: right_button_hold_select: !input "right_button_hold_select" ##### NEXTION PIC MAPPING ##### + button_off: "140" + button_on: "141" button_light_off: "62" button_light_on: "63" button_switch_off: "64" @@ -2244,8 +2438,27 @@ variables: home_button_entities: "124" ###### NEXTION COLOR MAPPING ##### - button_color_1: "65535" - button_color_2: "10597" + button_color_1: "65535" # White + button_color_2: "10597" # Grey + button_color_3: "63488" # Red + button_icon_color_1: "33808" + button_icon_color_2: "1055" + + ###### NEXTION FONT ICON MAPPING ##### + button_icon_unknown: "" + button_icon_light: "" + button_icon_switch: "" + button_icon_input_boolan: "" + button_icon_cover: "" + button_icon_automation: "" + button_icon_button: "" + button_icon_input_button: "" + button_icon_screne: "" + button_icon_script: "" + button_icon_person: "" + button_icon_binary_sensor: "" + button_icon_fan: "" + button_icon_climate: "" ###### NEXTION PAGE MAPPING ##### page_home: "home" @@ -2722,68 +2935,100 @@ variables: ##### BUTTONS 1- 32 ##### entity01: !input "entity01" entity01_name: !input "entity01_name" + entity01_icon: !input "entity01_icon" entity02: !input "entity02" entity02_name: !input "entity02_name" + entity02_icon: !input "entity02_icon" entity03: !input "entity03" entity03_name: !input "entity03_name" + entity03_icon: !input "entity03_icon" entity04: !input "entity04" entity04_name: !input "entity04_name" + entity04_icon: !input "entity04_icon" entity05: !input "entity05" entity05_name: !input "entity05_name" + entity05_icon: !input "entity05_icon" entity06: !input "entity06" entity06_name: !input "entity06_name" + entity06_icon: !input "entity06_icon" entity07: !input "entity07" entity07_name: !input "entity07_name" + entity07_icon: !input "entity07_icon" entity08: !input "entity08" entity08_name: !input "entity08_name" + entity08_icon: !input "entity08_icon" entity09: !input "entity09" entity09_name: !input "entity09_name" + entity09_icon: !input "entity09_icon" entity10: !input "entity10" entity10_name: !input "entity10_name" + entity10_icon: !input "entity10_icon" entity11: !input "entity11" entity11_name: !input "entity11_name" + entity11_icon: !input "entity11_icon" entity12: !input "entity12" entity12_name: !input "entity12_name" + entity12_icon: !input "entity12_icon" entity13: !input "entity13" entity13_name: !input "entity13_name" + entity13_icon: !input "entity13_icon" entity14: !input "entity14" entity14_name: !input "entity14_name" + entity14_icon: !input "entity14_icon" entity15: !input "entity15" entity15_name: !input "entity15_name" + entity15_icon: !input "entity15_icon" entity16: !input "entity16" entity16_name: !input "entity16_name" + entity16_icon: !input "entity16_icon" entity17: !input "entity17" entity17_name: !input "entity17_name" + entity17_icon: !input "entity17_icon" entity18: !input "entity18" entity18_name: !input "entity18_name" + entity18_icon: !input "entity18_icon" entity19: !input "entity19" entity19_name: !input "entity19_name" + entity19_icon: !input "entity19_icon" entity20: !input "entity20" entity20_name: !input "entity20_name" + entity20_icon: !input "entity20_icon" entity21: !input "entity21" entity21_name: !input "entity21_name" + entity21_icon: !input "entity21_icon" entity22: !input "entity22" entity22_name: !input "entity22_name" + entity22_icon: !input "entity22_icon" entity23: !input "entity23" entity23_name: !input "entity23_name" + entity23_icon: !input "entity23_icon" entity24: !input "entity24" entity24_name: !input "entity24_name" + entity24_icon: !input "entity24_icon" entity25: !input "entity25" entity25_name: !input "entity25_name" + entity25_icon: !input "entity25_icon" entity26: !input "entity26" entity26_name: !input "entity26_name" + entity26_icon: !input "entity26_icon" entity27: !input "entity27" entity27_name: !input "entity27_name" + entity27_icon: !input "entity27_icon" entity28: !input "entity28" entity28_name: !input "entity28_name" + entity28_icon: !input "entity28_icon" entity29: !input "entity29" entity29_name: !input "entity29_name" + entity29_icon: !input "entity29_icon" entity30: !input "entity30" entity30_name: !input "entity30_name" + entity30_icon: !input "entity30_icon" entity31: !input "entity31" entity31_name: !input "entity31_name" + entity31_icon: !input "entity31_icon" entity32: !input "entity32" entity32_name: !input "entity32_name" + entity32_icon: !input "entity32_icon" entity01_confirm: !input "entity01_confirm" entity02_confirm: !input "entity02_confirm" @@ -6990,6 +7235,288 @@ action: component: "bpage01_label" message: "{{ button_page01_label }}" + ##### NSPanel build buttons Buttonpage01 ##### + - delay: + milliseconds: "{{ delay_value }}" + - repeat: + for_each: + - entity: "{{ entity01 }}" + button_icon: "{{ entity01_icon }}" + button_label: "{{ entity01_name }}" + button: buttonpage01.button01 + - entity: "{{ entity02 }}" + button_icon: "{{ entity02_icon }}" + button_label: "{{ entity02_name }}" + button: buttonpage01.button02 + - entity: "{{ entity03 }}" + button_icon: "{{ entity03_icon }}" + button_label: "{{ entity03_name }}" + button: buttonpage01.button03 + - entity: "{{ entity04 }}" + button_icon: "{{ entity04_icon }}" + button_label: "{{ entity04_name }}" + button: buttonpage01.button04 + - entity: "{{ entity05 }}" + button_icon: "{{ entity05_icon }}" + button_label: "{{ entity05_name }}" + button: buttonpage01.button05 + - entity: "{{ entity06 }}" + button_icon: "{{ entity06_icon }}" + button_label: "{{ entity06_name }}" + button: buttonpage01.button06 + - entity: "{{ entity07 }}" + button_icon: "{{ entity07_icon }}" + button_label: "{{ entity07_name }}" + button: buttonpage01.button07 + - entity: "{{ entity08 }}" + button_icon: "{{ entity08_icon }}" + button_label: "{{ entity08_name }}" + button: buttonpage01.button08 + sequence: + - if: + - condition: template + value_template: '{{ repeat.item.entity|length > 0 }}' + then: + - if: + - condition: template + value_template: '{{ states[repeat.item.entity].state == "unknown" or states[repeat.item.entity].state == "unavailable" }}' + then: + ##### SET Buttons Background #### + # + ##### SET Button PIC ##### + - service: "{{ command_printf }}" + data: + cmd: "{{ repeat.item.button }}pic.pic={{ button_off }}" + ##### SET ICON Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ repeat.item.button }}icon" + message: "{{ button_color_2 }}" + ##### SET TEXT Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ repeat.item.button }}text" + message: "{{ button_color_2 }}" + ##### SET BRIGHTNESS Background Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ repeat.item.button }}bri" + message: "{{ button_color_2 }}" + + ##### SET Buttons Font Color #### + # + ##### SET ICON Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ repeat.item.button }}icon" + message: "{{ button_color_3 }}" + ##### SET TEXT Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ repeat.item.button }}text" + message: "{{ button_color_1 }}" + + ##### SET Buttons Text Value #### + # + ##### "ICON" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ repeat.item.button }}icon" + message: "{{ button_icon_unknown }}" + ##### "LABEL" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ repeat.item.button }}text" + message: "{{ repeat.item.button_label }}" + ##### SET Button ##### + else: + - variables: + component_to_update: "{{ repeat.item.button }}" + # Button PIC GRAY/WHITE + btn_pic: >- + {%- if repeat.item.entity is match "light." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "light." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'open' -%} {{ button_on }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'closed' -%} {{ button_off }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_off }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_on }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_off }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_on }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- endif -%} + # TEXT, BRIGHTNESS and ICON Background + btn_bg: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_2 }} + {%- endif -%} + # ICON Font Color + btn_icon_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_icon_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_icon_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_icon_color_1 }} + {%- endif -%} + # LABEL Font Color + btn_txt_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_1 }} + {%- endif -%} + # BRIGHTNESS Font Color + btn_bri_font: "{{ button_color_2 }}" + # ICON Value + btn_icon: >- + {%- if repeat.item.button_icon |length > 0 -%} {{ repeat.item.button_icon }} + {%- elif repeat.item.entity is match "light." -%} {{ button_icon_light }} + {%- elif repeat.item.entity is match "switch." -%} {{ button_icon_switch }} + {%- elif repeat.item.entity is match "input_boolean." -%} {{ button_icon_input_boolan }} + {%- elif repeat.item.entity is match "cover." -%} {{ button_icon_cover }} + {%- elif repeat.item.entity is match "automation." -%} {{ button_icon_automation }} + {%- elif repeat.item.entity is match "button." -%} {{ button_icon_button }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_icon_input_button }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_icon_screne }} + {%- elif repeat.item.entity is match "script." -%} {{ button_icon_script }} + {%- elif repeat.item.entity is match "person." -%} {{ button_icon_person }} + {%- elif repeat.item.entity is match "binary_sensor." -%} {{ button_icon_binary_sensor }} + {%- elif repeat.item.entity is match "fan." -%} {{ button_icon_fan }} + {%- elif repeat.item.entity is match "climate." -%} {{ button_icon_climate }} + {%- endif -%} + # LABEL Value + btn_label: "{{ repeat.item.button_label }}" + # BRIGHTNESS Value + btn_bri_txt: >- + {%- if repeat.item.entity is match "light." and states(repeat.item.entity) == 'on' and state_attr(repeat.item.entity, "brightness") != None -%} {{ (state_attr(repeat.item.entity, "brightness") | int * 100 /255) | round(0) }}% + {%- elif repeat.item.entity is match "cover." and states(repeat.item.entity) == 'open' and state_attr(repeat.item.entity, "current_position") != None -%} {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}% + {%- elif repeat.item.entity is match "climate." and states(repeat.item.entity) != 'off' and state_attr(repeat.item.entity, "current_temperature") != None -%} {{ (state_attr(repeat.item.entity, "current_temperature") | int) | round(0) }}° + {%- else -%} 0 + {%- endif -%} + + ##### SET Buttons Background #### + # + ##### SET Button PIC ##### + - service: "{{ command_printf }}" + data: + cmd: "{{ component_to_update }}pic.pic={{ btn_pic }}" + ##### SET ICON Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_bg }}" + ##### SET TEXT Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_bg }}" + ##### SET BRIGHTNESS Background Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bg }}" + + ##### SET Buttons Font Color #### + # + ##### SET ICON Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon_font }}" + ##### SET TEXT Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_txt_font }}" + ##### SET BRIGHTNESS Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_font }}" + + ##### SET Buttons Text Value #### + # + ##### "ICON" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon }}" + ##### "LABEL" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}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: "{{ component_to_update }}bri" + message: " " + else: + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_txt }}" + ## PAGE BUTTONPAGE02 ## - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage02 }}' sequence: @@ -7006,6 +7533,223 @@ action: component: "bpage02_label" message: "{{ button_page02_label }}" + ##### NSPanel build buttons Buttonpage02 ##### + - delay: + milliseconds: "{{ delay_value }}" + - repeat: + for_each: + - entity: "{{ entity09 }}" + button_icon: "{{ entity09_icon }}" + button_label: "{{ entity09_name }}" + button: buttonpage02.button01 + - entity: "{{ entity10 }}" + button_icon: "{{ entity10_icon }}" + button_label: "{{ entity10_name }}" + button: buttonpage02.button02 + - entity: "{{ entity11 }}" + button_icon: "{{ entity11_icon }}" + button_label: "{{ entity11_name }}" + button: buttonpage02.button03 + - entity: "{{ entity12 }}" + button_icon: "{{ entity12_icon }}" + button_label: "{{ entity12_name }}" + button: buttonpage02.button04 + - entity: "{{ entity13 }}" + button_icon: "{{ entity13_icon }}" + button_label: "{{ entity13_name }}" + button: buttonpage02.button05 + - entity: "{{ entity14 }}" + button_icon: "{{ entity14_icon }}" + button_label: "{{ entity14_name }}" + button: buttonpage02.button06 + - entity: "{{ entity15 }}" + button_icon: "{{ entity15_icon }}" + button_label: "{{ entity15_name }}" + button: buttonpage02.button07 + - entity: "{{ entity16 }}" + button_icon: "{{ entity16_icon }}" + button_label: "{{ entity16_name }}" + button: buttonpage02.button08 + sequence: + - if: + - condition: template + value_template: '{{ repeat.item.entity|length > 0 and states[repeat.item.entity].state != "unavailable" and states[repeat.item.entity].state != "unknown" }}' + then: + - variables: + component_to_update: "{{ repeat.item.button }}" + # Button PIC GRAY/WHITE + btn_pic: >- + {%- if repeat.item.entity is match "light." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "light." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'open' -%} {{ button_on }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'closed' -%} {{ button_off }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_off }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_on }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_off }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_on }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif states[repeat.item.entity].state == 'unknown' -%} {{ button_off }} + {%- endif -%} + # TEXT, BRIGHTNESS and ICON Background + btn_bg: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_2 }} + {%- endif -%} + # ICON Font Color + btn_icon_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_icon_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_icon_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_icon_color_1 }} + {%- endif -%} + # LABEL Font Color + btn_txt_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_1 }} + {%- endif -%} + # BRIGHTNESS Font Color + btn_bri_font: "{{ button_color_2 }}" + # ICON Value + btn_icon: >- + {%- if repeat.item.button_icon |length > 0 -%} {{ repeat.item.button_icon }} + {%- elif states[repeat.item.entity].state == 'unknown' -%} {{ button_icon_unknown }} + {%- elif repeat.item.entity is match "light." -%} {{ button_icon_light }} + {%- elif repeat.item.entity is match "switch." -%} {{ button_icon_switch }} + {%- elif repeat.item.entity is match "input_boolean." -%} {{ button_icon_input_boolan }} + {%- elif repeat.item.entity is match "cover." -%} {{ button_icon_cover }} + {%- elif repeat.item.entity is match "automation." -%} {{ button_icon_automation }} + {%- elif repeat.item.entity is match "button." -%} {{ button_icon_button }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_icon_input_button }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_icon_screne }} + {%- elif repeat.item.entity is match "script." -%} {{ button_icon_script }} + {%- elif repeat.item.entity is match "person." -%} {{ button_icon_person }} + {%- elif repeat.item.entity is match "binary_sensor." -%} {{ button_icon_binary_sensor }} + {%- elif repeat.item.entity is match "fan." -%} {{ button_icon_fan }} + {%- elif repeat.item.entity is match "climate." -%} {{ button_icon_climate }} + {%- endif -%} + # LABEL Value + btn_label: "{{ repeat.item.button_label }}" + # BRIGHTNESS Value + btn_bri_txt: >- + {%- if repeat.item.entity is match "light." and states(repeat.item.entity) == 'on' and state_attr(repeat.item.entity, "brightness") != None -%} {{ (state_attr(repeat.item.entity, "brightness") | int * 100 /255) | round(0) }}% + {%- elif repeat.item.entity is match "cover." and states(repeat.item.entity) == 'open' and state_attr(repeat.item.entity, "current_position") != None -%} {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}% + {%- elif repeat.item.entity is match "climate." and states(repeat.item.entity) != 'off' and state_attr(repeat.item.entity, "current_temperature") != None -%} {{ (state_attr(repeat.item.entity, "current_temperature") | int) | round(0) }}° + {%- else -%} 0 + {%- endif -%} + + ##### SET Buttons Background #### + # + ##### SET Button PIC ##### + - service: "{{ command_printf }}" + data: + cmd: "{{ component_to_update }}pic.pic={{ btn_pic }}" + ##### SET ICON Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_bg }}" + ##### SET TEXT Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_bg }}" + ##### SET BRIGHTNESS Background Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bg }}" + + ##### SET Buttons Font Color #### + # + ##### SET ICON Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon_font }}" + ##### SET TEXT Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_txt_font }}" + ##### SET BRIGHTNESS Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_font }}" + + ##### SET Buttons Text Value #### + # + ##### "ICON" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon }}" + ##### "LABEL" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}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: "{{ component_to_update }}bri" + message: " " + else: + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_txt }}" + ## PAGE BUTTONPAGE03 ## - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage03 }}' sequence: @@ -7022,6 +7766,223 @@ action: component: "bpage03_label" message: "{{ button_page03_label }}" + ##### NSPanel build buttons ##### + - delay: + milliseconds: "{{ delay_value }}" + - repeat: + for_each: + - entity: "{{ entity17 }}" + button_icon: "{{ entity17_icon }}" + button_label: "{{ entity17_name }}" + button: buttonpage03.button01 + - entity: "{{ entity18 }}" + button_icon: "{{ entity18_icon }}" + button_label: "{{ entity18_name }}" + button: buttonpage03.button02 + - entity: "{{ entity19 }}" + button_icon: "{{ entity19_icon }}" + button_label: "{{ entity19_name }}" + button: buttonpage03.button03 + - entity: "{{ entity20 }}" + button_icon: "{{ entity20_icon }}" + button_label: "{{ entity20_name }}" + button: buttonpage03.button04 + - entity: "{{ entity21 }}" + button_icon: "{{ entity21_icon }}" + button_label: "{{ entity21_name }}" + button: buttonpage03.button05 + - entity: "{{ entity22 }}" + button_icon: "{{ entity22_icon }}" + button_label: "{{ entity22_name }}" + button: buttonpage03.button06 + - entity: "{{ entity23 }}" + button_icon: "{{ entity23_icon }}" + button_label: "{{ entity23_name }}" + button: buttonpage03.button07 + - entity: "{{ entity24 }}" + button_icon: "{{ entity24_icon }}" + button_label: "{{ entity24_name }}" + button: buttonpage03.button08 + sequence: + - if: + - condition: template + value_template: '{{ repeat.item.entity|length > 0 and states[repeat.item.entity].state != "unavailable" and states[repeat.item.entity].state != "unknown" }}' + then: + - variables: + component_to_update: "{{ repeat.item.button }}" + # Button PIC GRAY/WHITE + btn_pic: >- + {%- if repeat.item.entity is match "light." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "light." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'open' -%} {{ button_on }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'closed' -%} {{ button_off }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_off }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_on }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_off }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_on }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif states[repeat.item.entity].state == 'unknown' -%} {{ button_off }} + {%- endif -%} + # TEXT, BRIGHTNESS and ICON Background + btn_bg: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_2 }} + {%- endif -%} + # ICON Font Color + btn_icon_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_icon_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_icon_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_icon_color_1 }} + {%- endif -%} + # LABEL Font Color + btn_txt_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_1 }} + {%- endif -%} + # BRIGHTNESS Font Color + btn_bri_font: "{{ button_color_2 }}" + # ICON Value + btn_icon: >- + {%- if repeat.item.button_icon |length > 0 -%} {{ repeat.item.button_icon }} + {%- elif states[repeat.item.entity].state == 'unknown' -%} {{ button_icon_unknown }} + {%- elif repeat.item.entity is match "light." -%} {{ button_icon_light }} + {%- elif repeat.item.entity is match "switch." -%} {{ button_icon_switch }} + {%- elif repeat.item.entity is match "input_boolean." -%} {{ button_icon_input_boolan }} + {%- elif repeat.item.entity is match "cover." -%} {{ button_icon_cover }} + {%- elif repeat.item.entity is match "automation." -%} {{ button_icon_automation }} + {%- elif repeat.item.entity is match "button." -%} {{ button_icon_button }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_icon_input_button }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_icon_screne }} + {%- elif repeat.item.entity is match "script." -%} {{ button_icon_script }} + {%- elif repeat.item.entity is match "person." -%} {{ button_icon_person }} + {%- elif repeat.item.entity is match "binary_sensor." -%} {{ button_icon_binary_sensor }} + {%- elif repeat.item.entity is match "fan." -%} {{ button_icon_fan }} + {%- elif repeat.item.entity is match "climate." -%} {{ button_icon_climate }} + {%- endif -%} + # LABEL Value + btn_label: "{{ repeat.item.button_label }}" + # BRIGHTNESS Value + btn_bri_txt: >- + {%- if repeat.item.entity is match "light." and states(repeat.item.entity) == 'on' and state_attr(repeat.item.entity, "brightness") != None -%} {{ (state_attr(repeat.item.entity, "brightness") | int * 100 /255) | round(0) }}% + {%- elif repeat.item.entity is match "cover." and states(repeat.item.entity) == 'open' and state_attr(repeat.item.entity, "current_position") != None -%} {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}% + {%- elif repeat.item.entity is match "climate." and states(repeat.item.entity) != 'off' and state_attr(repeat.item.entity, "current_temperature") != None -%} {{ (state_attr(repeat.item.entity, "current_temperature") | int) | round(0) }}° + {%- else -%} 0 + {%- endif -%} + + ##### SET Buttons Background #### + # + ##### SET Button PIC ##### + - service: "{{ command_printf }}" + data: + cmd: "{{ component_to_update }}pic.pic={{ btn_pic }}" + ##### SET ICON Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_bg }}" + ##### SET TEXT Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_bg }}" + ##### SET BRIGHTNESS Background Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bg }}" + + ##### SET Buttons Font Color #### + # + ##### SET ICON Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon_font }}" + ##### SET TEXT Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_txt_font }}" + ##### SET BRIGHTNESS Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_font }}" + + ##### SET Buttons Text Value #### + # + ##### "ICON" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon }}" + ##### "LABEL" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}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: "{{ component_to_update }}bri" + message: " " + else: + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_txt }}" + ## PAGE BUTTONPAGE04 ## - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage04 }}' sequence: @@ -7037,6 +7998,223 @@ action: data: component: "bpage04_label" message: "{{ button_page04_label }}" + + ##### NSPanel build buttons ##### + - delay: + milliseconds: "{{ delay_value }}" + - repeat: + for_each: + - entity: "{{ entity25 }}" + button_icon: "{{ entity25_icon }}" + button_label: "{{ entity25_name }}" + button: buttonpage04.button01 + - entity: "{{ entity26 }}" + button_icon: "{{ entity26_icon }}" + button_label: "{{ entity26_name }}" + button: buttonpage04.button02 + - entity: "{{ entity27 }}" + button_icon: "{{ entity27_icon }}" + button_label: "{{ entity27_name }}" + button: buttonpage04.button03 + - entity: "{{ entity28 }}" + button_icon: "{{ entity28_icon }}" + button_label: "{{ entity28_name }}" + button: buttonpage04.button04 + - entity: "{{ entity29 }}" + button_icon: "{{ entity29_icon }}" + button_label: "{{ entity29_name }}" + button: buttonpage04.button05 + - entity: "{{ entity30 }}" + button_icon: "{{ entity30_icon }}" + button_label: "{{ entity30_name }}" + button: buttonpage04.button06 + - entity: "{{ entity31 }}" + button_icon: "{{ entity31_icon }}" + button_label: "{{ entity31_name }}" + button: buttonpage04.button07 + - entity: "{{ entity32 }}" + button_icon: "{{ entity32_icon }}" + button_label: "{{ entity32_name }}" + button: buttonpage04.button08 + sequence: + - if: + - condition: template + value_template: '{{ repeat.item.entity|length > 0 and states[repeat.item.entity].state != "unavailable" and states[repeat.item.entity].state != "unknown" }}' + then: + - variables: + component_to_update: "{{ repeat.item.button }}" + # Button PIC GRAY/WHITE + btn_pic: >- + {%- if repeat.item.entity is match "light." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "light." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'open' -%} {{ button_on }} + {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'closed' -%} {{ button_off }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "automation." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_off }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_off }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "script." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_on }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_off }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "binary_sensor." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'on' -%} {{ button_on }} + {%- elif repeat.item.entity is match "fan." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_on }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_off }} + {%- elif states[repeat.item.entity].state == 'unknown' -%} {{ button_off }} + {%- endif -%} + # TEXT, BRIGHTNESS and ICON Background + btn_bg: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_2 }} + {%- endif -%} + # ICON Font Color + btn_icon_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_icon_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_icon_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_icon_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_icon_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_icon_color_1 }} + {%- endif -%} + # LABEL Font Color + btn_txt_font: >- + {%- if repeat.item.entity is match "button." or repeat.item.entity is match "input_button." or repeat.item.entity is match "scene." -%} {{ button_color_1 }} + {%- elif states[repeat.item.entity].state == 'on' or states[repeat.item.entity].state == 'open' -%} {{ button_color_2 }} + {%- elif states[repeat.item.entity].state == 'off' or states[repeat.item.entity].state == 'closed' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state == 'home' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "person." and states[repeat.item.entity].state != 'home' -%} {{ button_color_1 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state != 'off' -%} {{ button_color_2 }} + {%- elif repeat.item.entity is match "climate." and states[repeat.item.entity].state == 'off' -%} {{ button_color_1 }} + {%- endif -%} + # BRIGHTNESS Font Color + btn_bri_font: "{{ button_color_2 }}" + # ICON Value + btn_icon: >- + {%- if repeat.item.button_icon |length > 0 -%} {{ repeat.item.button_icon }} + {%- elif states[repeat.item.entity].state == 'unknown' -%} {{ button_icon_unknown }} + {%- elif repeat.item.entity is match "light." -%} {{ button_icon_light }} + {%- elif repeat.item.entity is match "switch." -%} {{ button_icon_switch }} + {%- elif repeat.item.entity is match "input_boolean." -%} {{ button_icon_input_boolan }} + {%- elif repeat.item.entity is match "cover." -%} {{ button_icon_cover }} + {%- elif repeat.item.entity is match "automation." -%} {{ button_icon_automation }} + {%- elif repeat.item.entity is match "button." -%} {{ button_icon_button }} + {%- elif repeat.item.entity is match "input_button." -%} {{ button_icon_input_button }} + {%- elif repeat.item.entity is match "scene." -%} {{ button_icon_screne }} + {%- elif repeat.item.entity is match "script." -%} {{ button_icon_script }} + {%- elif repeat.item.entity is match "person." -%} {{ button_icon_person }} + {%- elif repeat.item.entity is match "binary_sensor." -%} {{ button_icon_binary_sensor }} + {%- elif repeat.item.entity is match "fan." -%} {{ button_icon_fan }} + {%- elif repeat.item.entity is match "climate." -%} {{ button_icon_climate }} + {%- endif -%} + # LABEL Value + btn_label: "{{ repeat.item.button_label }}" + # BRIGHTNESS Value + btn_bri_txt: >- + {%- if repeat.item.entity is match "light." and states(repeat.item.entity) == 'on' and state_attr(repeat.item.entity, "brightness") != None -%} {{ (state_attr(repeat.item.entity, "brightness") | int * 100 /255) | round(0) }}% + {%- elif repeat.item.entity is match "cover." and states(repeat.item.entity) == 'open' and state_attr(repeat.item.entity, "current_position") != None -%} {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}% + {%- elif repeat.item.entity is match "climate." and states(repeat.item.entity) != 'off' and state_attr(repeat.item.entity, "current_temperature") != None -%} {{ (state_attr(repeat.item.entity, "current_temperature") | int) | round(0) }}° + {%- else -%} 0 + {%- endif -%} + + ##### SET Buttons Background #### + # + ##### SET Button PIC ##### + - service: "{{ command_printf }}" + data: + cmd: "{{ component_to_update }}pic.pic={{ btn_pic }}" + ##### SET ICON Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_bg }}" + ##### SET TEXT Background ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_bg }}" + ##### SET BRIGHTNESS Background Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_background_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bg }}" + + ##### SET Buttons Font Color #### + # + ##### SET ICON Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon_font }}" + ##### SET TEXT Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}text" + message: "{{ btn_txt_font }}" + ##### SET BRIGHTNESS Font Color ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_font_color }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_font }}" + + ##### SET Buttons Text Value #### + # + ##### "ICON" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}icon" + message: "{{ btn_icon }}" + ##### "LABEL" Value ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}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: "{{ component_to_update }}bri" + message: " " + else: + - service: "{{ command_text_printf }}" + data: + component: "{{ component_to_update }}bri" + message: "{{ btn_bri_txt }}" ## PAGE NOTIFICATION ## - conditions: '{{ trigger.event.data.new_state.state == page_notification }}'