#############################################################
##### START - INPUT #####
#############################################################

blueprint:
  name: NSPanel Configuration
  description: v2.0.0 - Configuration and synchronization NSpanele via Blueprint
  domain: automation
  input:

    ##### MAIN NAME #####
    nspanel_name:
      name: ESPhome Node Name
      description: 'Here you have to enter the exact same name "device_name" as in the ESPHome file. Example nspanel-name'
      default: [nspanel_name]
      selector:
        text: {}

    ##### SYSTEM SETTINGS #####    
    language:
      name: Language for NSPanel
      description: 'select your language for the NSPanel Display'
      selector:
        select:
          options:
            - DE
            - EN
    tft_path:
      name: Nextion TFT File Folder for the service Folder Watcher
      description: 'TFT Path where the Nextion TFT File is stored ESPHome Example *"/config/www/nspanel/nspanel.tft"* Attention! The folder watcher must also be configured in the configuration.yaml. Only needed for manual upload of the TFT file. See HowTo' 
      default: [/config/www/nspanel/nspanel.tft]
      selector:
        text: {}
    delay:
      name: '# Delay to avoid sync problems'
      description: '# Synchronization Problems may occur due to the NETWORK / WLAN. To avoid this problem enter your value for the delay (milliseconds)'
      default: '10'
      selector:
        number:
          min: 0
          max: 100
    sync_value_ha:
      name: Synchronization of all values from HA to NSPanel for Lightsetting and Coversetting Page.
      description: 'Synchronization of values between HA and NSPanel for Lightsetting and Coversetting Page -> Maybe causes number jumps'
      default: 'No'
      selector:
        select:
          options:
            - label: 'No'
              value: select_no
            - label: 'Yes'
              value: select_yes
    sync_slider_ha:
      name: Synchronization of all Sliders from HA to NSPanel for LIGHTSETTING and COVERSETTING Page.
      description: 'Synchronization of sliders between HA and NSPanel for Lightsetting and Coversetting Page -> Maybe causes flickering on the Slider'
      default: 'No'
      selector:
        select:
          options:
            - label: 'No'
              value: select_no
            - label: 'Yes'
              value: select_yes

    ##### WEATHER #####          
    weather:
      name: Weather Integration
      description: 'select our Weather Integration'
      selector:
        select:
          options:
            - Default
            - AccuWeather
    accuweather:
      name: Name assigned to the AccuWeather Integration (Optional)
      description: 'If you use Accuweather Integration, the name of the Accuweather Integration must be entered here. ATTENTION! You must enter the name as specified in the entity. Example name is *"Home"* Weather then please write *"home_weather"*'
      default: []
      selector:
        text: {}
    
    ##### GENERAL ENTITYS #####
    outdoortemp:
      name: Outdoor Temperature Sensor (Optional)
      description: 'If no outdoor sensor is available, leave the field empty. If this field is not filled in, the outdoor temperature will be taken from your selected weather integration. If an entity is selected, the value is displayed on the *"Home Page"* and *"Thermostat Page"*'
      default: []
      selector:
        entity:
          domain:
            - sensor
    humidity:
      name: Humidity Sensor (Optional)
      description: 'If an entity is selected, the value is displayed on the *"Home Page"*'
      default: []
      selector:
        entity:
          domain:
            - sensor
    hotwatertemp:
      name: Hot Water Temperature Sensor (Optional)
      description: 'If an entity is selected, the value is displayed on the *"Home Page"* and *"Thermostat Page"*'
      default: []
      selector:
        entity:
          domain:
            - sensor
    hotwatercharge:
      name: Hot Water Charge (Optional)
      description: 'Entity is switchable on *"Thermostat Page"* to turn on hotwater charge'
      default: []
      selector:
        entity:
          domain:
            - switch
            - input_boolean
    heatingsystemflame:
      name: Flame State of Heating System (Optional)
      description: 'Shows flame-symbol on *"Home Page"* if central heating system is burning'
      default: []
      selector:
        entity:
          domain:
            - binary_sensor
    climate:
      name: Climate to control (Optional)
      description: 'If an entity is selected, *"Thermostat Page"* is enabled'
      default: []
      selector:
        entity:
          domain: climate
    
    ##### HARDWARE BUTTONS #####
    left_button_entity:
      name: Left Button (Optional)
      description: 'Left Hardware Button - Select the entity that should be switched'
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - input_boolean
            - cover
    left_button_name:
      name: Name "Left Button" (Optional)
      description: 'Left Button label - 10 characters are supported'
      default: []
      selector:
        text: {}
    right_button_entity:
      name: Right Button (Optional)
      description: 'Right Hardware Button - Select the entity that should be switched'
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - input_boolean
            - cover
    right_button_name:
      name: Name "Right Button" (Optional)
      description: 'Right Button label - 10 characters are supported'
      default: []
      selector:
        text: {}

    ##### BUTTONS #####
    entity01:
      name: Button 01 (Optional)
      description: Nextion Editor - *buttonpage01.button01*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity01_name:
      name: Name "Button 01" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity02:
      name: Button 02 (Optional)
      description: Nextion Editor - *buttonpage01.button02*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity02_name:
      name: Name "Button 02" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity03:
      name: Button 03 (Optional)
      description: Nextion Editor - *buttonpage01.button03*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity03_name:
      name: Name "Button 03" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity04:
      name: Button 04 (Optional)
      description: Nextion Editor - *buttonpage01.button04*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity04_name:
      name: Name "Button 04" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity05:
      name: Button 05 (Optional)
      description: Nextion Editor - *buttonpage01.button05*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity05_name:
      name: Name "Button 05" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity06:
      name: Button 06 (Optional)
      description: Nextion Editor - *buttonpage01.button06*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity06_name:
      name: Name "Button 06" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity07:
      name: Button 07 (Optional)
      description: Nextion Editor - *buttonpage01.button07*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity07_name:
      name: Name "Button 07" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity08:
      name: Button 08 (Optional)
      description: Nextion Editor - *buttonpage01.button08*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity08_name:
      name: Name "Button 08" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity09:
      name: Button 09 (Optional)
      description: Nextion Editor - *buttonpage02.button01*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity09_name:
      name: Name "Button 09" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity10:
      name: Button 10 (Optional)
      description: Nextion Editor - *buttonpage02.button02*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity10_name:
      name: Name "Button 10" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity11:
      name: Button 11 (Optional)
      description: Nextion Editor - *buttonpage02.button03*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity11_name:
      name: Name "Button 11" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity12:
      name: Button 12 (Optional)
      description: Nextion Editor - *buttonpage02.button04*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity12_name:
      name: Name "Button 12" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity13:
      name: Button 13 (Optional)
      description: Nextion Editor - *buttonpage01.button05*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity13_name:
      name: Name "Button 13" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity14:
      name: Button 14 (Optional)
      description: Nextion Editor - *buttonpage02.button06*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity14_name:
      name: Name "Button 14" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity15:
      name: Button 15 (Optional)
      description: Nextion Editor - *buttonpage02.button07*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity15_name:
      name: Name "Button 15" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity16:
      name: Button 16 (Optional)
      description: Nextion Editor - *buttonpage02.button08*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity16_name:
      name: Name "Button 16" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity17:
      name: Button 17 (Optional)
      description: Nextion Editor - *buttonpage03.button01*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity17_name:
      name: Name "Button 17" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity18:
      name: Button 18 (Optional)
      description: Nextion Editor - *buttonpage03.button02*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity18_name:
      name: Name "Button 18" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity19:
      name: Button 19 (Optional)
      description: Nextion Editor - *buttonpage03.button03*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity19_name:
      name: Name "Button 19" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity20:
      name: Button 20 (Optional)
      description: Nextion Editor - *buttonpage03.button04*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity20_name:
      name: Name "Button 20" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity21:
      name: Button 21 (Optional)
      description: Nextion Editor - *buttonpage03.button05*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity21_name:
      name: Name "Button 21" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity22:
      name: Button 22 (Optional)
      description: Nextion Editor - *buttonpage03.button06*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity22_name:
      name: Name "Button 22" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity23:
      name: Button 23 (Optional)
      description: Nextion Editor - *buttonpage03.button07*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity23_name:
      name: Name "Button 23" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity24:
      name: Button 24 (Optional)
      description: Nextion Editor - *buttonpage03.button08*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity24_name:
      name: Name "Button 24" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity25:
      name: Button 25 (Optional)
      description: Nextion Editor - *buttonpage04.button01*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity25_name:
      name: Name "Button 25" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity26:
      name: Button 26 (Optional)
      description: Nextion Editor - *buttonpage04.button02*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity26_name:
      name: Name "Button 26" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity27:
      name: Button 27 (Optional)
      description: Nextion Editor - *buttonpage04.button03*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity27_name:
      name: Name "Button 27" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity28:
      name: Button 28 (Optional)
      description: Nextion Editor - *buttonpage04.button04*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity28_name:
      name: Name "Button 28" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity29:
      name: Button 29 (Optional)
      description: Nextion Editor - *buttonpage04.button05*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity29_name:
      name: Name "Button 29" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity30:
      name: Button 30 (Optional)
      description: Nextion Editor - *buttonpage04.button06*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity30_name:
      name: Name "Button 30" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity31:
      name: Button 31 (Optional)
      description: Nextion Editor - *buttonpage04.button07*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity31_name:
      name: Name "Button 31" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}
    entity32:
      name: Button 32 (Optional)
      description: Nextion Editor - *buttonpage04.button08*  **(ONLY light | switch | cover | input_boolean)**
      default: []
      selector:
        entity:
          domain:
            - light
            - switch
            - cover
            - input_boolean
    entity32_name:
      name: Name "Button 32" (Optional)
      description: Button label - 10 characters are supported
      default: []
      selector:
        text: {}

mode: parallel
max: 5000

#############################################################
##### CLOSE - INPUT #####
#############################################################


#############################################################
##### START - Variables #####
#############################################################

trigger_variables:
  nspanel_name_trigger: !input "nspanel_name"
  last_click: "sensor.{{ nspanel_name_trigger }}_last_click"
  last_click_lightsettings: "sensor.{{ nspanel_name_trigger }}_last_click_lightsettings"
  last_click_coversettings: "sensor.{{ nspanel_name_trigger }}_last_click_coversettings"
  last_click_climatesettings: "sensor.{{ nspanel_name_trigger }}_last_click_climatesettings"
  left_button: "binary_sensor.{{ nspanel_name_trigger }}_left_button"
  right_button: "binary_sensor.{{ nspanel_name_trigger }}_right_button"
  weather_forcast_button: "binary_sensor.{{ nspanel_name_trigger }}_weather_forcast"
  nextion_inited_trigger: "switch.{{ nspanel_name_trigger }}_nextion_inited"
#  current_page: "sensor.{{ nspanel_name_trigger }}_current_page"
  current_page: "sensor.{{ nspanel_name_trigger }}_currentpage"
  hotwatercharge: !input "hotwatercharge"
  heatingsystemflame: !input "heatingsystemflame"

  ##### WEATHER Trigger #####
  weather: !input "weather"
  ha_weather: "weather.home"
  accuweather: !input "accuweather"
  accuweather_value: "weather.{{ accuweather }}"
  weather_entity: >-
    {%- if weather == "Default" -%} {{ ha_weather }}
    {%- elif weather == "AccuWeather" -%} {{ accuweather_value }}
    {%- endif -%} 

variables:
  ##### GENERAL #####
  nspanel_name: !input "nspanel_name"
  time: "{{ (as_timestamp(now()) | timestamp_custom('%H:%M')) }}"
  language: !input "language"

  ##### PUSH TO NEXTION DISPLAY #####
  command_text_printf: "esphome.{{ nspanel_name }}_send_command_text_printf"
  command_value: "esphome.{{ nspanel_name }}_send_command_value"
  command_printf: "esphome.{{ nspanel_name }}_send_command_printf"
  command_font_color: "esphome.{{ nspanel_name }}_send_command_font_color"
  command_background_color: "esphome.{{ nspanel_name }}_send_command_background_color"
  command_thermostat_cycle: "esphome.{{ nspanel_name }}_send_thermostat_cycle_state"

  ###### SYNC SETTINGS #####
  delay_boot: !input "delay"
  delay_value: !input "delay"
  delay_jump_page: !input "delay"
  sync_slider_ha: !input "sync_slider_ha"
  sync_value_ha: !input "sync_value_ha"

  ##### TFT UPLOAD #####
  tft_upload:  "esphome.{{ nspanel_name }}_upload_tft"
  tft_path: !input "tft_path"

  ##### GENERAL ENTITYS #####
  humidity: !input "humidity"
  hotwatertemp: !input "hotwatertemp"
  outdoortemp: !input "outdoortemp"
  climate: !input "climate"

  #### HARDWARE BUTTONS #####
  left_button_entity: !input "left_button_entity"
  left_button_name: !input "left_button_name"
  right_button_entity: !input "right_button_entity"
  right_button_name: !input "right_button_name"

  ##### NEXTION PIC MAPPING #####
  button_light_off: "62"
  button_light_on: "63"
  button_switch_off: "64"
  button_switch_on: "65"
  button_cover_off: "66"
  button_cover_on: "67"
  hardware_button_pic_off: "98"
  hardware_button_pic_on: "99"
  cover_pic_closed: "78"
  cover_pic_open: "79"
  battery_icon: "80"
  light_pic_off: "96"
  light_pic_on: "97"
  hotwater_pic_off: "60"
  hotwater_pic_on: "61"
  flame_pic_on: "57"
  flame_pic_off: "60"

  weather_sunny: "2"
  weather_cloudy: "3"
  weather_rainy: "4"
  weather_pouring: "5"
  weather_snowy: "6"
  weather_hail: "7"
  weather_snowy_rainy: "7"
  weather_fog: "8"
  weather_windy: "9"
  weather_windy_variant: "9"
  weather_lightning: "10"
  weather_partlycloudy_day: "11"
  weather_partlycloudy_night: "12"
  weather_lightning_rainy_day: "13"
  weather_lightning_rainy_night: "14"
  weather_execptional_day: "13"
  weather_execptional_night: "14"
  weather_clear_night: "15"

  weather_icon_blank: "51"
  weather_icon_rain: "52"
  weather_icon_sun: "53"
  weather_icon_protect: "54"
  weather_icon_lightning: "55"
  weather_icon_wind: "56"

  # hotw_bt_pic
  hotw_bt_blank: "100"
  hotw_bt_off: "101"
  hotw_bt_on: "102"

  # heating_bt_pic
  heating_bt_pic_off: "103"
  heating_bt_pic_on: "104"

  ###### NEXTION COLOR MAPPING #####
  button_color_1: "65535"
  button_color_2: "10597"

  ###### NEXTION PAGE MAPPING #####
  page_home: "home"
  page_weather01: "weather01"
  page_weather02: "weather02"
  page_weather03: "weather03"
  page_weather04: "weather04"
  page_weather05: "weather05"
  page_climate: "climate"
  page_settings: "settings"
  page_boot: "boot"
  page_screensaver: "screensaver"
  page_lightsettings: "lightsettings"
  page_coversettings: "coversettings"
  page_buttonpage01: "buttonpage01"
  page_buttonpage02: "buttonpage02"
  page_buttonpage03: "buttonpage03"
  page_buttonpage04: "buttonpage04"


  ##### MUI Multilingual User Interface (DE/EN) #####
  date01_mui: >-
    {%- if language == "DE" -%} {{ ((as_timestamp(now())) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Montag,')| replace('Tue', 'Dienstag,')| replace('Wed', 'Mittwoch,')| replace('Thu', 'Donnerstag,')| replace('Fri', 'Freitag,')| replace('Sat', 'Samstag,')| replace('Sun', 'Sonntag,') }}
    {%- elif language == "EN" -%} {{ ((as_timestamp(now())) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Monday,')| replace('Tue', 'Tuesday,')| replace('Wed', 'Wednesday,')| replace('Thu', 'Thursday,')| replace('Fri', 'Friday,')| replace('Sat', 'Saturday,')| replace('Sun', 'Sunday,') }}
    {%- endif -%}
  date02_mui: >-
    {%- if language == "DE" -%} {{ ((as_timestamp(now()) + 86400) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Montag,')| replace('Tue', 'Dienstag,')| replace('Wed', 'Mittwoch,')| replace('Thu', 'Donnerstag,')| replace('Fri', 'Freitag,')| replace('Sat', 'Samstag,')| replace('Sun', 'Sonntag,') }}
    {%- elif language == "EN" -%} {{ ((as_timestamp(now()) + 86400) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Monday,')| replace('Tue', 'Tuesday,')| replace('Wed', 'Wednesday,')| replace('Thu', 'Thursday,')| replace('Fri', 'Friday,')| replace('Sat', 'Saturday,')| replace('Sun', 'Sunday,') }}
    {%- endif -%}
  date03_mui: >-
    {%- if language == "DE" -%} {{ ((as_timestamp(now()) + 172800) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Montag,')| replace('Tue', 'Dienstag,')| replace('Wed', 'Mittwoch,')| replace('Thu', 'Donnerstag,')| replace('Fri', 'Freitag,')| replace('Sat', 'Samstag,')| replace('Sun', 'Sonntag,') }}
    {%- elif language == "EN" -%} {{ ((as_timestamp(now()) + 172800) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Monday,')| replace('Tue', 'Tuesday,')| replace('Wed', 'Wednesday,')| replace('Thu', 'Thursday,')| replace('Fri', 'Friday,')| replace('Sat', 'Saturday,')| replace('Sun', 'Sunday,') }}
    {%- endif -%}
  date04_mui: >-
    {%- if language == "DE" -%} {{ ((as_timestamp(now()) + 259200) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Montag,')| replace('Tue', 'Dienstag,')| replace('Wed', 'Mittwoch,')| replace('Thu', 'Donnerstag,')| replace('Fri', 'Freitag,')| replace('Sat', 'Samstag,')| replace('Sun', 'Sonntag,') }}
    {%- elif language == "EN" -%} {{ ((as_timestamp(now()) + 259200) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Monday,')| replace('Tue', 'Tuesday,')| replace('Wed', 'Wednesday,')| replace('Thu', 'Thursday,')| replace('Fri', 'Friday,')| replace('Sat', 'Saturday,')| replace('Sun', 'Sunday,') }}
    {%- endif -%}
  date05_mui: >-
    {%- if language == "DE" -%} {{ ((as_timestamp(now()) + 345600) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Montag,')| replace('Tue', 'Dienstag,')| replace('Wed', 'Mittwoch,')| replace('Thu', 'Donnerstag,')| replace('Fri', 'Freitag,')| replace('Sat', 'Samstag,')| replace('Sun', 'Sonntag,') }}
    {%- elif language == "EN" -%} {{ ((as_timestamp(now()) + 345600) | timestamp_custom('%a %d.%m' )) | replace('Mon', 'Monday,')| replace('Tue', 'Tuesday,')| replace('Wed', 'Wednesday,')| replace('Thu', 'Thursday,')| replace('Fri', 'Friday,')| replace('Sat', 'Saturday,')| replace('Sun', 'Sunday,') }}
    {%- endif -%}
  day01_mui: >-
    {%- if language == "DE" -%} Heute
    {%- elif language == "EN" -%} Today
    {%- endif -%}
  day02_mui: >-
    {%- if language == "DE" -%} Morgen
    {%- elif language == "EN" -%} Tomorrow
    {%- endif -%}
  day03_mui: >-
    {%- if language == "DE" -%} in 2 Tagen
    {%- elif language == "EN" -%} in 2 Days
    {%- endif -%}
  day04_mui: >-
    {%- if language == "DE" -%} in 3 Tagen
    {%- elif language == "EN" -%} in 3 Days
    {%- endif -%}
  day05_mui: >-
    {%- if language == "DE" -%} in 4 Tagen
    {%- elif language == "EN" -%} in 4 Days
    {%- endif -%}
  on_mui: >-
    {%- if language == "DE" -%} ein
    {%- elif language == "EN" -%} on
    {%- endif -%}
  off_mui: >-
    {%- if language == "DE" -%} aus
    {%- elif language == "EN" -%} off
    {%- endif -%}
  heat_mui: >-
    {%- if language == "DE" -%} heizen
    {%- elif language == "EN" -%} heat
    {%- endif -%}
  



  ##### FORCAST ACCUWEATHER - DAY 0 #####
  accuweather_realfeel_temperature_min_0d: "sensor.{{ accuweather }}_realfeel_temperature_min_0d"
  accuweather_realfeel_temperature_max_0d: "sensor.{{ accuweather }}_realfeel_temperature_max_0d"
  accuweather_hours_of_sun_0d: "sensor.{{ accuweather }}_hours_of_sun_0d"
  accuweather_uv_index_0d: "sensor.{{ accuweather }}_uv_index_0d"
  accuweather_thunderstorm_probability_day_0d: "sensor.{{ accuweather }}_thunderstorm_probability_day_0d"
  accuweather_thunderstorm_probability_night_0d: "sensor.{{ accuweather }}_thunderstorm_probability_night_0d"
  accuweather_wind_day_0d: "sensor.{{ accuweather }}_wind_day_0d"
  accuweather_wind_night_0d: "sensor.{{ accuweather }}_wind_night_0d"
  ##### FORCAST ACCUWEATHER - DAY 1 #####
  accuweather_realfeel_temperature_min_1d: "sensor.{{ accuweather }}_realfeel_temperature_min_1d"
  accuweather_realfeel_temperature_max_1d: "sensor.{{ accuweather }}_realfeel_temperature_max_1d"
  accuweather_hours_of_sun_1d: "sensor.{{ accuweather }}_hours_of_sun_1d"
  accuweather_uv_index_1d: "sensor.{{ accuweather }}_uv_index_1d"
  accuweather_thunderstorm_probability_day_1d: "sensor.{{ accuweather }}_thunderstorm_probability_day_1d"
  accuweather_thunderstorm_probability_night_1d: "sensor.{{ accuweather }}_thunderstorm_probability_night_1d"
  accuweather_wind_day_1d: "sensor.{{ accuweather }}_wind_day_1d"
  accuweather_wind_night_1d: "sensor.{{ accuweather }}_wind_night_1d"
  ##### FORCAST ACCUWEATHER - DAY 2 #####
  accuweather_realfeel_temperature_min_2d: "sensor.{{ accuweather }}_realfeel_temperature_min_2d"
  accuweather_realfeel_temperature_max_2d: "sensor.{{ accuweather }}_realfeel_temperature_max_2d"
  accuweather_hours_of_sun_2d: "sensor.{{ accuweather }}_hours_of_sun_2d"
  accuweather_uv_index_2d: "sensor.{{ accuweather }}_uv_index_2d"
  accuweather_thunderstorm_probability_day_2d: "sensor.{{ accuweather }}_thunderstorm_probability_day_2d"
  accuweather_thunderstorm_probability_night_2d: "sensor.{{ accuweather }}_thunderstorm_probability_night_2d"
  accuweather_wind_day_2d: "sensor.{{ accuweather }}_wind_day_2d"
  accuweather_wind_night_2d: "sensor.{{ accuweather }}_wind_night_2d"
  ##### FORCAST ACCUWEATHER - DAY 3 #####
  accuweather_realfeel_temperature_min_3d: "sensor.{{ accuweather }}_realfeel_temperature_min_3d"
  accuweather_realfeel_temperature_max_3d: "sensor.{{ accuweather }}_realfeel_temperature_max_3d"
  accuweather_hours_of_sun_3d: "sensor.{{ accuweather }}_hours_of_sun_3d"
  accuweather_uv_index_3d: "sensor.{{ accuweather }}_uv_index_3d"
  accuweather_thunderstorm_probability_day_3d: "sensor.{{ accuweather }}_thunderstorm_probability_day_3d"
  accuweather_thunderstorm_probability_night_3d: "sensor.{{ accuweather }}_thunderstorm_probability_night_3d"
  accuweather_wind_day_3d: "sensor.{{ accuweather }}_wind_day_3d"
  accuweather_wind_night_3d: "sensor.{{ accuweather }}_wind_night_3d"
  ##### FORCAST ACCUWEATHER - DAY 4 #####
  accuweather_realfeel_temperature_min_4d: "sensor.{{ accuweather }}_realfeel_temperature_min_4d"
  accuweather_realfeel_temperature_max_4d: "sensor.{{ accuweather }}_realfeel_temperature_max_4d"
  accuweather_hours_of_sun_4d: "sensor.{{ accuweather }}_hours_of_sun_4d"
  accuweather_uv_index_4d: "sensor.{{ accuweather }}_uv_index_4d"
  accuweather_thunderstorm_probability_day_4d: "sensor.{{ accuweather }}_thunderstorm_probability_day_4d"
  accuweather_thunderstorm_probability_night_4d: "sensor.{{ accuweather }}_thunderstorm_probability_night_4d"
  accuweather_wind_day_4d: "sensor.{{ accuweather }}_wind_day_4d"
  accuweather_wind_night_4d: "sensor.{{ accuweather }}_wind_night_4d"

  ##### BUTTONS 1- 32 #####
  entity01: !input "entity01"
  entity01_name: !input "entity01_name"
  entity02: !input "entity02"
  entity02_name: !input "entity02_name"
  entity03: !input "entity03"
  entity03_name: !input "entity03_name"
  entity04: !input "entity04"
  entity04_name: !input "entity04_name"
  entity05: !input "entity05"
  entity05_name: !input "entity05_name"
  entity06: !input "entity06"
  entity06_name: !input "entity06_name"
  entity07: !input "entity07"
  entity07_name: !input "entity07_name"
  entity08: !input "entity08"
  entity08_name: !input "entity08_name"
  entity09: !input "entity09"
  entity09_name: !input "entity09_name"
  entity10: !input "entity10"
  entity10_name: !input "entity10_name"
  entity11: !input "entity11"
  entity11_name: !input "entity11_name"
  entity12: !input "entity12"
  entity12_name: !input "entity12_name"
  entity13: !input "entity13"
  entity13_name: !input "entity13_name"
  entity14: !input "entity14"
  entity14_name: !input "entity14_name"
  entity15: !input "entity15"
  entity15_name: !input "entity15_name"
  entity16: !input "entity16"
  entity16_name: !input "entity16_name"
  entity17: !input "entity17"
  entity17_name: !input "entity17_name"
  entity18: !input "entity18"
  entity18_name: !input "entity18_name"
  entity19: !input "entity19"
  entity19_name: !input "entity19_name"
  entity20: !input "entity20"
  entity20_name: !input "entity20_name"
  entity21: !input "entity21"
  entity21_name: !input "entity21_name"
  entity22: !input "entity22"
  entity22_name: !input "entity22_name"
  entity23: !input "entity23"
  entity23_name: !input "entity23_name"
  entity24: !input "entity24"
  entity24_name: !input "entity24_name"
  entity25: !input "entity25"
  entity25_name: !input "entity25_name"
  entity26: !input "entity26"
  entity26_name: !input "entity26_name"
  entity27: !input "entity27"
  entity27_name: !input "entity27_name"
  entity28: !input "entity28"
  entity28_name: !input "entity28_name"
  entity29: !input "entity29"
  entity29_name: !input "entity29_name"
  entity30: !input "entity30"
  entity30_name: !input "entity30_name"
  entity31: !input "entity31"
  entity31_name: !input "entity31_name"
  entity32: !input "entity32"
  entity32_name: !input "entity32_name"

#############################################################
##### CLOSE - Variables #####
#############################################################


#############################################################
##### START - Trigger #####
#############################################################

trigger:

 ##### Trigger - General #################################################################################################################

  ###### DELME - Trigger "nspanel_boot_init" ######
  - platform: state
    entity_id: input_boolean.trigger_nspanel_boot
    to: "on"
    id: nspanel_boot_init
  
  ##### Reboot - Trigger "nspanel_boot_init" #####
  - platform: template
    value_template: '{{ states(nextion_inited_trigger) is match "on" }}'
    id: nspanel_boot_init

  ##### TFT Upload - Trigger "tft_upload" #####
  - platform: event
    event_type: folder_watcher
    event_data:
      event_type: modified
      path: !input "tft_path"
    id: tft_upload

  ##### Time - Trigger "time_state" #####
  - platform: time_pattern
    minutes: "/1"
    id: time_state

  #### Weather state changed #######
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: '{{ weather_entity }}'
    id: weather_state_change

  ##### Humidity - Trigger "humidity_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "humidity"
    id: humidity_state

  ##### Climate - Trigger "climate_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "climate"
    id: climate_state

  ##### Hot Water - Trigger "hotwatertemp_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "hotwatertemp"
    id: hotwatertemp_state

  ##### Outdoor Temp - Trigger "outdoortemp_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "outdoortemp"
    id: outdoortemp_state

  ##### Hot Water Charge - Trigger "hotwatercharge_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "hotwatercharge"
    id: hotwatercharge_state

  ##### Heating System Flame - Trigger "heatingsystemflame_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "heatingsystemflame"
    id: heatingsystemflame_state

  ##### Left Button - Trigger "left_button_press" #####
  - platform: template
    value_template: '{{ states(left_button) is match "on" }}'
    id: left_button_press

  ##### Right Button - Trigger "right_button_press" #####
  - platform: template
    value_template: '{{ states(right_button) is match "on" }}'
    id: right_button_press

  ##### Left Button - State "left_button_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "left_button_entity"
    id: left_button_state

  ##### Right Button - State "right_button_state" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input "right_button_entity"
    id: right_button_state

  #### Climate - Trigger ####
  - platform: template
    value_template: '{{ states(last_click) is match "releaseclimate" }}'
    id: open_climate_settings

  ##### Trigger - Button General #################################################################################################################

  ##### Page Button - Trigger "short_press" - SHORT Press via "last_click" #####
  - platform: template
    value_template: '{{ states(last_click) is match "releasebutton" }}'
    id: short_press

  ##### Page Button - Trigger "long_press" - LONG Press via "last_click" - Button LONG Press for jump to Lightsetting or Coversetting Page #####
  - platform: template
    value_template: '{{ states(last_click) is match "press" }}'
    for:
      seconds: 1
    id: long_press

  ##### Page Lightsettings - Trigger "light_settings" - Changes Lightsettings Page via "last_click_lightsettings" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: "{{ last_click_lightsettings }}"
    id: light_settings

  ##### Page Coversettings - Trigger "cover_settings" - Changes Coversettings Page via "last_click_coversettings" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: "{{ last_click_coversettings }}"
    id: cover_settings

   ##### Page Climatesettings - Trigger "climate_settings" - Changes Climatesettings Page via "last_click_climatesettings" #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: "{{ last_click_climatesettings }}"
    id: climate_settings

  ##### Current page changed #####
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: "{{ current_page }}"
    id: current_page_changed

  ##### Page Button - Trigger "button_page" Entity sync #####
  - platform: template
    value_template: '{{ states(last_click) is match "button" }}'
    id: button_page



  ##### Trigger - Button State change #################################################################################################################
  
  ##### Button01 Sync - Trigger "current_state_entity01" #####
  - platform: state
    entity_id: !input "entity01"
    id: current_state_entity01

  ##### Button02 Sync - Trigger "current_state_entity02" #####
  - platform: state
    entity_id: !input "entity02"
    id: current_state_entity02

  ##### Button03 Sync - Trigger "current_state_entity03" #####
  - platform: state
    entity_id: !input "entity03"
    id: current_state_entity03

  ##### Button04 Sync - Trigger "current_state_entity04" #####
  - platform: state
    entity_id: !input "entity04"
    id: current_state_entity04

  ##### Button05 Sync - Trigger "current_state_entity05" #####
  - platform: state
    entity_id: !input "entity05"
    id: current_state_entity05

  ##### Button06 Sync - Trigger "current_state_entity06" #####
  - platform: state
    entity_id: !input "entity06"
    id: current_state_entity06

  ##### Button07 Sync - Trigger "current_state_entity07" #####
  - platform: state
    entity_id: !input "entity07"
    id: current_state_entity07

  ##### Button08 Sync - Trigger "current_state_entity08" #####
  - platform: state
    entity_id: !input "entity08"
    id: current_state_entity08

  ##### Button09 Sync - Trigger "current_state_entity09" #####
  - platform: state
    entity_id: !input "entity09"
    id: current_state_entity09

  ##### Button10 Sync - Trigger "current_state_entity10" #####
  - platform: state
    entity_id: !input "entity10"
    id: current_state_entity10

  ##### Button11 Sync - Trigger "current_state_entity11" #####
  - platform: state
    entity_id: !input "entity11"
    id: current_state_entity11

  ##### Button12 Sync - Trigger "current_state_entity12" #####
  - platform: state
    entity_id: !input "entity12"
    id: current_state_entity12

  ##### Button13 Sync - Trigger "current_state_entity13" #####
  - platform: state
    entity_id: !input "entity13"
    id: current_state_entity13

  ##### Button14 Sync - Trigger "current_state_entity14" #####
  - platform: state
    entity_id: !input "entity14"
    id: current_state_entity14

  ##### Button15 Sync - Trigger "current_state_entity15" #####
  - platform: state
    entity_id: !input "entity15"
    id: current_state_entity15

  ##### Button16 Sync - Trigger "current_state_entity16" #####
  - platform: state
    entity_id: !input "entity16"
    id: current_state_entity16

  ##### Button17 Sync - Trigger "current_state_entity17" #####
  - platform: state
    entity_id: !input "entity17"
    id: current_state_entity17

  ##### Button18 Sync - Trigger "current_state_entity18" #####
  - platform: state
    entity_id: !input "entity18"
    id: current_state_entity18

  ##### Button19 Sync - Trigger "current_state_entity19" #####
  - platform: state
    entity_id: !input "entity19"
    id: current_state_entity19

  ##### Button20 Sync - Trigger "current_state_entity20" #####
  - platform: state
    entity_id: !input "entity20"
    id: current_state_entity20

  ##### Button21 Sync - Trigger "current_state_entity21" #####
  - platform: state
    entity_id: !input "entity21"
    id: current_state_entity21

  ##### Button22 Sync - Trigger "current_state_entity22" #####
  - platform: state
    entity_id: !input "entity22"
    id: current_state_entity22

  ##### Button23 Sync - Trigger "current_state_entity23" #####
  - platform: state
    entity_id: !input "entity23"
    id: current_state_entity23

  ##### Button24 Sync - Trigger "current_state_entity24" #####
  - platform: state
    entity_id: !input "entity24"
    id: current_state_entity24

  ##### Button25 Sync - Trigger "current_state_entity25" #####
  - platform: state
    entity_id: !input "entity25"
    id: current_state_entity25

  ##### Button26 Sync - Trigger "current_state_entity26" #####
  - platform: state
    entity_id: !input "entity26"
    id: current_state_entity26

  ##### Button27 Sync - Trigger "current_state_entity27" #####
  - platform: state
    entity_id: !input "entity27"
    id: current_state_entity27

  ##### Button28 Sync - Trigger "current_state_entity28" #####
  - platform: state
    entity_id: !input "entity28"
    id: current_state_entity28

  ##### Button29 Sync - Trigger "current_state_entity29" #####
  - platform: state
    entity_id: !input "entity29"
    id: current_state_entity29

  ##### Button30 Sync - Trigger "current_state_entity30" #####
  - platform: state
    entity_id: !input "entity30"
    id: current_state_entity30

  ##### Button31 Sync - Trigger "current_state_entity31" #####
  - platform: state
    entity_id: !input "entity31"
    id: current_state_entity31

  ##### Button32 Sync - Trigger "current_state_entity32" #####
  - platform: state
    entity_id: !input "entity32"
    id: current_state_entity32


#############################################################
##### CLOSE - Trigger #####
#############################################################


#############################################################
##### START - Action #####
#############################################################

action:
  - variables:
      ##### Entity - Page Lightsettings #####
      entity_long: >-
        {%- if states(last_click) == "pressbuttonpage01button01" -%} {{ entity01 }}
        {%- elif states(last_click) == "pressbuttonpage01button02" -%} {{ entity02 }}
        {%- elif states(last_click) == "pressbuttonpage01button03" -%} {{ entity03 }}
        {%- elif states(last_click) == "pressbuttonpage01button04" -%} {{ entity04 }}
        {%- elif states(last_click) == "pressbuttonpage01button05" -%} {{ entity05 }}
        {%- elif states(last_click) == "pressbuttonpage01button06" -%} {{ entity06 }}
        {%- elif states(last_click) == "pressbuttonpage01button07" -%} {{ entity07 }}
        {%- elif states(last_click) == "pressbuttonpage01button08" -%} {{ entity08 }}
        {%- elif states(last_click) == "pressbuttonpage02button01" -%} {{ entity09 }}
        {%- elif states(last_click) == "pressbuttonpage02button02" -%} {{ entity10 }}
        {%- elif states(last_click) == "pressbuttonpage02button03" -%} {{ entity11 }}
        {%- elif states(last_click) == "pressbuttonpage02button04" -%} {{ entity12 }}
        {%- elif states(last_click) == "pressbuttonpage02button05" -%} {{ entity13 }}
        {%- elif states(last_click) == "pressbuttonpage02button06" -%} {{ entity14 }}
        {%- elif states(last_click) == "pressbuttonpage02button07" -%} {{ entity15 }}
        {%- elif states(last_click) == "pressbuttonpage02button08" -%} {{ entity16 }}
        {%- elif states(last_click) == "pressbuttonpage03button01" -%} {{ entity17 }}
        {%- elif states(last_click) == "pressbuttonpage03button02" -%} {{ entity18 }}
        {%- elif states(last_click) == "pressbuttonpage03button03" -%} {{ entity19 }}
        {%- elif states(last_click) == "pressbuttonpage03button04" -%} {{ entity20 }}
        {%- elif states(last_click) == "pressbuttonpage03button05" -%} {{ entity21 }}
        {%- elif states(last_click) == "pressbuttonpage03button06" -%} {{ entity22 }}
        {%- elif states(last_click) == "pressbuttonpage03button07" -%} {{ entity23 }}
        {%- elif states(last_click) == "pressbuttonpage03button08" -%} {{ entity24 }}
        {%- elif states(last_click) == "pressbuttonpage04button01" -%} {{ entity25 }}
        {%- elif states(last_click) == "pressbuttonpage04button02" -%} {{ entity26 }}
        {%- elif states(last_click) == "pressbuttonpage04button03" -%} {{ entity27 }}
        {%- elif states(last_click) == "pressbuttonpage04button04" -%} {{ entity28 }}
        {%- elif states(last_click) == "pressbuttonpage04button05" -%} {{ entity29 }}
        {%- elif states(last_click) == "pressbuttonpage04button06" -%} {{ entity30 }}
        {%- elif states(last_click) == "pressbuttonpage04button07" -%} {{ entity31 }}
        {%- elif states(last_click) == "pressbuttonpage04button08" -%} {{ entity32 }}
        {%- endif -%}

      ##### Entity Name - Page Lightsettings #####
      entity_long_name: >-
        {%- if states(last_click) == "pressbuttonpage01button01" -%} {{ entity01_name }}
        {%- elif states(last_click) == "pressbuttonpage01button02" -%} {{ entity02_name }}
        {%- elif states(last_click) == "pressbuttonpage01button03" -%} {{ entity03_name }}
        {%- elif states(last_click) == "pressbuttonpage01button04" -%} {{ entity04_name }}
        {%- elif states(last_click) == "pressbuttonpage01button05" -%} {{ entity05_name }}
        {%- elif states(last_click) == "pressbuttonpage01button06" -%} {{ entity06_name }}
        {%- elif states(last_click) == "pressbuttonpage01button07" -%} {{ entity07_name }}
        {%- elif states(last_click) == "pressbuttonpage01button08" -%} {{ entity08_name }}
        {%- elif states(last_click) == "pressbuttonpage02button01" -%} {{ entity09_name }}
        {%- elif states(last_click) == "pressbuttonpage02button02" -%} {{ entity10_name }}
        {%- elif states(last_click) == "pressbuttonpage02button03" -%} {{ entity11_name }}
        {%- elif states(last_click) == "pressbuttonpage02button04" -%} {{ entity12_name }}
        {%- elif states(last_click) == "pressbuttonpage02button05" -%} {{ entity13_name }}
        {%- elif states(last_click) == "pressbuttonpage02button06" -%} {{ entity14_name }}
        {%- elif states(last_click) == "pressbuttonpage02button07" -%} {{ entity15_name }}
        {%- elif states(last_click) == "pressbuttonpage02button08" -%} {{ entity16_name }}
        {%- elif states(last_click) == "pressbuttonpage03button01" -%} {{ entity17_name }}
        {%- elif states(last_click) == "pressbuttonpage03button02" -%} {{ entity18_name }}
        {%- elif states(last_click) == "pressbuttonpage03button03" -%} {{ entity19_name }}
        {%- elif states(last_click) == "pressbuttonpage03button04" -%} {{ entity20_name }}
        {%- elif states(last_click) == "pressbuttonpage03button05" -%} {{ entity21_name }}
        {%- elif states(last_click) == "pressbuttonpage03button06" -%} {{ entity22_name }}
        {%- elif states(last_click) == "pressbuttonpage03button07" -%} {{ entity23_name }}
        {%- elif states(last_click) == "pressbuttonpage03button08" -%} {{ entity24_name }}
        {%- elif states(last_click) == "pressbuttonpage04button01" -%} {{ entity25_name }}
        {%- elif states(last_click) == "pressbuttonpage04button02" -%} {{ entity26_name }}
        {%- elif states(last_click) == "pressbuttonpage04button03" -%} {{ entity27_name }}
        {%- elif states(last_click) == "pressbuttonpage04button04" -%} {{ entity28_name }}
        {%- elif states(last_click) == "pressbuttonpage04button05" -%} {{ entity29_name}}
        {%- elif states(last_click) == "pressbuttonpage04button06" -%} {{ entity30_name }}
        {%- elif states(last_click) == "pressbuttonpage04button07" -%} {{ entity31_name }}
        {%- elif states(last_click) == "pressbuttonpage04button08" -%} {{ entity32_name }}
        {%- endif -%}

      ##### Entity - Page Lightsettings - Skip Back #####
      entity_back: >-
        {%- if states(last_click) == "pressbuttonpage01button01" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button02" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button03" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button04" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button05" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button06" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button07" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage01button08" -%} {{ "page buttonpage01" }}
        {%- elif states(last_click) == "pressbuttonpage02button01" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button02" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button03" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button04" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button05" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button06" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button07" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage02button08" -%} {{ "page buttonpage02" }}
        {%- elif states(last_click) == "pressbuttonpage03button01" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button02" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button03" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button04" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button05" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button06" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button07" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage03button08" -%} {{ "page buttonpage03" }}
        {%- elif states(last_click) == "pressbuttonpage04button01" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button02" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button03" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button04" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button05" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button06" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button07" -%} {{ "page buttonpage04" }}
        {%- elif states(last_click) == "pressbuttonpage04button08" -%} {{ "page buttonpage04" }}
        {%- endif -%}

  ########################################################################################################################

  # main - alias: "choose alias (name) - NEW VERSION"
  - choose:

      ##### NSPanel boot init #####      DONE
      - conditions:
          - condition: trigger
            id: nspanel_boot_init
        sequence:

          ##### NSPanel boot init start #####
          - delay:
              milliseconds: 100
          - service: "{{ command_text_printf }}"
            data:
              component: home.loading
              message: "Loading - PLS WAIT!"

          ##### NSPanel boot init Date #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: home.date
              message: "{{ date01_mui }}"

          ##### NSPanel boot init buttons #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - repeat:
              for_each:
                - entity: "{{ entity01 }}"
                  button_label: "{{ entity01_name }}"
                  button: buttonpage01.button01
                - entity: "{{ entity02 }}"
                  button_label: "{{ entity02_name }}"
                  button: buttonpage01.button02
                - entity: "{{ entity03 }}"
                  button_label: "{{ entity03_name }}"
                  button: buttonpage01.button03
                - entity: "{{ entity04 }}"
                  button_label: "{{ entity04_name }}"
                  button: buttonpage01.button04
                - entity: "{{ entity05 }}"
                  button_label: "{{ entity05_name }}"
                  button: buttonpage01.button05
                - entity: "{{ entity06 }}"
                  button_label: "{{ entity06_name }}"
                  button: buttonpage01.button06
                - entity: "{{ entity07 }}"
                  button_label: "{{ entity07_name }}"
                  button: buttonpage01.button07
                - entity: "{{ entity08 }}"
                  button_label: "{{ entity08_name }}"
                  button: buttonpage01.button08
                - entity: "{{ entity09 }}"
                  button_label: "{{ entity09_name }}"
                  button: buttonpage02.button01
                - entity: "{{ entity10 }}"
                  button_label: "{{ entity10_name }}"
                  button: buttonpage02.button02
                - entity: "{{ entity11 }}"
                  button_label: "{{ entity11_name }}"
                  button: buttonpage02.button03
                - entity: "{{ entity12 }}"
                  button_label: "{{ entity12_name }}"
                  button: buttonpage02.button04
                - entity: "{{ entity13 }}"
                  button_label: "{{ entity13_name }}"
                  button: buttonpage02.button05
                - entity: "{{ entity14 }}"
                  button_label: "{{ entity14_name }}"
                  button: buttonpage02.button06
                - entity: "{{ entity15 }}"
                  button_label: "{{ entity15_name }}"
                  button: buttonpage02.button07
                - entity: "{{ entity16 }}"
                  button_label: "{{ entity16_name }}"
                  button: buttonpage02.button08
                - entity: "{{ entity17 }}"
                  button_label: "{{ entity17_name }}"
                  button: buttonpage03.button01
                - entity: "{{ entity18 }}"
                  button_label: "{{ entity18_name }}"
                  button: buttonpage03.button02
                - entity: "{{ entity19 }}"
                  button_label: "{{ entity19_name }}"
                  button: buttonpage03.button03
                - entity: "{{ entity20 }}"
                  button_label: "{{ entity20_name }}"
                  button: buttonpage03.button04
                - entity: "{{ entity21 }}"
                  button_label: "{{ entity21_name }}"
                  button: buttonpage03.button05
                - entity: "{{ entity22 }}"
                  button_label: "{{ entity22_name }}"
                  button: buttonpage03.button06
                - entity: "{{ entity23 }}"
                  button_label: "{{ entity23_name }}"
                  button: buttonpage03.button07
                - entity: "{{ entity24 }}"
                  button_label: "{{ entity24_name }}"
                  button: buttonpage03.button08
                - entity: "{{ entity25 }}"
                  button_label: "{{ entity17_name }}"
                  button: buttonpage04.button01
                - entity: "{{ entity26 }}"
                  button_label: "{{ entity26_name }}"
                  button: buttonpage04.button02
                - entity: "{{ entity27 }}"
                  button_label: "{{ entity27_name }}"
                  button: buttonpage04.button03
                - entity: "{{ entity28 }}"
                  button_label: "{{ entity28_name }}"
                  button: buttonpage04.button04
                - entity: "{{ entity29 }}"
                  button_label: "{{ entity29_name }}"
                  button: buttonpage04.button05
                - entity: "{{ entity30 }}"
                  button_label: "{{ entity30_name }}"
                  button: buttonpage04.button06
                - entity: "{{ entity31 }}"
                  button_label: "{{ entity31_name }}"
                  button: buttonpage04.button07
                - entity: "{{ entity32 }}"
                  button_label: "{{ entity32_name }}"
                  button: buttonpage04.button08
              sequence:
                - if:
                  - condition: template
                    value_template: '{{ repeat.item.entity|length > 0 }}'
                  then:
                    - variables:
                        component_to_update: "{{ repeat.item.button }}"
                        # Button PIC
                        btn_pic: >-
                          {%- if repeat.item.entity is match "light." and states[repeat.item.entity].state == 'on' -%} {{ button_light_on }}
                          {%- elif repeat.item.entity is match "light." and states[repeat.item.entity].state == 'off' -%} {{ button_light_off }}
                          {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'on' -%} {{ button_switch_on }}
                          {%- elif repeat.item.entity is match "switch." and states[repeat.item.entity].state == 'off' -%} {{ button_switch_off }}
                          {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'on' -%} {{ button_switch_on }}
                          {%- elif repeat.item.entity is match "input_boolean." and states[repeat.item.entity].state == 'off' -%} {{ button_switch_off }}
                          {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'open' -%} {{ button_cover_on }}
                          {%- elif repeat.item.entity is match "cover." and states[repeat.item.entity].state == 'closed' -%} {{ button_cover_off }}
                          {%- endif -%}
                        # TEXT and BRIGHTNESS Background
                        btn_bg: >-
                          {%- if 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 }}
                          {%- endif -%}
                        # TEXT Font
                        btn_txt_font: >-
                          {%- if 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 }}
                          {%- endif -%}
                        # BRIGHTNESS Font
                        btn_bri_font: "{{ button_color_2 }}"
                        # BTN Label
                        btn_label: "{{ repeat.item.button_label }}"
                        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) }}%
                          {%- else -%} 0
                          {%- endif -%}

                    ##### SET Buttons ####
                    #
                    ##### Button PIC #####
                    - service: "{{ command_printf }}"
                      data:
                        cmd: "{{ component_to_update }}pic.pic={{ btn_pic }}"
                    ##### TEXT Background #####
                    - delay:
                        milliseconds: "{{ delay_value }}"
                    - service: "{{ command_background_color }}"
                      data:
                        component: "{{ component_to_update }}text"
                        message: "{{ btn_bg }}"
                    ##### TEXT Font Color #####
                    - delay:
                        milliseconds: "{{ delay_value }}"
                    - service: "{{ command_font_color }}"
                      data:
                        component: "{{ component_to_update }}text"
                        message: "{{ btn_txt_font }}"
                    ##### BRIGHTNESS Background Color #####
                    - delay:
                        milliseconds: "{{ delay_value }}"
                    - service: "{{ command_background_color }}"
                      data:
                        component: "{{ component_to_update }}bri"
                        message: "{{ btn_bg }}"
                    ##### BRIGHTNESS Font Color #####
                    - delay:
                        milliseconds: "{{ delay_value }}"
                    - service: "{{ command_font_color }}"
                      data:
                        component: "{{ component_to_update }}bri"
                        message: "{{ btn_bri_font }}"
                    ##### "TEXT" Label #####
                    - delay:
                        milliseconds: "{{ delay_value }}"
                    - service: "{{ command_text_printf }}"
                      data:
                        component: "{{ component_to_update }}text"
                        message: "{{ btn_label }}"
                    ##### "BRIGHTNESS" Text #####
                    - 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 }}"

          ##### NSPanel boot init - Time #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: home.time
              message: "{{ time }}"
          
          #####  NSPanel boot init - Humidity #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: home.humidity_state
              message: "{{ states(humidity) |round(0) }}%"
          
          #####  NSPanel boot init - Hotwater #####
          - if:
              - condition: template
                value_template: '{{ hotwatertemp is match "sensor." }}'
            then:
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_printf }}"
                data:
                  cmd: home.hotwater_pic.pic={{ hotwater_pic_on }}
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_text_printf }}"
                data:
                  component: home.hotwater_temp
                  message: "{{ states(hotwatertemp) |round(1) }}°"

          #####  NSPanel boot init - Outdoor Temp #####
          - variables:
              outdoor_temp: >-
                {%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }}
                {%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}}
                {%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}}
                {%- endif -%}
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: home.outdoor_temp
              message: "{{ outdoor_temp }}°"

          ##### Weather Icon Home Page
          - variables:
              weather_pic: >-
                {%- if states(weather_entity) == 'sunny' -%} {{ weather_sunny }}
                {%- elif states(weather_entity) == 'cloudy' -%} {{ weather_cloudy }}
                {%- elif states(weather_entity) == 'rainy' -%} {{ weather_rainy }}
                {%- elif states(weather_entity) == 'pouring' -%} {{ weather_pouring }}
                {%- elif states(weather_entity) == 'snowy' -%} {{ weather_snowy }}
                {%- elif states(weather_entity) == 'hail' -%} {{ weather_hail }}
                {%- elif states(weather_entity) == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                {%- elif states(weather_entity) == 'fog' -%} {{ weather_fog }}
                {%- elif states(weather_entity) == 'windy' -%} {{ weather_windy }}
                {%- elif states(weather_entity) == 'windy-variant' -%} {{ weather_windy-variant }}
                {%- elif states(weather_entity) == 'lightning' -%} {{ weather_lightning }}
                {%- elif states(weather_entity) == 'partlycloudy' and states('sun.sun') == 'above_horizon' -%} {{ weather_partlycloudy_day }}
                {%- elif states(weather_entity) == 'partlycloudy' and states('sun.sun') == 'below_horizon' -%} {{ weather_partlycloudy_night }}
                {%- elif states(weather_entity) == 'lightning-rainy' and states('sun.sun') == 'above_horizon' -%} {{ weather_lightning_rainy_day }}
                {%- elif states(weather_entity) == 'lightning-rainy' and states('sun.sun') == 'below_horizon' -%} {{ weather_lightning_rainy_night }}
                {%- elif states(weather_entity) == 'execptional' and states('sun.sun') == 'above_horizon' -%} {{ weather_execptional_day }}
                {%- elif states(weather_entity) == 'execptional' and states('sun.sun') == 'below_horizon' -%} {{ weather_execptional_night }}
                {%- elif states(weather_entity) == 'clear-night' -%} {{ weather_clear_night }}
                {%- endif -%}

          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_printf }}"
            data:
              cmd: home.weather.pic={{ weather_pic }}
          
          #####  NSPanel boot init - Left Button Name #####
          - if:
              - condition: template
                value_template: '{{ left_button_name |length > 0 }}'          
            then:
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_text_printf }}"
                data:
                  component: home.left_bt_text
                  message: "{{ left_button_name }}"

          ##### SET Left Hardware Button PIC on Home Page ####
          - if:
              - condition: template
                value_template: '{{ left_button_entity |length > 0 }}'
            then:
              - variables:
                  # Hardware Button PIC
                  left_hardware_button_state: >-
                    {%- if states(left_button_entity) == 'off' -%} {{ hardware_button_pic_off }}
                    {%- elif states(left_button_entity) == 'on' -%} {{ hardware_button_pic_on }}
                    {%- endif -%}
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_printf }}"
                data:
                  cmd: home.left_bt_pic.pic={{ left_hardware_button_state }}

          #####  NSPanel boot init - Right Button Name #####
          - if:
              - condition: template
                value_template: '{{ right_button_name |length > 0 }}'         
            then:
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_text_printf }}"
                data:
                  component: home.right_bt_text
                  message: "{{ right_button_name }}"

          ###### SET Right Hardware Button PIC on Home Page #####
          - if:
              - condition: template
                value_template: '{{ right_button_entity |length > 0 }}'
            then:
              - variables:
              # Hardware Button PIC
                  right_hardware_button_state: >-
                    {%- if states(right_button_entity) == 'off' -%} {{ hardware_button_pic_off }}
                    {%- elif states(right_button_entity) == 'on' -%} {{ hardware_button_pic_on }}
                    {%- endif -%}
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_printf }}"
                data:
                  cmd: home.right_bt_pic.pic={{ right_hardware_button_state }}


          ##### NSPanel boot init finished #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: home.loading
              message: " "


      #### TFT Upload Automation #####      DONE
      - conditions:
          - condition: trigger
            id: tft_upload
        sequence:
          - delay:
              seconds: 2
          - service: "{{ tft_upload }}"
            data: {}


      ##### Update Button Page and Lightsettings / Coversettings Page  #####     DONE
      - conditions:
          - condition: trigger
            id:
              - current_state_entity01
              - current_state_entity02
              - current_state_entity03
              - current_state_entity04
              - current_state_entity05
              - current_state_entity06
              - current_state_entity07
              - current_state_entity08
              - current_state_entity09
              - current_state_entity10
              - current_state_entity11
              - current_state_entity12
              - current_state_entity13
              - current_state_entity14
              - current_state_entity15
              - current_state_entity16
              - current_state_entity17
              - current_state_entity18
              - current_state_entity19
              - current_state_entity20
              - current_state_entity21
              - current_state_entity22
              - current_state_entity23
              - current_state_entity24
              - current_state_entity25
              - current_state_entity26
              - current_state_entity27
              - current_state_entity28
              - current_state_entity29
              - current_state_entity30
              - current_state_entity31
              - current_state_entity32
        sequence:
          - alias: "Set variable(s) for entity change"
            variables:
              component_to_update: >-
                {%- if trigger.entity_id == entity01 -%} buttonpage01.button01
                {%- elif trigger.entity_id == entity02 -%} buttonpage01.button02
                {%- elif trigger.entity_id == entity03 -%} buttonpage01.button03
                {%- elif trigger.entity_id == entity04 -%} buttonpage01.button04
                {%- elif trigger.entity_id == entity05 -%} buttonpage01.button05
                {%- elif trigger.entity_id == entity06 -%} buttonpage01.button06
                {%- elif trigger.entity_id == entity07 -%} buttonpage01.button07
                {%- elif trigger.entity_id == entity08 -%} buttonpage01.button08
                {%- elif trigger.entity_id == entity09 -%} buttonpage02.button01
                {%- elif trigger.entity_id == entity10 -%} buttonpage02.button02
                {%- elif trigger.entity_id == entity11 -%} buttonpage02.button03
                {%- elif trigger.entity_id == entity12 -%} buttonpage02.button04
                {%- elif trigger.entity_id == entity13 -%} buttonpage02.button05
                {%- elif trigger.entity_id == entity14 -%} buttonpage02.button06
                {%- elif trigger.entity_id == entity15 -%} buttonpage02.button07
                {%- elif trigger.entity_id == entity16 -%} buttonpage02.button08
                {%- elif trigger.entity_id == entity17 -%} buttonpage03.button01
                {%- elif trigger.entity_id == entity18 -%} buttonpage03.button02
                {%- elif trigger.entity_id == entity19 -%} buttonpage03.button03
                {%- elif trigger.entity_id == entity20 -%} buttonpage03.button04
                {%- elif trigger.entity_id == entity21 -%} buttonpage03.button05
                {%- elif trigger.entity_id == entity22 -%} buttonpage03.button06
                {%- elif trigger.entity_id == entity23 -%} buttonpage03.button07
                {%- elif trigger.entity_id == entity24 -%} buttonpage03.button08
                {%- elif trigger.entity_id == entity25 -%} buttonpage04.button01
                {%- elif trigger.entity_id == entity26 -%} buttonpage04.button02
                {%- elif trigger.entity_id == entity27 -%} buttonpage04.button03
                {%- elif trigger.entity_id == entity28 -%} buttonpage04.button04
                {%- elif trigger.entity_id == entity29 -%} buttonpage04.button05
                {%- elif trigger.entity_id == entity30 -%} buttonpage04.button06
                {%- elif trigger.entity_id == entity31 -%} buttonpage04.button07
                {%- elif trigger.entity_id == entity32 -%} buttonpage04.button08
                {%- endif -%}
              # Button PIC
              btn_pic: >-
                {%- if trigger.to_state.entity_id is match "light." and trigger.to_state.state == 'on' -%} {{ button_light_on }}
                {%- elif trigger.to_state.entity_id is match "light." and trigger.to_state.state == 'off' -%} {{ button_light_off }}
                {%- elif trigger.to_state.entity_id is match "switch." and trigger.to_state.state == 'on' -%} {{ button_switch_on }}
                {%- elif trigger.to_state.entity_id is match "switch." and trigger.to_state.state == 'off' -%} {{ button_switch_off }}
                {%- elif trigger.to_state.entity_id is match "input_boolean." and trigger.to_state.state == 'on' -%} {{ button_switch_on }}
                {%- elif trigger.to_state.entity_id is match "input_boolean." and trigger.to_state.state == 'off' -%} {{ button_switch_off }}
                {%- elif trigger.to_state.entity_id is match "cover." and trigger.to_state.state == 'open' -%} {{ button_cover_on }}
                {%- elif trigger.to_state.entity_id is match "cover." and trigger.to_state.state == 'closed' -%} {{ button_cover_off }}
                {%- endif -%}
              # TEXT and BRIGHTNESS Background
              btn_bg: >-
                {%- if trigger.to_state.state == 'on' or trigger.to_state.state == 'open' -%} {{ button_color_1 }}
                {%- elif trigger.to_state.state == 'off' or trigger.to_state.state == 'closed' -%} {{ button_color_2 }}
                {%- endif -%}
              # TEXT Font
              btn_txt_font: >-
                {%- if trigger.to_state.state == 'on' or trigger.to_state.state == 'open' -%} {{ button_color_2 }}
                {%- elif trigger.to_state.state == 'off' or trigger.to_state.state == 'closed' -%} {{ button_color_1 }}
                {%- endif -%}
              # BRIGHTNESS Font
              btn_bri_font: "{{ button_color_2 }}"
              # BTN Label
              btn_label: >-
                {%- if trigger.entity_id == entity01 -%} {{ entity01_name }}
                {%- elif trigger.entity_id == entity02 -%} {{ entity02_name }}
                {%- elif trigger.entity_id == entity03 -%} {{ entity03_name }}
                {%- elif trigger.entity_id == entity04 -%} {{ entity04_name }}
                {%- elif trigger.entity_id == entity05 -%} {{ entity05_name }}
                {%- elif trigger.entity_id == entity06 -%} {{ entity06_name }}
                {%- elif trigger.entity_id == entity07 -%} {{ entity07_name }}
                {%- elif trigger.entity_id == entity08 -%} {{ entity08_name }}
                {%- elif trigger.entity_id == entity09 -%} {{ entity09_name }}
                {%- elif trigger.entity_id == entity10 -%} {{ entity10_name }}
                {%- elif trigger.entity_id == entity11 -%} {{ entity11_name }}
                {%- elif trigger.entity_id == entity12 -%} {{ entity12_name }}
                {%- elif trigger.entity_id == entity13 -%} {{ entity13_name }}
                {%- elif trigger.entity_id == entity14 -%} {{ entity14_name }}
                {%- elif trigger.entity_id == entity15 -%} {{ entity15_name }}
                {%- elif trigger.entity_id == entity16 -%} {{ entity16_name }}
                {%- elif trigger.entity_id == entity17 -%} {{ entity17_name }}
                {%- elif trigger.entity_id == entity18 -%} {{ entity18_name }}
                {%- elif trigger.entity_id == entity19 -%} {{ entity19_name }}
                {%- elif trigger.entity_id == entity20 -%} {{ entity20_name }}
                {%- elif trigger.entity_id == entity21 -%} {{ entity21_name }}
                {%- elif trigger.entity_id == entity22 -%} {{ entity22_name }}
                {%- elif trigger.entity_id == entity23 -%} {{ entity23_name }}
                {%- elif trigger.entity_id == entity24 -%} {{ entity24_name }}
                {%- elif trigger.entity_id == entity25 -%} {{ entity25_name }}
                {%- elif trigger.entity_id == entity26 -%} {{ entity26_name }}
                {%- elif trigger.entity_id == entity27 -%} {{ entity27_name }}
                {%- elif trigger.entity_id == entity28 -%} {{ entity28_name }}
                {%- elif trigger.entity_id == entity29 -%} {{ entity29_name }}
                {%- elif trigger.entity_id == entity30 -%} {{ entity30_name }}
                {%- elif trigger.entity_id == entity31 -%} {{ entity31_name }}
                {%- elif trigger.entity_id == entity32 -%} {{ entity32_name }}
                {%- endif -%}
              btn_bri_txt: >-
                {%- if trigger.to_state.entity_id is match "light." and trigger.to_state.state == 'on' and trigger.to_state.attributes.brightness is defined -%} {{ (trigger.to_state.attributes.brightness | int * 100 /255) | round(0) }}%
                {%- elif trigger.to_state.entity_id is match "cover." and trigger.to_state.state == 'open' and trigger.to_state.attributes.current_position is defined -%} {{ (trigger.to_state.attributes.current_position | int) | round(0) }}%
                {%- else -%} 0
                {%- endif -%}
              
          ##### Button PIC #####
          - service: "{{ command_printf }}"
            data:
              cmd: "{{ component_to_update }}pic.pic={{ btn_pic }}"

          ##### TEXT Background #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_background_color }}"
            data:
              component: "{{ component_to_update }}text"
              message: "{{ btn_bg }}"

          ##### TEXT Font Color #####
          - delay:
              milliseconds: "{{ delay_value }}"          
          - service: "{{ command_font_color }}"
            data:
              component: "{{ component_to_update }}text"
              message: "{{ btn_txt_font }}"

          ##### BRIGHTNESS Background Color #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_background_color }}"
            data:
              component: "{{ component_to_update }}bri"
              message: "{{ btn_bg }}"

          ##### BRIGHTNESS Font Color #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_font_color }}"
            data:
              component: "{{ component_to_update }}bri"
              message: "{{ btn_bri_font }}"

          ##### "TEXT" Label #####
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: "{{ component_to_update }}text"
              message: "{{ btn_label }}"

          ##### "BRIGHTNESS" Text #####
          - if:
              - condition: template
                value_template: "{{ btn_bri_txt == 0 }}"
            then:
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_text_printf }}"
                data:
                  component: "{{ component_to_update }}bri"
                  message: " "
            else:
              - delay:
                  milliseconds: "{{ delay_value }}"
              - service: "{{ command_text_printf }}"
                data:
                  component: "{{ component_to_update }}bri"
                  message: "{{ btn_bri_txt }}"

          ##### UPDATE LIGHTSETTING / COVERSETTING PAGE
          - choose:
              ##### LIGHTSETTINGS PAGE - LIGHT Entity #####
              - conditions:
                  - condition: template
                    value_template: '{{ entity_long is match "light." }}'
                sequence:                
                  - choose:
                      ##### LIGHT ON / OFF  
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "on" }}'
                        sequence:
                          ##### LIGHT PIC - ON ##### 
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: lightsettings.light_status.pic={{ light_pic_on }}

                          ##### LIGHT Brightness Slider HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_slider_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_value }}"
                                data:
                                  component: lightsettings.lightslider
                                  message: '{{ (state_attr(entity_long, "brightness") | int ) |round(0) }}'
                                  
                          ##### LIGHT Temp Slider HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_slider_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"                      
                              - service: "{{ command_value }}"
                                data:
                                  component: lightsettings.tempslider
                                  message: '{{ (state_attr(entity_long, "color_temp") | int ) |round(0) }}'             
                                  
                          ##### LIGHT Brightness Value HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_value_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"                      
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: lightsettings.light_value
                                  message: '{{ (state_attr(entity_long, "brightness") | int * 100 / 255) |round(0) }}%'
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: lightsettings.light_value_2
                                  message: '{{ (state_attr(entity_long, "brightness") | int * 100 / 255) |round(0) }}%'
                              
                          ##### LIGHT Temp Value HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_value_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: lightsettings.temp_value
                                  message: '{{ (state_attr(entity_long, "color_temp") | int ) |round(0) }}'
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: lightsettings.temp_value_2
                                  message: '{{ (state_attr(entity_long, "color_temp") | int ) |round(0) }}'                                

                      ##### LIGHT - OFF #####
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "off" }}'
                        sequence:
                          ##### LIGHT PIC - OFF #####
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: lightsettings.light_status.pic={{ light_pic_off }}

                          ##### LIGHT Brightness Slider HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_slider_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_value }}"
                                data:
                                  component: lightsettings.lightslider
                                  message: '0'
                                                         
                          ##### LIGHT Brightness Value HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_value_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"                      
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: lightsettings.light_value
                                  message: '0 %'
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: lightsettings.light_value_2
                                  message: '0 %'
                                         
              ##### COVERSETTINGS PAGE - COVER Entity #####
              - conditions:
                  - condition: template
                    value_template: '{{ entity_long is match "cover." }}'
                sequence:    
                  ##### COVER OPEN #####
                  - choose:
                      ##### Cover PIC - OPEN #####
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "open" }}'
                        sequence:
                          ##### COVER PIC - OPEN
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: coversettings.cover_status.pic={{ cover_pic_open }}

                          ##### Cover Slider HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_slider_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_value }}"
                                data:
                                  component: coversettings.coverslider
                                  message: '{{ (state_attr(entity_long, "current_position") | int ) |round(0) }}'         
                                  
                          ##### Cover Value HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_value_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: coversettings.cover_value
                                  message: '{{ (state_attr(entity_long, "current_position") | int ) |round(0) }} %'
                      
                      ##### Cover - Closed #####
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "closed" }}'
                        sequence:
                          ##### COVER PIC - CLOSED
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: coversettings.cover_status.pic={{ cover_pic_closed }}

                          ##### Cover Slider HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_slider_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_value }}"
                                data:
                                  component: coversettings.coverslider
                                  message: '0'         
                              
                          ##### Cover Value HA Sync - YES #####
                          - if:
                              - condition: template
                                value_template: '{{ sync_value_ha == "select_yes" }}'
                            then:
                              - delay:
                                  milliseconds: "{{ delay_value }}"
                              - service: "{{ command_text_printf }}"
                                data:
                                  component: coversettings.cover_value
                                  message: '0 %'


      ##### Page Button - SHORT Press - Toggle Enities #####      DONE
      - conditions:
          - condition: trigger
            id: short_press
        sequence:
          - variables:
              ##### Entity - Page Button - Toggle Entity #####
              entity_short: >-
                {%- if states(last_click) == "releasebuttonpage01button01" -%} {{ entity01 }}
                {%- elif states(last_click) == "releasebuttonpage01button02" -%} {{ entity02 }}
                {%- elif states(last_click) == "releasebuttonpage01button03" -%} {{ entity03 }}
                {%- elif states(last_click) == "releasebuttonpage01button04" -%} {{ entity04 }}
                {%- elif states(last_click) == "releasebuttonpage01button05" -%} {{ entity05 }}
                {%- elif states(last_click) == "releasebuttonpage01button06" -%} {{ entity06 }}
                {%- elif states(last_click) == "releasebuttonpage01button07" -%} {{ entity07 }}
                {%- elif states(last_click) == "releasebuttonpage01button08" -%} {{ entity08 }}
                {%- elif states(last_click) == "releasebuttonpage02button01" -%} {{ entity09 }}
                {%- elif states(last_click) == "releasebuttonpage02button02" -%} {{ entity10 }}
                {%- elif states(last_click) == "releasebuttonpage02button03" -%} {{ entity11 }}
                {%- elif states(last_click) == "releasebuttonpage02button04" -%} {{ entity12 }}
                {%- elif states(last_click) == "releasebuttonpage02button05" -%} {{ entity13 }}
                {%- elif states(last_click) == "releasebuttonpage02button06" -%} {{ entity14 }}
                {%- elif states(last_click) == "releasebuttonpage02button07" -%} {{ entity15 }}
                {%- elif states(last_click) == "releasebuttonpage02button08" -%} {{ entity16 }}
                {%- elif states(last_click) == "releasebuttonpage03button01" -%} {{ entity17 }}
                {%- elif states(last_click) == "releasebuttonpage03button02" -%} {{ entity18 }}
                {%- elif states(last_click) == "releasebuttonpage03button03" -%} {{ entity19 }}
                {%- elif states(last_click) == "releasebuttonpage03button04" -%} {{ entity20 }}
                {%- elif states(last_click) == "releasebuttonpage03button05" -%} {{ entity21 }}
                {%- elif states(last_click) == "releasebuttonpage03button06" -%} {{ entity22 }}
                {%- elif states(last_click) == "releasebuttonpage03button07" -%} {{ entity23 }}
                {%- elif states(last_click) == "releasebuttonpage03button08" -%} {{ entity24 }}
                {%- elif states(last_click) == "releasebuttonpage04button01" -%} {{ entity25 }}
                {%- elif states(last_click) == "releasebuttonpage04button02" -%} {{ entity26 }}
                {%- elif states(last_click) == "releasebuttonpage04button03" -%} {{ entity27 }}
                {%- elif states(last_click) == "releasebuttonpage04button04" -%} {{ entity28 }}
                {%- elif states(last_click) == "releasebuttonpage04button05" -%} {{ entity29 }}
                {%- elif states(last_click) == "releasebuttonpage04button06" -%} {{ entity30 }}
                {%- elif states(last_click) == "releasebuttonpage04button07" -%} {{ entity31 }}
                {%- elif states(last_click) == "releasebuttonpage04button08" -%} {{ entity32 }}
                {%- endif -%}
          - service: >-
              {% if entity_short is match 'light.' %}
              light.toggle
              {% elif entity_short is match 'switch.' %}
              switch.toggle
              {% elif entity_short is match 'cover.' %}
              cover.toggle
              {% elif entity_short is match 'input_boolean.' %}
              input_boolean.toggle
              {% endif %}
            data:
              entity_id: "{{ entity_short }}"


      ##### Page Button - LONG Press - JUMP to Page Lightsettings / Coversettings #####     DONE
      - conditions:
          - condition: trigger
            id: long_press
        sequence:
          - choose:
          ##### LONG Press - LIGHT Entity #####
              - conditions:
                  - condition: template
                    value_template: '{{ entity_long is match "light." }}'
                sequence:   
                  ##### LIGHT Generel Values #####
                  - service: "{{ command_printf }}"
                    data:
                      cmd: page lightsettings
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: lightsettings.light_name
                      message: '{{ entity_long_name }}'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - if:
                      - condition: template
                        value_template: "{{ state_attr(entity_long, 'brightness') != none }}"
                    then:
                      - service: "{{ command_value }}"
                        data:
                          component: lightsettings.lightslider
                          message: '{{ (state_attr(entity_long, "brightness") | int ) |round(0) }}'
                      - delay:
                          milliseconds: "{{ delay_value }}"                    
                      - service: "{{ command_text_printf }}"
                        data:
                          component: lightsettings.light_value
                          message: '{{ (state_attr(entity_long, "brightness") | int * 100 /255) | round(0) }}%'                    
                      - delay:
                          milliseconds: "{{ delay_value }}"                     
                      - service: "{{ command_text_printf }}"
                        data:
                          component: lightsettings.light_value_2
                          message: '{{ (state_attr(entity_long, "brightness") | int * 100 /255) | round(0) }}%'                                        
                    else:
                      - service: "{{ command_value }}"
                        data:
                          component: lightsettings.lightslider
                          message: '0'
                      - delay:
                          milliseconds: "{{ delay_value }}"                   
                      - service: "{{ command_text_printf }}"
                        data:
                          component: lightsettings.light_value
                          message: '0 %'                  
                      - delay:
                          milliseconds: "{{ delay_value }}"                   
                      - service: "{{ command_text_printf }}"
                        data:
                          component: lightsettings.light_value_2
                          message: '0 %'                  
                  
                  ##### LIGHT Check Color_Temp Value is available when yes send some current Values #####
                  - if:
                      - condition: template
                        value_template: "{{ state_attr(entity_long, 'color_temp') != none }}"
                    then:
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: lightsettings.temp_value
                          message: '{{ (state_attr(entity_long, "color_temp") | int ) |round(0) }}'
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: lightsettings.temp_value_2
                          message: '{{ (state_attr(entity_long, "color_temp") | int ) |round(0) }}'
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_value }}"
                        data:
                          component: lightsettings.tempslider
                          message: '{{ (state_attr(entity_long, "color_temp") | int ) |round(0) }}'
                  
                  ##### LIGHT ON / OFF #####   
                  - choose:
                      ##### LIGHT PIC - ON #####
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "on" }}'
                        sequence:
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: lightsettings.light_status.pic={{ light_pic_on }}
                  
                      ##### LIGHT PIC - OFF #####
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "off" }}'
                        sequence:
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: lightsettings.light_status.pic={{ light_pic_off }}
                  
              ##### LONG Press - COVER Entity #####
              - conditions:
                  - condition: template
                    value_template: '{{ entity_long is match "cover." }}'
                sequence:
                  ##### COVER Generel Values #####
                  - service: "{{ command_printf }}"
                    data:
                      cmd: page coversettings
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_value }}"
                    data:
                      component: coversettings.coverslider
                      message: '{{ (state_attr(entity_long, "current_position") | int ) |round(0) }}'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: coversettings.cover_value
                      message: '{{ (state_attr(entity_long, "current_position") | int ) |round(0) }} %'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: coversettings.cover_name
                      message: '{{ entity_long_name }}'
                  
                  ##### COVER Battery ICON Yes / NO #####
                  - if:
                      - condition: template
                        value_template: "{{ state_attr(entity_long, 'battery') != none }}"
                    then:
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: coversettings.battery_value
                          message: '{{ (state_attr(entity_long, "battery") | int ) |round(0) }} %'
                      - delay:
                          milliseconds: "{{ delay_value }}"    
                      - service: "{{ command_printf }}"
                        data:
                          cmd: coversettings.battery_icon.pic={{ battery_icon }}

                  ##### COVER OPEN / CLOSE
                  - choose:
                      ##### COVER PIC - open #####
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "open" }}'
                        sequence:
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: coversettings.cover_status.pic={{ cover_pic_open }}
                      
                      ##### COVER PIC - Closed
                      - conditions:
                          - condition: template
                            value_template: '{{ states(entity_long) == "closed" }}'
                        sequence:
                          - delay:
                              milliseconds: "{{ delay_value }}"
                          - service: "{{ command_printf }}"
                            data:
                              cmd: coversettings.cover_status.pic={{ cover_pic_closed }}
                      

      ##### LASTCLICK_LIGHTSETTINGS - Changes on page Light-Settings #####     DONE
      - conditions:
          - condition: trigger
            id: light_settings
        sequence:
          - choose:
              ##### Page Lightsettings - Brightness Slider MOVE #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state is match "brightness\d+" and trigger.event.data.new_state.state == states(last_click_lightsettings) }}'
                sequence:
                  - service: light.turn_on
                    data:
                      entity_id: "{{ entity_long }}"
                      brightness: '{{ trigger.event.data.new_state.state |replace("brightness","") | int }}'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: lightsettings.light_value
                      message: '{{ (trigger.event.data.new_state.state |replace("brightness","") | int * 100 /255) |round(0) }}%'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: lightsettings.light_value_2
                      message: '{{ (trigger.event.data.new_state.state |replace("brightness","") | int * 100 /255) |round(0) }}%'

              ##### Page Lightsettings - color_Temp Slider MOVE #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state is match "colortemp\d+" and trigger.event.data.new_state.state == states(last_click_lightsettings) }}'
                sequence:
                  - service: light.turn_on
                    data:
                      entity_id: "{{ entity_long }}"
                      color_temp: '{{ trigger.event.data.new_state.state |replace("colortemp","") | int }}'
                  - delay:
                      milliseconds: "{{ delay_value }}"                  
                  - service: "{{ command_text_printf }}"
                    data:
                      component: lightsettings.temp_value
                      message: '{{ trigger.event.data.new_state.state |replace("colortemp","") | int }}'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: lightsettings.temp_value_2
                      message: '{{ trigger.event.data.new_state.state |replace("colortemp","") | int }}'

              ##### Page Lightsettings - Color RGB Slider MOVE #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state is match "\d+,\d+,\d+" }}'
                sequence:
                  - service: light.turn_on
                    data:
                      entity_id: "{{ entity_long }}"
                      rgb_color: '{{ trigger.event.data.new_state.state.split(",") }}'

              ##### Page Lightsettings - Close Lightsetting Page #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state == "releaselightsettingsclose" }}'
                sequence:
                  - service: "{{ command_printf }}"
                    data:
                      cmd: "{{ entity_back }}"


      ##### LASTCLICK_COVERSETTINGS - Changes on page Cover-Settings #####     DONE
      - conditions:
          - condition: trigger
            id: cover_settings
        sequence:
          - choose:
              ##### Page Coversettings - Cover Slider MOVE #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state is match "coverposition\d+" and trigger.event.data.new_state.state == states(last_click_coversettings) }}'
                sequence:
                  - service: cover.set_cover_position
                    data:
                      entity_id: "{{ entity_long }}"
                      position: '{{ trigger.event.data.new_state.state |replace("coverposition","") | int }}'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: coversettings.cover_value
                      message: '{{ trigger.event.data.new_state.state |replace("coverposition","") | int }} %'
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: coversettings.cover_value_2
                      message: '{{ trigger.event.data.new_state.state |replace("coverposition","") | int }} %'
              
              ##### Page Coversettings - Cover CLOSE Button #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state == "cover_close_press" }}'
                sequence:
                  - service: cover.close_cover
                    data:
                      entity_id: "{{ entity_long }}"
              
              ##### Page Coversettings - Cover OPEN Button #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state == "cover_open_press" }}'
                sequence:
                  - service: cover.open_cover
                    data:
                      entity_id: "{{ entity_long }}"
             
              ##### Page Coversettings - Cover STOP Button #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state == "cover_stop_press" }}'
                sequence:
                  - service: cover.stop_cover
                    data:
                      entity_id: "{{ entity_long }}"

              ##### Page Coversettings - Close Coversettings Page #####
              - conditions:
                  - condition: template
                    value_template: '{{ trigger.event.data.new_state.state == "releasecoversettingsclose" }}'
                sequence:
                  - service: "{{ command_printf }}"
                    data:
                      cmd: "{{ entity_back }}"


      ##### LASTCLICK_CLIMATESETTINGS - Changes on page Climate-Settings #####     DONE
      - conditions:
          - condition: trigger
            id: climate_settings
        sequence:
          - choose:
              ##### Page Climatesettings - hotwater #####
              - conditions: '{{ trigger.event.data.new_state.state == "releasehotwater" }}'
                sequence:
                  - if: 
                      - condition: template
                        value_template: '{{ states(hotwatercharge) == "off" }}'
                    then:
                      - service: >-
                          {% if hotwatercharge is match 'switch.' %}
                            switch.turn_on
                          {% elif hotwatercharge is match 'input_boolean.' %}
                            input_boolean.turn_on
                          {% endif %}
                        data:
                          entity_id: "{{ hotwatercharge }}"

              ##### Page Climatesettings - heating #####
              - conditions: '{{ trigger.event.data.new_state.state == "releaseheating" }}'
                sequence:
                  - if:
                      - condition: template
                        value_template: '{{ states(climate) == "off" }}'
                    then:
                      - service: climate.turn_on
                        data:
                          entity_id: !input climate
                      # - service: climate.set_temperature
                      #   data:
                      #     entity_id: !input climate
                      #     hvac_mode: 'heat'
                      #     temperature: "{{ state_attr(climate, 'temperature') }}"
                    else:
                      - service: climate.turn_off
                        data:
                          entity_id: !input climate
                      # - service: climate.set_temperature
                      #   data:
                      #     entity_id:  !input climate
                      #     hvac_mode: 'off'
                      #     temperature: "{{ state_attr(climate, 'temperature') }}"

              ##### Page Climatesettings - decreasetemp #####
              - conditions: '{{ trigger.event.data.new_state.state == "releasedecreasetemp" }}'
                sequence:
                  - if:
                      - condition: template
                        value_template: '{{ states(climate) != "off" }}'
                    then:
                      - variables:
                          current_setpoint: "{{state_attr(climate, 'temperature') | round(1)}}"
                      - service: climate.set_temperature
                        data:
                          entity_id: !input climate
                          #hvac_mode: 'heat'
                          temperature: "{{ current_setpoint -1 }}"

              ##### Page Climatesettings - increasetemp #####
              - conditions: '{{ trigger.event.data.new_state.state == "releaseincreasetemp" }}'
                sequence:
                  - if:
                      - condition: template
                        value_template: '{{ states(climate) != "off" }}'
                    then:
                      - variables:
                          current_setpoint: "{{state_attr(climate, 'temperature') | round(1)}}"
                      - service: climate.set_temperature
                        data:
                          entity_id: !input climate
                          #hvac_mode: 'heat'
                          temperature: "{{ current_setpoint +1 }}"


      
                  

      ##### Left button press #####     DONE
      - conditions:
          - condition: trigger
            id: left_button_press
        sequence:
          - service: >-
              {% if left_button_entity is match 'light.' %}
              light.toggle
              {% elif left_button_entity is match 'switch.' %}
              switch.toggle
              {% elif left_button_entity is match 'cover.' %}
              cover.toggle
              {% elif left_button_entity is match 'input_boolean.' %}
              input_boolean.toggle
              {% endif %}
            data:
              entity_id: "{{ left_button_entity }}"
          - delay:
              milliseconds: "{{ delay_value }}"


      ##### Left button State #####     DONE
      - conditions:
          - condition: trigger
            id: left_button_state
        sequence:
              
          ###### Left Hardware Button PIC #####
          - variables:
              # Hardware Button PIC
              left_hardware_button_state: >-
                {%- if trigger.event.data.new_state.state == 'off' -%} {{ hardware_button_pic_off }}
                {%- elif trigger.event.data.new_state.state == 'on' -%} {{ hardware_button_pic_on }}
                {%- endif -%}

          ##### SET Right hardware Button PIC on Home Page ####
          - service: "{{ command_printf }}"
            data:
              cmd: home.left_bt_pic.pic={{ left_hardware_button_state }}


      ##### Right button press #####      DONE
      - conditions:
          - condition: trigger
            id: right_button_press
        sequence:
          - service: >-
              {% if right_button_entity is match 'light.' %}
              light.toggle
              {% elif right_button_entity is match 'switch.' %}
              switch.toggle
              {% elif right_button_entity is match 'cover.' %}
              cover.toggle
              {% elif right_button_entity is match 'input_boolean.' %}
              input_boolean.toggle
              {% endif %}
            data:
              entity_id: "{{ right_button_entity }}"


      ##### Right button State #####     DONE
      - conditions:
          - condition: trigger
            id: right_button_state
        sequence:
              
          ###### Left Hardware Button PIC #####
          - variables:
              # Hardware Button PIC
              right_hardware_button_state: >-
                {%- if trigger.event.data.new_state.state == 'off' -%} {{ hardware_button_pic_off }}
                {%- elif trigger.event.data.new_state.state == 'on' -%} {{ hardware_button_pic_on }}
                {%- endif -%}

          ##### SET Right hardware Button PIC on Home Page ####
          - service: "{{ command_printf }}"
            data:
              cmd: home.right_bt_pic.pic={{ right_hardware_button_state }}


      ##### Date and Time Home Page #####      DONE
      - conditions:
          - condition: trigger
            id: time_state
        sequence:
         ##### Time Home Page #####
          - service: "{{ command_text_printf }}"
            data:
              component: home.time
              message: "{{ time }}"
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: home.date
              message: "{{ date01_mui }}"


      ##### Humidity #####      DONE
      - conditions:
          - condition: trigger
            id: humidity_state
        sequence:
          - service: "{{ command_text_printf }}"
            data:
              component: home.humidity_state
              message: "{{ trigger.event.data.new_state.state |round(0) }}%"


      ##### Hotwater Temp #####     DONE
      - conditions:
          - condition: trigger
            id: hotwatertemp_state
        sequence:
          - service: "{{ command_text_printf }}"
            data:
              component: home.hotwater_temp
              message: "{{ trigger.event.data.new_state.state |round(1) }}°"
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: climate.hotwater_temp
              message: "{{ trigger.event.data.new_state.state |round(1) }}°"
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_printf }}"
            data:
              cmd: home.hotwater_pic.pic={{ hotwater_pic_on }}


      ##### Outdoor Temp Entity #####     DONE
      - conditions:
          - condition: trigger
            id: outdoortemp_state
        sequence:
          - service: "{{ command_text_printf }}"
            data:
              component: home.outdoor_temp
              message: "{{ trigger.event.data.new_state.state |round(0) }}°"
          - delay:
              milliseconds: "{{ delay_value }}"
          - service: "{{ command_text_printf }}"
            data:
              component: climate.outdoor_temp
              message: "{{ trigger.event.data.new_state.state |round(0) }}°"


      ##### Weather state change update #####
      - conditions:
          - condition: trigger
            id: weather_state_change
        sequence:
          - if:
              - condition: template
                value_template: '{{ outdoortemp is not match "sensor." }}'
            then:
              - service: "{{ command_text_printf }}"
                data:
                  component: home.outdoor_temp
                  message: '{{trigger.event.data.new_state.attributes.temperature | round(0)}}°'
              - service: "{{ command_text_printf }}"
                data:
                  component: climate.outdoor_temp
                  message: '{{trigger.event.data.new_state.attributes.temperature | round(0)}}°'
          
          - variables:
              weather_pic: >-
                {%- if trigger.event.data.new_state.state == 'sunny' -%} {{ weather_sunny }}
                {%- elif trigger.event.data.new_state.state == 'cloudy' -%} {{ weather_cloudy }}
                {%- elif trigger.event.data.new_state.state == 'rainy' -%} {{ weather_rainy }}
                {%- elif trigger.event.data.new_state.state == 'pouring' -%} {{ weather_pouring }}
                {%- elif trigger.event.data.new_state.state == 'snowy' -%} {{ weather_snowy }}
                {%- elif trigger.event.data.new_state.state == 'hail' -%} {{ weather_hail }}
                {%- elif trigger.event.data.new_state.state == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                {%- elif trigger.event.data.new_state.state == 'fog' -%} {{ weather_fog }}
                {%- elif trigger.event.data.new_state.state == 'windy' -%} {{ weather_windy }}
                {%- elif trigger.event.data.new_state.state == 'windy-variant' -%} {{ weather_windy-variant }}
                {%- elif trigger.event.data.new_state.state == 'lightning' -%} {{ weather_lightning }}
                {%- elif trigger.event.data.new_state.state == 'partlycloudy' and states('sun.sun') == 'above_horizon' -%} {{ weather_partlycloudy_day }}
                {%- elif trigger.event.data.new_state.state == 'partlycloudy' and states('sun.sun') == 'below_horizon' -%} {{ weather_partlycloudy_night }}
                {%- elif trigger.event.data.new_state.state == 'lightning-rainy' and states('sun.sun') == 'above_horizon' -%} {{ weather_lightning_rainy_day }}
                {%- elif trigger.event.data.new_state.state == 'lightning-rainy' and states('sun.sun') == 'below_horizon' -%} {{ weather_lightning_rainy_night }}
                {%- elif trigger.event.data.new_state.state == 'execptional' and states('sun.sun') == 'above_horizon' -%} {{ weather_execptional_day }}
                {%- elif trigger.event.data.new_state.state == 'execptional' and states('sun.sun') == 'below_horizon' -%} {{ weather_execptional_night }}
                {%- elif trigger.event.data.new_state.state == 'clear-night' -%} {{ weather_clear_night }}
                {%- endif -%}
          - service: "{{ command_printf }}"
            data:
              cmd: home.weather.pic={{ weather_pic }}

      ##### Page changed #####
      - conditions:
          - condition: trigger
            id: current_page_changed
        sequence:
          - choose:
              ## home ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_home }}'
                sequence:
                  ##### NSPanel Date #####
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: home.date
                      message: "{{ date01_mui }}"

                  ##### NSPanel Time #####
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: home.time
                      message: "{{ time }}"
                  
                  #####  NSPanel Humidity #####
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: home.humidity_state
                      message: "{{ states(humidity) |round(0) }}%"
                  
                  #####  NSPanel Hotwater #####
                  - if:
                      - condition: template
                        value_template: '{{ hotwatertemp is match "sensor." }}'
                    then:
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_printf }}"
                        data:
                          cmd: home.hotwater_pic.pic={{ hotwater_pic_on }}
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: home.hotwater_temp
                          message: "{{ states(hotwatertemp) |round(1) }}°"

                  #####  NSPanel Outdoor Temp #####
                  - variables:
                      outdoor_temp: >-
                        {%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }}
                        {%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}}
                        {%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}}
                        {%- endif -%}
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: home.outdoor_temp
                      message: "{{ outdoor_temp }}°"

                  ##### Weather Icon Home Page
                  - variables:
                      weather_pic: >-
                        {%- if states(weather_entity) == 'sunny' -%} {{ weather_sunny }}
                        {%- elif states(weather_entity) == 'cloudy' -%} {{ weather_cloudy }}
                        {%- elif states(weather_entity) == 'rainy' -%} {{ weather_rainy }}
                        {%- elif states(weather_entity) == 'pouring' -%} {{ weather_pouring }}
                        {%- elif states(weather_entity) == 'snowy' -%} {{ weather_snowy }}
                        {%- elif states(weather_entity) == 'hail' -%} {{ weather_hail }}
                        {%- elif states(weather_entity) == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                        {%- elif states(weather_entity) == 'fog' -%} {{ weather_fog }}
                        {%- elif states(weather_entity) == 'windy' -%} {{ weather_windy }}
                        {%- elif states(weather_entity) == 'windy-variant' -%} {{ weather_windy-variant }}
                        {%- elif states(weather_entity) == 'lightning' -%} {{ weather_lightning }}
                        {%- elif states(weather_entity) == 'partlycloudy' and states('sun.sun') == 'above_horizon' -%} {{ weather_partlycloudy_day }}
                        {%- elif states(weather_entity) == 'partlycloudy' and states('sun.sun') == 'below_horizon' -%} {{ weather_partlycloudy_night }}
                        {%- elif states(weather_entity) == 'lightning-rainy' and states('sun.sun') == 'above_horizon' -%} {{ weather_lightning_rainy_day }}
                        {%- elif states(weather_entity) == 'lightning-rainy' and states('sun.sun') == 'below_horizon' -%} {{ weather_lightning_rainy_night }}
                        {%- elif states(weather_entity) == 'execptional' and states('sun.sun') == 'above_horizon' -%} {{ weather_execptional_day }}
                        {%- elif states(weather_entity) == 'execptional' and states('sun.sun') == 'below_horizon' -%} {{ weather_execptional_night }}
                        {%- elif states(weather_entity) == 'clear-night' -%} {{ weather_clear_night }}
                        {%- endif -%}

                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_printf }}"
                    data:
                      cmd: home.weather.pic={{ weather_pic }}
                  
                  #####  NSPanel Left Button Name #####
                  - if:
                      - condition: template
                        value_template: '{{ left_button_name |length > 0 }}'          
                    then:
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: home.left_bt_text
                          message: "{{ left_button_name }}"

                  ##### SET Left Hardware Button PIC on Home Page ####
                  - variables:
                      # Hardware Button PIC
                      left_hardware_button_state: >-
                        {%- if states(left_button_entity) == 'off' -%} {{ hardware_button_pic_off }}
                        {%- elif states(left_button_entity) == 'on' -%} {{ hardware_button_pic_on }}
                        {%- endif -%}
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_printf }}"
                    data:
                      cmd: home.left_bt_pic.pic={{ left_hardware_button_state }}

                  #####  NSPanel Right Button Name #####
                  - if:
                      - condition: template
                        value_template: '{{ right_button_name |length > 0 }}'         
                    then:
                      - delay:
                          milliseconds: "{{ delay_value }}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: home.right_bt_text
                          message: "{{ right_button_name }}"

                  ###### SET Right Hardware Button PIC on Home Page #####
                  - variables:
                      # Hardware Button PIC
                      right_hardware_button_state: >-
                        {%- if states(right_button_entity) == 'off' -%} {{ hardware_button_pic_off }}
                        {%- elif states(right_button_entity) == 'on' -%} {{ hardware_button_pic_on }}
                        {%- endif -%}
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_printf }}"
                    data:
                      cmd: home.right_bt_pic.pic={{ right_hardware_button_state }} 

              ## weather01 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_weather01 }}'
                sequence:
                  - choose:
                    - conditions: '{{ weather == "Default" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if states(ha_weather) == 'sunny' -%} {{ weather_sunny }}
                              {%- elif states(ha_weather) == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif states(ha_weather) == 'rainy' -%} {{ weather_rainy }}
                              {%- elif states(ha_weather) == 'pouring' -%} {{ weather_pouring }}
                              {%- elif states(ha_weather) == 'snowy' -%} {{ weather_snowy }}
                              {%- elif states(ha_weather) == 'hail' -%} {{ weather_hail }}
                              {%- elif states(ha_weather) == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif states(ha_weather) == 'fog' -%} {{ weather_fog }}
                              {%- elif states(ha_weather) == 'windy' -%} {{ weather_windy }}
                              {%- elif states(ha_weather) == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif states(ha_weather) == 'lightning' -%} {{ weather_lightning }}
                              {%- elif states(ha_weather) == 'partlycloudy' and states('sun.sun') == 'above_horizon' -%} {{ weather_partlycloudy_day }}
                              {%- elif states(ha_weather) == 'partlycloudy' and states('sun.sun') == 'below_horizon' -%} {{ weather_partlycloudy_night }}
                              {%- elif states(ha_weather) == 'lightning-rainy' and states('sun.sun') == 'above_horizon' -%} {{ weather_lightning_rainy_day }}
                              {%- elif states(ha_weather) == 'lightning-rainy' and states('sun.sun') == 'below_horizon' -%} {{ weather_lightning_rainy_night }}
                              {%- elif states(ha_weather) == 'execptional' and states('sun.sun') == 'above_horizon' -%} {{ weather_execptional_day }}
                              {%- elif states(ha_weather) == 'execptional' and states('sun.sun') == 'below_horizon' -%} {{ weather_execptional_night }}
                              {%- elif states(ha_weather) == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.temp_max ### Temperature MAX ###
                            message: '{{state_attr(ha_weather,"temperature") | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.day
                            message: "{{ day01_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.date
                            message: "{{ date01_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####

                        ##### field 2 #####

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.value03
                            message: '{{state_attr(ha_weather,"wind_speed") | round(0)}} km/h'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.value03_pic.pic={{ weather_icon_wind }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####

                        ##### field 5 #####
                    
                    - conditions: '{{ weather == "AccuWeather" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(accuweather_value,"forecast")[0].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[0].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.temp_min ### Temperature MIN ###
                            message: '{{states(accuweather_realfeel_temperature_min_0d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.temp_max ### Temperature MAX ###
                            message: '{{states(accuweather_realfeel_temperature_max_0d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.day
                            message: "{{ day01_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.date
                            message: "{{ date01_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.value01
                            message: "{{ state_attr(accuweather_value,'forecast')[0].precipitation_probability}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.value01_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.value02
                            message: "{{states(accuweather_hours_of_sun_0d) | round(0)}} h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.value02_pic.pic={{ weather_icon_sun }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.value03
                            message: "{{state_attr(accuweather_uv_index_0d, 'level')}} {{states(accuweather_uv_index_0d) | round(0)}}"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.value03_pic.pic={{ weather_icon_protect }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.value04
                            message: "{{states(accuweather_thunderstorm_probability_day_0d) | round(0)}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.value04_pic.pic={{ weather_icon_lightning }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 5 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather01.value05
                            message: "{{states(accuweather_wind_day_0d) | round(0)}} km/h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather01.value05_pic.pic={{ weather_icon_wind }}

                    default:
                      - service: "{{ command_printf }}"
                        data:
                          cmd: "page {{ page_home }}"

              ## weather02 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_weather02 }}'
                sequence:
                  - choose:
                    - conditions: '{{ weather == "Default" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(ha_weather,"forecast")[0].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(ha_weather,"forecast")[0].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.temp_min ### Temperature MIN ###
                            message: '{{state_attr(ha_weather,"forecast")[0].templow | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.temp_max ### Temperature MAX ###
                            message: '{{state_attr(ha_weather,"forecast")[0].temperature | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.day
                            message: "{{ day02_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.date
                            message: "{{ date02_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value02
                            message: '{{state_attr(ha_weather,"forecast")[0].precipitation| round(1)}} mm'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value02_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value03
                            message: '{{state_attr(ha_weather,"forecast")[0].wind_speed | round(1)}} km/h'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value03_pic.pic={{ weather_icon_wind }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####

                        ##### field 5 #####
                    
                    - conditions: '{{ weather == "AccuWeather" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(accuweather_value,"forecast")[1].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[1].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.temp_min ### Temperature MIN ###
                            message: '{{states(accuweather_realfeel_temperature_min_1d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.temp_max ### Temperature MAX ###
                            message: '{{states(accuweather_realfeel_temperature_max_1d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.day
                            message: "{{ day02_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.date
                            message: "{{ date02_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value01
                            message: "{{ state_attr(accuweather_value,'forecast')[1].precipitation_probability}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value01_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value02
                            message: "{{states(accuweather_hours_of_sun_1d) | round(0)}} h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value02_pic.pic={{ weather_icon_sun }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value03
                            message: "{{state_attr(accuweather_uv_index_1d, 'level')}} {{states(accuweather_uv_index_1d) | round(0)}}"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value03_pic.pic={{ weather_icon_protect }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value04
                            message: "{{states(accuweather_thunderstorm_probability_day_1d) | round(0)}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value04_pic.pic={{ weather_icon_lightning }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 5 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather02.value05
                            message: "{{states(accuweather_wind_day_1d) | round(0)}} km/h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather02.value05_pic.pic={{ weather_icon_wind }}

                    default:
                      - service: "{{ command_printf }}"
                        data:
                          cmd: "page {{ page_home }}"

              ## weather03 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_weather03 }}'
                sequence:
                  - choose:
                    - conditions: '{{ weather == "Default" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(ha_weather,"forecast")[1].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(ha_weather,"forecast")[1].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.temp_min ### Temperature MIN ###
                            message: '{{state_attr(ha_weather,"forecast")[1].templow | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.temp_max ### Temperature MAX ###
                            message: '{{state_attr(ha_weather,"forecast")[1].temperature | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.day
                            message: "{{ day03_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.date
                            message: "{{ date03_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value02
                            message: '{{state_attr(ha_weather,"forecast")[1].precipitation| round(1)}} mm'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value02_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value03
                            message: '{{state_attr(ha_weather,"forecast")[1].wind_speed | round(1)}} km/h'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value03_pic.pic={{ weather_icon_wind }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####

                        ##### field 5 #####
                    
                    - conditions: '{{ weather == "AccuWeather" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(accuweather_value,"forecast")[2].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[2].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.temp_min ### Temperature MIN ###
                            message: '{{states(accuweather_realfeel_temperature_min_2d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.temp_max ### Temperature MAX ###
                            message: '{{states(accuweather_realfeel_temperature_max_2d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.day
                            message: "{{ day03_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.date
                            message: "{{ date03_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value01
                            message: "{{ state_attr(accuweather_value,'forecast')[2].precipitation_probability}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value01_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value02
                            message: "{{states(accuweather_hours_of_sun_2d) | round(0)}} h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value02_pic.pic={{ weather_icon_sun }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value03
                            message: "{{state_attr(accuweather_uv_index_2d, 'level')}} {{states(accuweather_uv_index_2d) | round(0)}}"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value03_pic.pic={{ weather_icon_protect }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value04
                            message: "{{states(accuweather_thunderstorm_probability_day_2d) | round(0)}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value04_pic.pic={{ weather_icon_lightning }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 5 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather03.value05
                            message: "{{states(accuweather_wind_day_2d) | round(0)}} km/h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather03.value05_pic.pic={{ weather_icon_wind }}

                    default:
                      - service: "{{ command_printf }}"
                        data:
                          cmd: "page {{ page_home }}"

              ## weather04 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_weather04 }}'
                sequence:
                  - choose:
                    - conditions: '{{ weather == "Default" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(ha_weather,"forecast")[2].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(ha_weather,"forecast")[2].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.temp_min ### Temperature MIN ###
                            message: '{{state_attr(ha_weather,"forecast")[2].templow | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.temp_max ### Temperature MAX ###
                            message: '{{state_attr(ha_weather,"forecast")[2].temperature | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.day
                            message: "{{ day04_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.date
                            message: "{{ date04_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value02
                            message: '{{state_attr(ha_weather,"forecast")[2].precipitation| round(1)}} mm'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value02_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value03
                            message: '{{state_attr(ha_weather,"forecast")[2].wind_speed | round(1)}} km/h'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value03_pic.pic={{ weather_icon_wind }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####

                        ##### field 5 #####
                    
                    - conditions: '{{ weather == "AccuWeather" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(accuweather_value,"forecast")[3].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[3].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.temp_min ### Temperature MIN ###
                            message: '{{states(accuweather_realfeel_temperature_min_3d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.temp_max ### Temperature MAX ###
                            message: '{{states(accuweather_realfeel_temperature_max_3d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.day
                            message: "{{ day04_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.date
                            message: "{{ date04_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value01
                            message: "{{ state_attr(accuweather_value,'forecast')[3].precipitation_probability}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value01_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value02
                            message: "{{states(accuweather_hours_of_sun_3d) | round(0)}} h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value02_pic.pic={{ weather_icon_sun }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value03
                            message: "{{state_attr(accuweather_uv_index_3d, 'level')}} {{states(accuweather_uv_index_3d) | round(0)}}"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value03_pic.pic={{ weather_icon_protect }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value04
                            message: "{{states(accuweather_thunderstorm_probability_day_3d) | round(0)}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value04_pic.pic={{ weather_icon_lightning }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 5 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather04.value05
                            message: "{{states(accuweather_wind_day_3d) | round(0)}} km/h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather04.value05_pic.pic={{ weather_icon_wind }}

                    default:
                      - service: "{{ command_printf }}"
                        data:
                          cmd: "page {{ page_home }}"

              ## weather05 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_weather05 }}'
                sequence:
                  - choose:
                    - conditions: '{{ weather == "Default" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(ha_weather,"forecast")[3].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(ha_weather,"forecast")[3].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.temp_min ### Temperature MIN ###
                            message: '{{state_attr(ha_weather,"forecast")[3].templow | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.temp_max ### Temperature MAX ###
                            message: '{{state_attr(ha_weather,"forecast")[3].temperature | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.day
                            message: "{{ day05_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.date
                            message: "{{ date05_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value02
                            message: '{{state_attr(ha_weather,"forecast")[3].precipitation| round(1)}} mm'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value02_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value03
                            message: '{{state_attr(ha_weather,"forecast")[3].wind_speed | round(1)}} km/h'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value03_pic.pic={{ weather_icon_wind }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####

                        ##### field 5 #####
                    
                    - conditions: '{{ weather == "AccuWeather" }}'
                      sequence:
                        - variables:
                            # weather PIC
                            weather_icon: >-
                              {%- if state_attr(accuweather_value,"forecast")[4].condition == 'sunny' -%} {{ weather_sunny }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'cloudy' -%} {{ weather_cloudy }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'rainy' -%} {{ weather_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'pouring' -%} {{ weather_pouring }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'snowy' -%} {{ weather_snowy }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'hail' -%} {{ weather_hail }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'snowy-rainy' -%} {{ weather_snowy_rainy }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'fog' -%} {{ weather_fog }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'windy' -%} {{ weather_windy }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'windy-variant' -%} {{ weather_windy-variant }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'lightning' -%} {{ weather_lightning }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'partlycloudy' -%} {{ weather_partlycloudy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'lightning-rainy' -%} {{ weather_lightning_rainy_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'execptional' -%} {{ weather_execptional_day }}
                              {%- elif state_attr(accuweather_value,"forecast")[4].condition == 'clear-night' -%} {{ weather_clear_night }}
                              {%- endif -%}

                        ##### SET weather PIC on Home Page ####
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.weather_icon.pic={{ weather_icon }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MIN ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.temp_min ### Temperature MIN ###
                            message: '{{states(accuweather_realfeel_temperature_min_4d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        
                        ##### Slash #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.slash
                            message: '/'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### SET TEMP MAX ####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.temp_max ### Temperature MAX ###
                            message: '{{states(accuweather_realfeel_temperature_max_4d) | round(0)}}°'
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Name #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.day
                            message: "{{ day05_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### Day Date #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.date
                            message: "{{ date05_mui }}"
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 1 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value01
                            message: "{{ state_attr(accuweather_value,'forecast')[4].precipitation_probability}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value01_pic.pic={{ weather_icon_rain }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 2 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value02
                            message: "{{states(accuweather_hours_of_sun_4d) | round(0)}} h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value02_pic.pic={{ weather_icon_sun }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 3 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value03
                            message: "{{state_attr(accuweather_uv_index_4d, 'level')}} {{states(accuweather_uv_index_4d) | round(0)}}"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value03_pic.pic={{ weather_icon_protect }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 4 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value04
                            message: "{{states(accuweather_thunderstorm_probability_day_4d) | round(0)}} %"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value04_pic.pic={{ weather_icon_lightning }}
                        - delay:
                            milliseconds: "{{ delay_value }}"

                        ##### field 5 #####
                        - service: "{{ command_text_printf }}"
                          data:
                            component: weather05.value05
                            message: "{{states(accuweather_wind_day_4d) | round(0)}} km/h"
                        - delay:
                            milliseconds: "{{ delay_value }}"
                        - service: "{{ command_printf }}"
                          data:
                            cmd: weather05.value05_pic.pic={{ weather_icon_wind }}

                    default:
                      - service: "{{ command_printf }}"
                        data:
                          cmd: "page {{ page_home }}"

              ## climate ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_climate }}'
                alias: 'climate page'
                sequence:
                  - variables:
                      # target_temp: "{{state_attr(climate, 'temperature') | round(1)}}"
                      hvac_mode: "{{ states(climate) }}"
                      outdoor_temp: >-
                        {%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }}
                        {%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}}
                        {%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}}
                        {%- endif -%}
                      heating_state: >-
                        {%- if hvac_mode == "off" -%} {{ off_mui }}
                        {%- elif hvac_mode != "off" -%} {{ heat_mui }}
                        {%- endif -%}

                  - service: "{{ command_text_printf }}"
                    data:
                      component: outdoor_temp
                      message: "{{ outdoor_temp }}°"
                  - service: "{{ command_text_printf }}"
                    data:
                      component: current_temp
                      message: "{{state_attr(climate, 'current_temperature') | round(1)}}°"
                  - if:
                      condition: template
                      value_template: '{{ hvac_mode != "off" }}'
                    then:
                      - variables:
                          target_temp: "{{state_attr(climate, 'temperature') | round(1)}}"
                      - service: "{{ command_text_printf }}"
                        data:
                          component: target_temp
                          message: "{{target_temp}}°"
                      - service: "{{ command_thermostat_cycle }}"
                        data:
                          value: "{{target_temp}}"
                    else:
                      - service: "{{ command_text_printf }}"
                        data:
                          component: target_temp
                          message: " "
                      - service: "{{ command_thermostat_cycle }}"
                        data:
                          value: "0"

                  - service: "{{ command_text_printf }}"
                    data:
                      component: heating_state
                      message: "{{heating_state}}"

                  # HVAC Button PIC
                  - variables:
                      heating_bt_pic: >-
                        {%- if hvac_mode == "off" -%} {{ heating_bt_pic_off }}
                        {%- else -%} {{ heating_bt_pic_on }}
                        {%- endif -%}
                  - delay:
                      milliseconds: "{{ delay_value }}"
                  - service: "{{ command_printf }}"
                    data:
                      cmd: heating_bt_pic.pic={{ heating_bt_pic }}
                  - variables:
                      hotw_bt_pic: >-
                        {%- if hotwatercharge | length > 0 and states(hotwatercharge) == 'on' -%} {{ hotw_bt_on }}
                        {%- elif hotwatercharge | length > 0 and states(hotwatercharge) == 'off' -%} {{ hotw_bt_off }}
                        {%- else -%} {{ hotw_bt_blank }}
                        {%- endif -%}
                  - service: "{{ command_printf }}"
                    data:
                      cmd: hotw_bt_pic.pic={{ hotw_bt_pic }}
                        
                  - if:
                      - condition: template
                        value_template: '{{ hotwatertemp is match "sensor." }}'
                    then:
                      - service: "{{ command_text_printf }}"
                        data:
                          component: climate.hotwater_temp
                          message: "{{ states(hotwatertemp) |round(1) }}°"

              ## settings ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_settings }}'
                sequence:

              ## boot ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_boot }}'
                sequence:

              ## screensaver ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_screensaver }}'
                sequence:

              ## lightsettings ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_lightsettings }}'
                sequence:

              ## coversettings ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_coversettings }}'
                sequence:

              ## buttonpage01 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage01 }}'
                sequence:

              ## buttonpage02 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage01 }}'
                sequence:

              ## buttonpage03 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage03 }}'
                sequence:

              ## buttonpage04 ## 
              - conditions: '{{ trigger.event.data.new_state.state == page_buttonpage04 }}'
                sequence:
              

      ##### Open Climate Settings #####
      - conditions:
          - condition: trigger
            id: open_climate_settings
        sequence:
          - if:
              - condition: template
                value_template: '{{ climate |length > 0 }}'         
            then:
              - service: "{{ command_printf }}"
                data:
                  cmd: "page {{ page_climate }}"


      ##### Set Flame-Symbol #####
      - conditions:
          - condition: trigger
            id: heatingsystemflame_state
        sequence:
          - variables:
              flame_pic: >-
                {%- if trigger.event.data.new_state.state == 'on' -%} {{ flame_pic_on }}
                {%- else -%} {{ flame_pic_off }}
                {%- endif -%}
          - service: "{{ command_printf }}"
            data:
              cmd: home.icon_top_01.pic={{ flame_pic }}

      
      ##### Sync Hotwater Charge button-symbol #####
      - conditions:
          - condition: trigger
            id: hotwatercharge_state
          - condition: template
            value_template: '{{ states(current_page) == page_climate }}'
        sequence:
          - variables:
              hotw_bt_pic: >-
                {%- if trigger.event.data.new_state.state == 'on' -%} {{ hotw_bt_on }}
                {%- elif trigger.event.data.new_state.state == 'off' -%} {{ hotw_bt_off }}
                {%- else -%} {{ hotw_bt_blank }}
                {%- endif -%}
          - service: "{{ command_printf }}"
            data:
              cmd: hotw_bt_pic.pic={{ hotw_bt_pic }}

      ##### Sync Climate #####
      - conditions:
          - condition: trigger
            id: climate_state
          - condition: template
            value_template: '{{ states(current_page) == page_climate }}'
        sequence:
          - variables:
              heating_state: >-
                {%- if trigger.event.data.new_state.state == "off" -%} {{ off_mui }}
                {%- elif trigger.event.data.new_state.state != "off" -%} {{ heat_mui }}
                {%- endif -%}
              heating_bt_pic: >-
                {%- if trigger.event.data.new_state.state == "off" -%} {{ heating_bt_pic_off }}
                {%- else -%} {{ heating_bt_pic_on }}
                {%- endif -%}
          - service: "{{ command_text_printf }}"
            data:
              component: current_temp
              message: "{{ trigger.event.data.new_state.attributes.current_temperature | round(1)}}°"
          - service: "{{ command_text_printf }}"
            data:
              component: heating_state
              message: "{{heating_state}}"
          - service: "{{ command_printf }}"
            data:
              cmd: heating_bt_pic.pic={{ heating_bt_pic }}
          - if:
            - condition: template
              value_template: '{{ trigger.event.data.new_state.state != "off" }}'
            then:
              - service: "{{ command_text_printf }}"
                data:
                  component: target_temp
                  message: "{{trigger.event.data.new_state.attributes.temperature | round(1)}}°"
              - service: "{{ command_thermostat_cycle }}"
                data:
                  value: "{{trigger.event.data.new_state.attributes.temperature | round(1)}}"
            else:
              - service: "{{ command_text_printf }}"
                data:
                  component: target_temp
                  message: " "
              - service: "{{ command_thermostat_cycle }}"
                data:
                  value: "0" 
          


            


#############################################################
##### CLOSE - Action #####
#############################################################