diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index a1873da..076778e 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -2325,70 +2325,75 @@ trace: ############################################################# trigger_variables: - nspanel_name_temp: !input "nspanel_name" - nspanel_entities: "{{ device_entities(nspanel_name_temp) }}" + nspanel_name_temp: !input 'nspanel_name' + nspanel_entities: '{{ device_entities(nspanel_name_temp) }}' nspanel_name: > - {% if nspanel_entities | count > 0 %}{{ (nspanel_entities | selectattr(None, 'search', '_nextion_inited') | list | first).split('.')[1].split('_nextion_inited')[0] }} - {% elif nspanel_name_temp is string %}{{ nspanel_name_temp | replace('-','_') | replace(' ','_') | replace('___','_') | replace('__','_') }} + {% if nspanel_entities | count > 0 %}{{ (nspanel_entities | selectattr(None, "search", "_nextion_inited") | list | first).split(".")[1].split("_nextion_inited")[0] }} + {% elif nspanel_name_temp is string %}{{ nspanel_name_temp | replace("-","_") | replace(" ","_") | replace("___","_") | replace("__","_") }} {% endif %} - left_button: "binary_sensor.{{ nspanel_name }}_left_button" - right_button: "binary_sensor.{{ nspanel_name }}_right_button" - nextion_inited: "switch.{{ nspanel_name }}_nextion_inited" - nspanelevent: "sensor.{{ nspanel_name }}_nspanel_event" - hotwatercharge: !input "hotwatercharge" - display_target_temperature: "sensor.{{ nspanel_name }}_display_target_temperature" - relay01_entity: "switch.{{ nspanel_name }}_relay_1" - relay02_entity: "switch.{{ nspanel_name }}_relay_2" - nspaneltemp: "sensor.{{ nspanel_name }}_temperature" - settings_entity: "sensor.{{ nspanel_name }}_settings_entity" - reboot_button: "button.{{ nspanel_name }}_restart" + left_button: 'binary_sensor.{{ nspanel_name }}_left_button' + right_button: 'binary_sensor.{{ nspanel_name }}_right_button' + nextion_inited: 'switch.{{ nspanel_name }}_nextion_inited' + nspanelevent: 'sensor.{{ nspanel_name }}_nspanel_event' + hotwatercharge: !input 'hotwatercharge' + display_target_temperature: 'sensor.{{ nspanel_name }}_display_target_temperature' + relay01_entity: 'switch.{{ nspanel_name }}_relay_1' + relay02_entity: 'switch.{{ nspanel_name }}_relay_2' + nspaneltemp: 'sensor.{{ nspanel_name }}_temperature' + settings_entity: 'sensor.{{ nspanel_name }}_settings_entity' + reboot_button: 'button.{{ nspanel_name }}_restart' ##### notification Trigger ##### - notification_unread: "switch.{{ nspanel_name }}_notification_unread" - notification_text: "sensor.{{ nspanel_name }}_notification_text" - notification_label: "sensor.{{ nspanel_name }}_notification_label" + notification_unread: 'switch.{{ nspanel_name }}_notification_unread' + notification_text: 'sensor.{{ nspanel_name }}_notification_text' + notification_label: 'sensor.{{ nspanel_name }}_notification_label' variables: ##### GENERAL ##### - blueprint_version: "3.3" - language: !input "language" - date_format: !input "date_format" - time_format: !input "time_format" - time: "{{ as_timestamp(now()) | timestamp_custom(time_format) }}" - meridiem: "{{ as_timestamp(now()) | timestamp_custom('%p') if time_format == '%-I:%M' }}" - sun_is_up: "{{ is_state('sun.sun', 'above_horizon') }}" + blueprint_version: '3.3' + language: !input 'language' + date_format: !input 'date_format' + time_format: !input 'time_format' + time: '{{ as_timestamp(now()) | timestamp_custom(time_format) }}' + meridiem: '{{ as_timestamp(now()) | timestamp_custom("%p") if time_format == "%-I:%M" }}' + sun_is_up: '{{ is_state("sun.sun", "above_horizon") }}' - notification_sound: "switch.{{ nspanel_name }}_notification_sound" - confirmation_message: "switch.{{ nspanel_name }}_confirmation_message" + notification_sound: 'switch.{{ nspanel_name }}_notification_sound' + confirmation_message: 'switch.{{ nspanel_name }}_confirmation_message' - nspanel_event: '{{ states(nspanelevent) if nspanelevent is string and states(nspanelevent) not in ["unavailable", "unknown", None] else { "page": "unknown", "component": "unknown", "value": "unknown" } }}' + nspanel_event: > + {{ + states(nspanelevent) + if nspanelevent is string and states(nspanelevent) not in ["unavailable", "unknown", None] + else { "page": "unknown", "component": "unknown", "value": "unknown" } + }} ##### Nextion dict #### nextion: colors: - blue: "1055" # rgb(0, 128, 248) - grey_dark: "10597" # rgb(40, 44, 40) - grey_light: "33808" # rgb(128, 128, 128) - grey_super_light: "52857" # rgb(200, 204, 200) - red: "63488" # rgb(248, 0, 0) - white: "65535" # rgb(255, 255, 255) - yellow: "65472" # rgb(248, 248, 0) + blue: '1055' # rgb(0, 128, 248) + grey_dark: '10597' # rgb(40, 44, 40) + grey_light: '33808' # rgb(128, 128, 128) + grey_super_light: '52857' # rgb(200, 204, 200) + red: '63488' # rgb(248, 0, 0) + white: '65535' # rgb(255, 255, 255) + yellow: '65472' # rgb(248, 248, 0) commands: - text_printf: "esphome.{{ nspanel_name }}_send_command_text_printf" - value: "esphome.{{ nspanel_name }}_send_command_value" - printf: "esphome.{{ nspanel_name }}_send_command_printf" - font_color: "esphome.{{ nspanel_name }}_send_command_font_color" - background_color: "esphome.{{ nspanel_name }}_send_command_background_color" - thermostat_cycle: "esphome.{{ nspanel_name }}_send_thermostat_cycle_state" - notification_show: "esphome.{{ nspanel_name }}_notification_show" - notification_clear: "esphome.{{ nspanel_name }}_notification_clear" - play_rtttl: "esphome.{{ nspanel_name }}_play_rtttl" - set_settings_entity: "esphome.{{ nspanel_name }}_set_settings_entity" - show_all: "esphome.{{ nspanel_name }}_send_command_show_all" - tft_upload: "esphome.{{ nspanel_name }}_upload_tft" - set_button: "esphome.{{ nspanel_name }}_set_button" - set_entity: "esphome.{{ nspanel_name }}_set_entity" + text_printf: 'esphome.{{ nspanel_name }}_send_command_text_printf' + value: 'esphome.{{ nspanel_name }}_send_command_value' + printf: 'esphome.{{ nspanel_name }}_send_command_printf' + font_color: 'esphome.{{ nspanel_name }}_send_command_font_color' + background_color: 'esphome.{{ nspanel_name }}_send_command_background_color' + thermostat_cycle: 'esphome.{{ nspanel_name }}_send_thermostat_cycle_state' + notification_show: 'esphome.{{ nspanel_name }}_notification_show' + notification_clear: 'esphome.{{ nspanel_name }}_notification_clear' + play_rtttl: 'esphome.{{ nspanel_name }}_play_rtttl' + set_settings_entity: 'esphome.{{ nspanel_name }}_set_settings_entity' + show_all: 'esphome.{{ nspanel_name }}_send_command_show_all' + tft_upload: 'esphome.{{ nspanel_name }}_upload_tft' + set_button: 'esphome.{{ nspanel_name }}_set_button' + set_entity: 'esphome.{{ nspanel_name }}_set_entity' icons: battery: "\U0000F2A1" #F2A1 blank: "\U0000FFFF" #blank macbook bug @@ -2446,22 +2451,22 @@ variables: hvac: button: blank: "79" - 'off': "80" - 'on': "81" + "off": "80" + "on": "81" unknown: "79" hardware: button: "off": "77" "on": "78" button: - 'off': "101" - 'on': "102" + "off": "101" + "on": "102" heating: button: "off": "82" "on": "83" weather: - sunny: "{{ '2' if sun_is_up else '15'}}" #some weather providers returns 'sunny' for 'clear-night' + sunny: '{{ "2" if sun_is_up else "15"}}' #some weather providers returns "sunny" for "clear-night" cloudy: "3" rainy: "4" pouring: "5" @@ -2473,13 +2478,13 @@ variables: windy_variant: "9" windy-variant: "9" lightning: "10" - partlycloudy: "{{ '11' if sun_is_up else '12'}}" - lightning_rainy: "{{ '13' if sun_is_up else '14'}}" - execptional: "{{ '13' if sun_is_up else '14'}}" + partlycloudy: '{{ "11" if sun_is_up else "12"}}' + lightning_rainy: '{{ "13" if sun_is_up else "14"}}' + execptional: '{{ "13" if sun_is_up else "14"}}' clear_night: "15" clear-night: "15" - unknown: '' - unavailable: '' + unknown: "" + unavailable: "" ##### MUI Multilingual User Interface ##### mui: @@ -3129,94 +3134,94 @@ variables: no_name: No name ##### WEATHER #### - weather_entity_tmp: !input "weather_entity" # used only during the creation of weather in variables + weather_entity_tmp: !input 'weather_entity' # used only during the creation of weather in variables weather_entity: > {% if weather_entity_tmp is string and weather_entity_tmp | length > 0 %} {{ weather_entity_tmp }} - {% elif states.weather | list | count > 0 %} {{ states.weather | map(attribute='entity_id') | list | first }} + {% elif states.weather | list | count > 0 %} {{ states.weather | map(attribute="entity_id") | list | first }} {% endif %} - temperature_units: '°' + temperature_units: "°" ##### Home page ##### page_home: buttons: ### Feature Buttons ### - - icon: '' # NOT IN USE + - icon: "" # NOT IN USE color_rgb: - 'on': '' # NOT IN USE - 'off': '' # NOT IN USE - - icon: '' # NOT IN USE + "on": "" # NOT IN USE + "off": "" # NOT IN USE + - icon: "" # NOT IN USE color_rgb: - 'on': '' # NOT IN USE - 'off': '' # NOT IN USE - - icon: '' # NOT IN USE + "on": "" # NOT IN USE + "off": "" # NOT IN USE + - icon: "" # NOT IN USE color_rgb: - 'on': '' # NOT IN USE - 'off': '' # NOT IN USE - - icon: !input "home_button04_icon" #E1ED + "on": "" # NOT IN USE + "off": "" # NOT IN USE + - icon: !input 'home_button04_icon' #E1ED color_rgb: - 'on': !input "home_button04_icon_color01" - 'off': !input "home_button04_icon_color02" - - icon: !input "home_button05_icon" #E432 + "on": !input 'home_button04_icon_color01' + "off": !input 'home_button04_icon_color02' + - icon: !input 'home_button05_icon' #E432 color_rgb: - 'on': !input "home_button05_icon_color" - 'off': '' # NOT IN USE - - icon: !input "home_button06_icon" #EDCF + "on": !input 'home_button05_icon_color' + "off": "" # NOT IN USE + - icon: !input 'home_button06_icon' #EDCF color_rgb: - 'on': !input "home_button06_icon_color" - 'off': '' # NOT IN USE - - icon: '' # NOT IN USE + "on": !input 'home_button06_icon_color' + "off": "" # NOT IN USE + - icon: "" # NOT IN USE color_rgb: - 'on': '' # NOT IN USE - 'off': '' # NOT IN USE + "on": "" # NOT IN USE + "off": "" # NOT IN USE general: outdoor_temp: label: - color_rgb: !input "home_outdoor_temp_label_color" + color_rgb: !input 'home_outdoor_temp_label_color' indoor_temp: icon: - icon: !input "home_indoor_temp_icon" #E50E - color_rgb: !input "home_indoor_temp_icon_color" + icon: !input 'home_indoor_temp_icon' #E50E + color_rgb: !input 'home_indoor_temp_icon_color' label: - color_rgb: !input "home_indoor_temp_label_color" + color_rgb: !input 'home_indoor_temp_label_color' time: label: - color_rgb: !input "time_label_color" + color_rgb: !input 'time_label_color' date: label: - color_rgb: !input "date_label_color" + color_rgb: !input 'date_label_color' hardware: buttons: #### HARDWARE BUTTONS ##### left: - entity: !input "left_button_entity" - name: !input "left_button_name" - color_rgb: !input "left_button_color" - hold_select: !input "left_button_hold_select" - #custom_action: !input "left_button_hold_custom_action" + entity: !input 'left_button_entity' + name: !input 'left_button_name' + color_rgb: !input 'left_button_color' + hold_select: !input 'left_button_hold_select' + #custom_action: !input 'left_button_hold_custom_action' right: - entity: !input "right_button_entity" - name: !input "right_button_name" - color_rgb: !input "right_button_color" - hold_select: !input "right_button_hold_select" - #custom_action: !input "right_button_hold_custom_action" - qrcode_enabled: !input "qrcode_enabled" + entity: !input 'right_button_entity' + name: !input 'right_button_name' + color_rgb: !input 'right_button_color' + hold_select: !input 'right_button_hold_select' + #custom_action: !input 'right_button_hold_custom_action' + qrcode_enabled: !input 'qrcode_enabled' ###### SYNC SETTINGS ##### - #delay_boot: !input "delay" # NOT IN USE - delay_value: !input "delay" - #delay_jump_page: !input "delay" # NOT IN USE - #sync_slider_ha: !input "sync_slider_ha" # NOT IN USE - #sync_value_ha: !input "sync_value_ha" # NOT IN USE - climate_optimistic: !input "climate_optimistic" + #delay_boot: !input 'delay' # NOT IN USE + delay_value: !input 'delay' + #delay_jump_page: !input 'delay' # NOT IN USE + #sync_slider_ha: !input 'sync_slider_ha' # NOT IN USE + #sync_value_ha: !input 'sync_value_ha' # NOT IN USE + climate_optimistic: !input 'climate_optimistic' ##### GENERAL ENTITYS ##### - hotwatertemp: !input "hotwatertemp" - outdoortemp: !input "outdoortemp" - indoortemp: !input "indoortemp" - climate: !input "climate" - relay_1_local_fallback: !input "relay_1_local_fallback" - relay_2_local_fallback: !input "relay_2_local_fallback" + hotwatertemp: !input 'hotwatertemp' + outdoortemp: !input 'outdoortemp' + indoortemp: !input 'indoortemp' + climate: !input 'climate' + relay_1_local_fallback: !input 'relay_1_local_fallback' + relay_2_local_fallback: !input 'relay_2_local_fallback' ##### ENTITIES ##### - entitypages_enabled: !input "entitypages_enabled" + entitypages_enabled: !input 'entitypages_enabled' ############################################################# ##### CLOSE - Variables ##### @@ -3230,16 +3235,16 @@ variables: trigger: ##### Trigger - General ################################################################################################################# - ##### settings_entity - Trigger "settings_entity" ##### + ##### settings_entity - Trigger 'settings_entity' ##### - platform: event event_type: state_changed event_data: - entity_id: "{{ settings_entity }}" + entity_id: '{{ settings_entity }}' id: settings_entity - ##### Reboot - Trigger "nspanel_boot_init" ##### + ##### Reboot - Trigger 'nspanel_boot_init' ##### - platform: template - value_template: "{{ is_state(nextion_inited, 'on') | default(false) if nextion_inited is string else false }}" + value_template: '{{ is_state(nextion_inited, "on") | default(false) if nextion_inited is string else false }}' for: seconds: 1 id: nspanel_boot_init @@ -3248,7 +3253,7 @@ trigger: - platform: event event_type: state_changed event_data: - entity_id: "{{ nspanelevent }}" + entity_id: '{{ nspanelevent }}' id: nspanelevent_changed ##### Automation reload @@ -3257,237 +3262,237 @@ trigger: id: automation_reloaded ##### Trigger - Buttons - State change ################################################################################################################# - ##### Button01 Sync - Trigger "current_state_entity01" ##### + ##### Button01 Sync - Trigger 'current_state_entity01' ##### - platform: state - entity_id: !input "entity01" + entity_id: !input 'entity01' id: current_state_entity01 - ##### Button02 Sync - Trigger "current_state_entity02" ##### + ##### Button02 Sync - Trigger 'current_state_entity02' ##### - platform: state - entity_id: !input "entity02" + entity_id: !input 'entity02' id: current_state_entity02 - ##### Button03 Sync - Trigger "current_state_entity03" ##### + ##### Button03 Sync - Trigger 'current_state_entity03' ##### - platform: state - entity_id: !input "entity03" + entity_id: !input 'entity03' id: current_state_entity03 - ##### Button04 Sync - Trigger "current_state_entity04" ##### + ##### Button04 Sync - Trigger 'current_state_entity04' ##### - platform: state - entity_id: !input "entity04" + entity_id: !input 'entity04' id: current_state_entity04 - ##### Button05 Sync - Trigger "current_state_entity05" ##### + ##### Button05 Sync - Trigger 'current_state_entity05' ##### - platform: state - entity_id: !input "entity05" + entity_id: !input 'entity05' id: current_state_entity05 - ##### Button06 Sync - Trigger "current_state_entity06" ##### + ##### Button06 Sync - Trigger 'current_state_entity06' ##### - platform: state - entity_id: !input "entity06" + entity_id: !input 'entity06' id: current_state_entity06 - ##### Button07 Sync - Trigger "current_state_entity07" ##### + ##### Button07 Sync - Trigger 'current_state_entity07' ##### - platform: state - entity_id: !input "entity07" + entity_id: !input 'entity07' id: current_state_entity07 - ##### Button08 Sync - Trigger "current_state_entity08" ##### + ##### Button08 Sync - Trigger 'current_state_entity08' ##### - platform: state - entity_id: !input "entity08" + entity_id: !input 'entity08' id: current_state_entity08 - ##### Button09 Sync - Trigger "current_state_entity09" ##### + ##### Button09 Sync - Trigger 'current_state_entity09' ##### - platform: state - entity_id: !input "entity09" + entity_id: !input 'entity09' id: current_state_entity09 - ##### Button10 Sync - Trigger "current_state_entity10" ##### + ##### Button10 Sync - Trigger 'current_state_entity10' ##### - platform: state - entity_id: !input "entity10" + entity_id: !input 'entity10' id: current_state_entity10 - ##### Button11 Sync - Trigger "current_state_entity11" ##### + ##### Button11 Sync - Trigger 'current_state_entity11' ##### - platform: state - entity_id: !input "entity11" + entity_id: !input 'entity11' id: current_state_entity11 - ##### Button12 Sync - Trigger "current_state_entity12" ##### + ##### Button12 Sync - Trigger 'current_state_entity12' ##### - platform: state - entity_id: !input "entity12" + entity_id: !input 'entity12' id: current_state_entity12 - ##### Button13 Sync - Trigger "current_state_entity13" ##### + ##### Button13 Sync - Trigger 'current_state_entity13' ##### - platform: state - entity_id: !input "entity13" + entity_id: !input 'entity13' id: current_state_entity13 - ##### Button14 Sync - Trigger "current_state_entity14" ##### + ##### Button14 Sync - Trigger 'current_state_entity14' ##### - platform: state - entity_id: !input "entity14" + entity_id: !input 'entity14' id: current_state_entity14 - ##### Button15 Sync - Trigger "current_state_entity15" ##### + ##### Button15 Sync - Trigger 'current_state_entity15' ##### - platform: state - entity_id: !input "entity15" + entity_id: !input 'entity15' id: current_state_entity15 - ##### Button16 Sync - Trigger "current_state_entity16" ##### + ##### Button16 Sync - Trigger 'current_state_entity16' ##### - platform: state - entity_id: !input "entity16" + entity_id: !input 'entity16' id: current_state_entity16 - ##### Button17 Sync - Trigger "current_state_entity17" ##### + ##### Button17 Sync - Trigger 'current_state_entity17' ##### - platform: state - entity_id: !input "entity17" + entity_id: !input 'entity17' id: current_state_entity17 - ##### Button18 Sync - Trigger "current_state_entity18" ##### + ##### Button18 Sync - Trigger 'current_state_entity18' ##### - platform: state - entity_id: !input "entity18" + entity_id: !input 'entity18' id: current_state_entity18 - ##### Button19 Sync - Trigger "current_state_entity19" ##### + ##### Button19 Sync - Trigger 'current_state_entity19' ##### - platform: state - entity_id: !input "entity19" + entity_id: !input 'entity19' id: current_state_entity19 - ##### Button20 Sync - Trigger "current_state_entity20" ##### + ##### Button20 Sync - Trigger 'current_state_entity20' ##### - platform: state - entity_id: !input "entity20" + entity_id: !input 'entity20' id: current_state_entity20 - ##### Button21 Sync - Trigger "current_state_entity21" ##### + ##### Button21 Sync - Trigger 'current_state_entity21' ##### - platform: state - entity_id: !input "entity21" + entity_id: !input 'entity21' id: current_state_entity21 - ##### Button22 Sync - Trigger "current_state_entity22" ##### + ##### Button22 Sync - Trigger 'current_state_entity22' ##### - platform: state - entity_id: !input "entity22" + entity_id: !input 'entity22' id: current_state_entity22 - ##### Button23 Sync - Trigger "current_state_entity23" ##### + ##### Button23 Sync - Trigger 'current_state_entity23' ##### - platform: state - entity_id: !input "entity23" + entity_id: !input 'entity23' id: current_state_entity23 - ##### Button24 Sync - Trigger "current_state_entity24" ##### + ##### Button24 Sync - Trigger 'current_state_entity24' ##### - platform: state - entity_id: !input "entity24" + entity_id: !input 'entity24' id: current_state_entity24 - ##### Button25 Sync - Trigger "current_state_entity25" ##### + ##### Button25 Sync - Trigger 'current_state_entity25' ##### - platform: state - entity_id: !input "entity25" + entity_id: !input 'entity25' id: current_state_entity25 - ##### Button26 Sync - Trigger "current_state_entity26" ##### + ##### Button26 Sync - Trigger 'current_state_entity26' ##### - platform: state - entity_id: !input "entity26" + entity_id: !input 'entity26' id: current_state_entity26 - ##### Button27 Sync - Trigger "current_state_entity27" ##### + ##### Button27 Sync - Trigger 'current_state_entity27' ##### - platform: state - entity_id: !input "entity27" + entity_id: !input 'entity27' id: current_state_entity27 - ##### Button28 Sync - Trigger "current_state_entity28" ##### + ##### Button28 Sync - Trigger 'current_state_entity28' ##### - platform: state - entity_id: !input "entity28" + entity_id: !input 'entity28' id: current_state_entity28 - ##### Button29 Sync - Trigger "current_state_entity29" ##### + ##### Button29 Sync - Trigger 'current_state_entity29' ##### - platform: state - entity_id: !input "entity29" + entity_id: !input 'entity29' id: current_state_entity29 - ##### Button30 Sync - Trigger "current_state_entity30" ##### + ##### Button30 Sync - Trigger 'current_state_entity30' ##### - platform: state - entity_id: !input "entity30" + entity_id: !input 'entity30' id: current_state_entity30 - ##### Button31 Sync - Trigger "current_state_entity31" ##### + ##### Button31 Sync - Trigger 'current_state_entity31' ##### - platform: state - entity_id: !input "entity31" + entity_id: !input 'entity31' id: current_state_entity31 - ##### Button32 Sync - Trigger "current_state_entity32" ##### + ##### Button32 Sync - Trigger 'current_state_entity32' ##### - platform: state - entity_id: !input "entity32" + entity_id: !input 'entity32' id: current_state_entity32 ##### Trigger - Home - Chips - State change ################################################################################################################# - ##### Chip 01 - Trigger "chip01_state" ##### + ##### Chip 01 - Trigger 'chip01_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip01" + entity_id: !input 'chip01' id: chip01_state - ##### Chip 02 - Trigger "chip02_state" ##### + ##### Chip 02 - Trigger 'chip02_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip02" + entity_id: !input 'chip02' id: chip02_state - ##### Chip 03 - Trigger "chip03_state" ##### + ##### Chip 03 - Trigger 'chip03_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip03" + entity_id: !input 'chip03' id: chip03_state - ##### Chip 04 - Trigger "chip04_state" ##### + ##### Chip 04 - Trigger 'chip04_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip04" + entity_id: !input 'chip04' id: chip04_state - ##### Chip 05 - Trigger "chip05_state" ##### + ##### Chip 05 - Trigger 'chip05_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip05" + entity_id: !input 'chip05' id: chip05_state - ##### Chip 06 - Trigger "chip06_state" ##### + ##### Chip 06 - Trigger 'chip06_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip06" + entity_id: !input 'chip06' id: chip06_state - ##### Chip 07 - Trigger "chip07_state" ##### + ##### Chip 07 - Trigger 'chip07_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "chip07" + entity_id: !input 'chip07' id: chip07_state ##### Trigger - Home - Values - State change ################################################################################################################# - ##### HOME Value 01 - Trigger "home_value01_state" ##### + ##### HOME Value 01 - Trigger 'home_value01_state' ##### - platform: state - entity_id: !input "home_value01" + entity_id: !input 'home_value01' not_to: - unknown - unavailable id: home_value01_state - ##### HOME Value 02 - Trigger "home_value02_state" ##### + ##### HOME Value 02 - Trigger 'home_value02_state' ##### - platform: state - entity_id: !input "home_value02" + entity_id: !input 'home_value02' not_to: - unknown - unavailable id: home_value02_state - ##### HOME Value 03 - Trigger "home_value03_state" ##### + ##### HOME Value 03 - Trigger 'home_value03_state' ##### - platform: state - entity_id: !input "home_value03" + entity_id: !input 'home_value03' not_to: - unknown - unavailable @@ -3495,100 +3500,100 @@ trigger: ##### Trigger - Relays - State change ################################################################################################################# - ##### Relay01 - Trigger "relay01_state" ##### + ##### Relay01 - Trigger 'relay01_state' ##### - platform: event event_type: state_changed event_data: - entity_id: "{{ relay01_entity }}" + entity_id: '{{ relay01_entity }}' id: relay01_state - ##### Relay02 - Trigger "relay02_state" ##### + ##### Relay02 - Trigger 'relay02_state' ##### - platform: event event_type: state_changed event_data: - entity_id: "{{ relay02_entity }}" + entity_id: '{{ relay02_entity }}' id: relay02_state ##### Trigger - Climate - State change ################################################################################################################# - ##### Climate - Trigger "climate_state" ##### + ##### Climate - Trigger 'climate_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "climate" + entity_id: !input 'climate' id: climate_state ##### Trigger - Notifications ################################################################################################################# - ##### Notification Text - Trigger "notification_text_state" ##### + ##### Notification Text - Trigger 'notification_text_state' ##### - platform: event event_type: state_changed event_data: - entity_id: "{{ notification_text }}" + entity_id: '{{ notification_text }}' id: notification_text_state - ##### Notification Text - Trigger "notification_text_state" ##### + ##### Notification Text - Trigger 'notification_text_state' ##### - platform: event event_type: state_changed event_data: - entity_id: "{{ notification_unread }}" + entity_id: '{{ notification_unread }}' id: notification_unread_state ##### Trigger - Hardware buttons ################################################################################################################# - ##### Left Button - Trigger "left_button_press" ##### + ##### Left Button - Trigger 'left_button_press' ##### - platform: template - value_template: "{{ is_state(left_button, 'on') | default(false) if left_button is string else false }}" + value_template: '{{ is_state(left_button, "on") | default(false) if left_button is string else false }}' id: left_button_press - ##### Right Button - Trigger "right_button_press" ##### + ##### Right Button - Trigger 'right_button_press' ##### - platform: template - value_template: "{{ is_state(right_button, 'on') | default(false) if right_button is string else false }}" + value_template: '{{ is_state(right_button, "on") | default(false) if right_button is string else false }}' id: right_button_press - ##### Left Button - State "left_button_state" ##### + ##### Left Button - State 'left_button_state' ##### - platform: state - entity_id: !input "left_button_entity" + entity_id: !input 'left_button_entity' to: - - 'on' - - 'off' + - "on" + - "off" id: left_button_state - ##### Right Button - State "right_button_state" ##### + ##### Right Button - State 'right_button_state' ##### - platform: state - entity_id: !input "right_button_entity" + entity_id: !input 'right_button_entity' to: - - 'on' - - 'off' + - "on" + - "off" id: right_button_state ##### Trigger - Time ################################################################################################################# - ##### Time - Trigger "time_state" ##### + ##### Time - Trigger 'time_state' ##### - platform: time_pattern seconds: 0 id: time_state ##### Trigger - Temperatures ################################################################################################################# - ##### Outdoor Temp - Trigger "outdoortemp_state" ##### + ##### Outdoor Temp - Trigger 'outdoortemp_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "outdoortemp" + entity_id: !input 'outdoortemp' id: outdoortemp_state - ##### indoor Temp Sensor - Trigger "indoortemp_state" ##### + ##### indoor Temp Sensor - Trigger 'indoortemp_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "indoortemp" + entity_id: !input 'indoortemp' id: indoortemp_state - ##### NSPAnel Temp Sensor - Trigger "nspaneltemp_state" ##### + ##### NSPAnel Temp Sensor - Trigger 'nspaneltemp_state' ##### - platform: event event_type: state_changed event_data: - entity_id: "{{ nspaneltemp }}" + entity_id: '{{ nspaneltemp }}' id: nspaneltemp_state ##### Trigger - Weather ################################################################################################################# @@ -3596,40 +3601,40 @@ trigger: - platform: event event_type: state_changed event_data: - entity_id: !input "weather_entity" + entity_id: !input 'weather_entity' id: weather_state_change ##### Trigger - Hot water ################################################################################################################# - ##### Hot Water Charge - Trigger "hotwatercharge_state" ##### + ##### Hot Water Charge - Trigger 'hotwatercharge_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "hotwatercharge" + entity_id: !input 'hotwatercharge' id: hotwatercharge_state - ##### Hot Water - Trigger "hotwatertemp_state" ##### + ##### Hot Water - Trigger 'hotwatertemp_state' ##### - platform: event event_type: state_changed event_data: - entity_id: !input "hotwatertemp" + entity_id: !input 'hotwatertemp' id: hotwatertemp_state ##### Trigger - TFT ################################################################################################################# - ##### TFT Upload - Trigger "tft_upload" ##### + ##### TFT Upload - Trigger 'tft_upload' ##### - platform: event event_type: folder_watcher event_data: event_type: modified - path: !input "tft_path" + path: !input 'tft_path' id: tft_upload ############################################################# ##### CLOSE - Trigger ##### ############################################################# -condition: "{{ is_state(nextion_inited, 'on') | default(false) if nextion_inited is string else false }}" +condition: '{{ is_state(nextion_inited, "on") | default(false) if nextion_inited is string else false }}' ############################################################# ##### START - Action ##### @@ -3638,22 +3643,32 @@ action: - alias: Main choices choose: ##### JUMP TO - settings page lightsettings /coversettings / climate (SETTINGS ENTITY CHANGED) ##### - - alias: "Jump to light/cover/climate settings page" + - alias: 'Jump to light/cover/climate settings page' conditions: - condition: trigger id: settings_entity - - "{{ trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}" + - '{{ trigger.event.data.new_state.state not in ["unavailable", "unknown", None] }}' sequence: - &variables-settings_entity variables: - settings_entity_state: "{{ states(settings_entity) if settings_entity is string else 'unknown' }}" - settings_entity_dict: '{{ settings_entity_state if settings_entity_state is mapping else { "page": "home", "entity": "unknown" } }}' - settings_entity_domain: "{{ settings_entity_dict.entity.split('.')[0] if settings_entity_dict.entity is defined and settings_entity_dict.entity is string and settings_entity_dict.entity.split('.') | count > 0 else 'unknown' }}" - - if: "{{ settings_entity_domain in ['light', 'cover', 'climate'] }}" + settings_entity_state: > + {{ + states(settings_entity) + if settings_entity is string + else "unknown" + }} + settings_entity_dict: > + {{ + settings_entity_state + if settings_entity_state is mapping + else { "page": "home", "entity": "unknown" } + }} + settings_entity_domain: '{{ settings_entity_dict.entity.split(".")[0] if settings_entity_dict.entity is defined and settings_entity_dict.entity is string and settings_entity_dict.entity.split(".") | count > 0 else "unknown" }}' + - if: '{{ settings_entity_domain in ["light", "cover", "climate"] }}' then: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages[settings_entity_domain] }}" + cmd: 'page {{ nextion.pages[settings_entity_domain] }}' continue_on_error: true ##### BOOT NSPANEL - boot init ##### @@ -3661,47 +3676,47 @@ action: conditions: - condition: trigger id: nspanel_boot_init - - "{{ nspanel_event.page != nextion.pages.home or (is_state(settings_entity, ['unavailable', 'unknown', None]) | default(False) if settings_entity is string else False) }}" + - '{{ nspanel_event.page != nextion.pages.home or (is_state(settings_entity, ["unavailable", "unknown", None]) | default(False) if settings_entity is string else False) }}' sequence: ##### NSPanel boot init only ##### - delay: milliseconds: 100 - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: boot.bluep_version - message: "{{ blueprint_version }}" + message: '{{ blueprint_version }}' continue_on_error: true ###### Set local fallback ###### - - service: "switch.turn_{{ 'on' if relay_1_local_fallback else 'off' }}" + - service: 'switch.turn_{{ "on" if relay_1_local_fallback else "off" }}' data: - entity_id: 'switch.{{ nspanel_name }}_relay_1_local_fallback' + entity_id: "switch.{{ nspanel_name }}_relay_1_local_fallback" continue_on_error: true - - service: "switch.turn_{{ 'on' if relay_2_local_fallback else 'off' }}" + - service: 'switch.turn_{{ "on" if relay_2_local_fallback else "off" }}' data: - entity_id: 'switch.{{ nspanel_name }}_relay_2_local_fallback' + entity_id: "switch.{{ nspanel_name }}_relay_2_local_fallback" continue_on_error: true ##### clear notification icon ##### - - service: "{{ nextion.commands.notification_clear }}" + - service: '{{ nextion.commands.notification_clear }}' data: {} continue_on_error: true ###### NSPanel beep ###### - delay: milliseconds: 2000 - - if: "{{ is_state(notification_sound, 'on') }}" + - if: '{{ is_state(notification_sound, "on") }}' then: - - service: "{{ nextion.commands.play_rtttl }}" + - service: '{{ nextion.commands.play_rtttl }}' data: - song_str: "two short:d=4,o=5,b=100:16e6,16e6" + song_str: 'two short:d=4,o=5,b=100:16e6,16e6' continue_on_error: true ##### NSPanel boot init finished and jump to Home Page##### - &delay-default delay: - milliseconds: "{{ delay_value }}" - - service: "{{ nextion.commands.printf }}" + milliseconds: '{{ delay_value }}' + - service: '{{ nextion.commands.printf }}' data: cmd: page home continue_on_error: true @@ -3719,41 +3734,41 @@ action: sequence: - alias: old state variables: - old_state: "{{ trigger.event.data.old_state.state }}" + old_state: '{{ trigger.event.data.old_state.state }}' ##### climate-page left - apply climate temperature if climate_optimistic ##### ## TODO - remove from here - - if: "{{ old_state.page == nextion.pages.climate and climate_optimistic }}" + - if: '{{ old_state.page == nextion.pages.climate and climate_optimistic }}' then: - variables: display_target_temperature_state: > {{ - states(display_target_temperature) | default('unavailable') + states(display_target_temperature) | default("unavailable") if display_target_temperature is string - else 'unavailable' + else "unavailable" }} - - condition: "{{ is_number(display_target_temperature_state) }}" + - condition: '{{ is_number(display_target_temperature_state) }}' - *variables-settings_entity - - condition: "{{ settings_entity_domain == 'climate' }}" + - condition: '{{ settings_entity_domain == "climate" }}' - service: climate.set_temperature data: - entity_id: "{{ settings_entity_dict.entity }}" - temperature: "{{ display_target_temperature_state }}" + entity_id: '{{ settings_entity_dict.entity }}' + temperature: '{{ display_target_temperature_state }}' continue_on_error: true - choose: ## PAGE HOME ## - alias: Home page - conditions: "{{ nspanel_event.page == nextion.pages.home }}" + conditions: '{{ nspanel_event.page == nextion.pages.home }}' sequence: &refresh_page_home - - service: "{{ nextion.commands.set_settings_entity }}" + - service: '{{ nextion.commands.set_settings_entity }}' data: - entity: "{{ nspanel_event }}" + entity: '{{ nspanel_event }}' continue_on_error: true - &refresh-page_home-date_time - if: "{{ true }}" + if: '{{ true }}' then: ##### NSPanel Date ##### ### DATE Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.date message: > @@ -3765,15 +3780,15 @@ action: continue_on_error: true ### DATE Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.date - message: "{{ (dict.values(mui[language].weekdays) | list)[now().weekday()] ~ ', ' ~ as_timestamp(now()) | timestamp_custom(date_format) }}" + message: '{{ (dict.values(mui[language].weekdays) | list)[now().weekday()] ~ ", " ~ as_timestamp(now()) | timestamp_custom(date_format) }}' continue_on_error: true ##### NSPanel Time ##### ### TIME Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.time message: > @@ -3785,16 +3800,16 @@ action: continue_on_error: true ### TIME Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.time - message: "{{ time }}" + message: '{{ time }}' continue_on_error: true - - if: "{{ meridiem }}" + - if: '{{ meridiem }}' then: ### TIME Meridiem Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.meridiem message: > @@ -3806,34 +3821,34 @@ action: continue_on_error: true ### TIME Meridiem Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.meridiem - message: "{{ meridiem }}" + message: '{{ meridiem }}' continue_on_error: true - &refresh-page_home-outdoor_temp - if: "{{ true }}" + if: '{{ true }}' then: ##### NSPanel Outdoor Temp ##### - variables: outdoor_temp_state: > {{ - states(outdoortemp) | default('unavailable') - if outdoortemp is string and outdoortemp is match 'sensor.' - else 'unavailable' + states(outdoortemp) | default("unavailable") + if outdoortemp is string and outdoortemp is match "sensor." + else "unavailable" }} outdoor_temp: > {{ outdoor_temp_state if is_number(outdoor_temp_state) - else state_attr(weather_entity, 'temperature') | default('unavailable') - if weather_entity is string else 'unavailable' + else state_attr(weather_entity, "temperature") | default("unavailable") + if weather_entity is string else "unavailable" }} - - if: "{{ is_number(outdoor_temp) }}" + - if: '{{ is_number(outdoor_temp) }}' then: ### LABEL Outdoor Temp Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.outdoor_temp message: > @@ -3845,23 +3860,23 @@ action: continue_on_error: true ### LABEL Outdoor Temp Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.outdoor_temp - message: "{{ outdoor_temp | round(1) ~ temperature_units }}" + message: '{{ outdoor_temp | round(1) ~ temperature_units }}' continue_on_error: true - &refresh-page_home-indoor_temp - if: "{{ true }}" + if: '{{ true }}' then: ##### NSPanel Indoor Temp ##### - variables: - indoor_temp_state: "{{ states(indoortemp) | default('unavailable') if indoortemp is string and indoortemp is match 'sensor.' else states(nspaneltemp) }}" - - if: "{{ is_number(indoor_temp_state) }}" + indoor_temp_state: '{{ states(indoortemp) | default("unavailable") if indoortemp is string and indoortemp is match "sensor." else states(nspaneltemp) }}' + - if: '{{ is_number(indoor_temp_state) }}' then: ### ICON Indoor Temp Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.indoortempicon message: > @@ -3873,14 +3888,14 @@ action: continue_on_error: true ### ICON Indoor Temp Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.indoortempicon - message: "{{ nextion.icons.all[page_home.general.indoor_temp.icon.icon.split(':')[1]] | default(page_home.general.indoor_temp.icon.icon if page_home.general.indoor_temp.icon.icon is string else '\U0000E2D5') }}" + message: '{{ nextion.icons.all[page_home.general.indoor_temp.icon.icon.split(":")[1]] | default(page_home.general.indoor_temp.icon.icon if page_home.general.indoor_temp.icon.icon is string else "\U0000E2D5") }}' continue_on_error: true ### LABEL Indoor Temp Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.current_temp message: > @@ -3892,31 +3907,31 @@ action: continue_on_error: true ### LABEL Indoor Temp Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.current_temp - message: "{{ (indoor_temp_state | round(1) ~ temperature_units) if is_number(indoor_temp_state) else (mui[language].unavailable if indoor_temp_state in ['unavailable', 'unknown', None] else indoor_temp_state) }}" + message: '{{ (indoor_temp_state | round(1) ~ temperature_units) if is_number(indoor_temp_state) else (mui[language].unavailable if indoor_temp_state in ["unavailable", "unknown", None] else indoor_temp_state) }}' continue_on_error: true ##### Weather Icon Home Page ##### - *delay-default - &refresh-page_home-weather_pic - service: "{{ nextion.commands.printf }}" + service: '{{ nextion.commands.printf }}' data: - cmd: home.weather.pic={{ nextion.pics.weather[states(weather_entity) | default('unavailable') if weather_entity is string else 'unavailable'] | default(None) }} + cmd: home.weather.pic={{ nextion.pics.weather[states(weather_entity) | default("unavailable") if weather_entity is string else "unavailable"] | default(None) }} continue_on_error: true ##### NSPanel Buttons ##### - variables: - left_button_state: "{{ states(page_home.hardware.buttons.left.entity) | default('unavailable') if page_home.hardware.buttons.left.entity is string else 'unavailable' }}" - right_button_state: "{{ states(page_home.hardware.buttons.right.entity) | default('unavailable') if page_home.hardware.buttons.right.entity is string else 'unavailable' }}" + left_button_state: '{{ states(page_home.hardware.buttons.left.entity) | default("unavailable") if page_home.hardware.buttons.left.entity is string else "unavailable" }}' + right_button_state: '{{ states(page_home.hardware.buttons.right.entity) | default("unavailable") if page_home.hardware.buttons.right.entity is string else "unavailable" }}' ##### NSPanel Left Button Name ##### - - if: "{{ page_home.hardware.buttons.left.name | length > 0 }}" + - if: '{{ page_home.hardware.buttons.left.name | length > 0 }}' then: ### LABEL Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.left_bt_text message: > @@ -3928,30 +3943,30 @@ action: continue_on_error: true ### LABEL Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.left_bt_text - message: "{{ page_home.hardware.buttons.left.name }}" + message: '{{ page_home.hardware.buttons.left.name }}' continue_on_error: true ##### SET Left Hardware Button PIC on Home Page #### - - if: "{{ left_button_state not in ['unavailable', 'unknown', None] }}" + - if: '{{ left_button_state not in ["unavailable", "unknown", None] }}' then: - variables: # Hardware Button PIC - left_hardware_button_state: "{{ nextion.pics.hardware.button[left_button_state] | default(None) }}" + left_hardware_button_state: '{{ nextion.pics.hardware.button[left_button_state] | default(None) }}' - *delay-default - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: cmd: home.left_bt_pic.pic={{ left_hardware_button_state }} continue_on_error: true ##### NSPanel Right Button Name ##### - - if: "{{ page_home.hardware.buttons.right.name | length > 0 }}" + - if: '{{ page_home.hardware.buttons.right.name | length > 0 }}' then: ### LABEL Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.right_bt_text message: > @@ -3963,20 +3978,20 @@ action: continue_on_error: true ### LABEL Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.right_bt_text - message: "{{ page_home.hardware.buttons.right.name }}" + message: '{{ page_home.hardware.buttons.right.name }}' continue_on_error: true ##### SET Right Hardware Button PIC on Home Page ##### - - if: "{{ right_button_state not in ['unavailable', 'unknown', None] }}" + - if: '{{ right_button_state not in ["unavailable", "unknown", None] }}' then: - variables: # Hardware Button PIC - right_hardware_button_state: "{{ nextion.pics.hardware.button[right_button_state] | default(None) }}" + right_hardware_button_state: '{{ nextion.pics.hardware.button[right_button_state] | default(None) }}' - *delay-default - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: cmd: home.right_bt_pic.pic={{ right_hardware_button_state }} continue_on_error: true @@ -3984,129 +3999,129 @@ action: ###### Status bar ###### - &variables-home_page_status_bar variables: - thermostat_icon: !input "thermostat_icon" #E50E - heat_icon: !input "heat_icon" #\U0000E50F - climate_state: "{{ states(climate) | default('unavailable') if climate is string else 'unavailable' }}" - climate_action: "{{ state_attr(climate, 'hvac_action') | default('unavailable') if climate is string else 'unavailable' }}" + thermostat_icon: !input 'thermostat_icon' #E50E + heat_icon: !input 'heat_icon' #\U0000E50F + climate_state: '{{ states(climate) | default("unavailable") if climate is string else "unavailable" }}' + climate_action: '{{ state_attr(climate, "hvac_action") | default("unavailable") if climate is string else "unavailable" }}' home_page_status_bar: - - entity: "{{ relay01_entity }}" - icon: !input "relay01_icon" #E3A5 - icon_color_rgb: !input "relay01_icon_color" + - entity: '{{ relay01_entity }}' + icon: !input 'relay01_icon' #E3A5 + icon_color_rgb: !input 'relay01_icon_color' page: home component: icon_top_01 - - entity: "{{ relay02_entity }}" - icon: !input "relay02_icon" #E3A8 - icon_color_rgb: !input "relay02_icon_color" + - entity: '{{ relay02_entity }}' + icon: !input 'relay02_icon' #E3A8 + icon_color_rgb: !input 'relay02_icon_color' page: home component: icon_top_02 - - entity: "{{ climate }}" - icon: "{{ (nextion.icons.all[heat_icon.split(':')[1]] | default(heat_icon if heat_icon is string else '\U0000E2D5') if climate_action == 'heating' else nextion.icons.all[thermostat_icon.split(':')[1]] | default(thermostat_icon if thermostat_icon is string else '\U0000E2D5')) if climate_state == 'heat' else nextion.icons.blank }}" - icon_color_rgb: !input "thermostat_icon_color" + - entity: '{{ climate }}' + icon: '{{ (nextion.icons.all[heat_icon.split(":")[1]] | default(heat_icon if heat_icon is string else "\U0000E2D5") if climate_action == "heating" else nextion.icons.all[thermostat_icon.split(":")[1]] | default(thermostat_icon if thermostat_icon is string else "\U0000E2D5")) if climate_state == "heat" else nextion.icons.blank }}' + icon_color_rgb: !input 'thermostat_icon_color' page: home component: icon_top_03 - - entity: !input "chip01" - icon: !input "chip01_icon" - icon_color_rgb: !input "chip01_icon_color" + - entity: !input 'chip01' + icon: !input 'chip01_icon' + icon_color_rgb: !input 'chip01_icon_color' page: home component: icon_top_04 - - entity: !input "chip02" - icon: !input "chip02_icon" - icon_color_rgb: !input "chip02_icon_color" + - entity: !input 'chip02' + icon: !input 'chip02_icon' + icon_color_rgb: !input 'chip02_icon_color' page: home component: icon_top_05 - - entity: !input "chip03" - icon: !input "chip03_icon" - icon_color_rgb: !input "chip03_icon_color" + - entity: !input 'chip03' + icon: !input 'chip03_icon' + icon_color_rgb: !input 'chip03_icon_color' page: home component: icon_top_06 - - entity: !input "chip04" - icon: !input "chip04_icon" - icon_color_rgb: !input "chip04_icon_color" + - entity: !input 'chip04' + icon: !input 'chip04_icon' + icon_color_rgb: !input 'chip04_icon_color' page: home component: icon_top_07 - - entity: !input "chip05" - icon: !input "chip05_icon" - icon_color_rgb: !input "chip05_icon_color" + - entity: !input 'chip05' + icon: !input 'chip05_icon' + icon_color_rgb: !input 'chip05_icon_color' page: home component: icon_top_08 - - entity: !input "chip06" - icon: !input "chip06_icon" - icon_color_rgb: !input "chip06_icon_color" + - entity: !input 'chip06' + icon: !input 'chip06_icon' + icon_color_rgb: !input 'chip06_icon_color' page: home component: icon_top_09 - - entity: !input "chip07" - icon: !input "chip07_icon" - icon_color_rgb: !input "chip07_icon_color" + - entity: !input 'chip07' + icon: !input 'chip07_icon' + icon_color_rgb: !input 'chip07_icon_color' page: home component: icon_top_10 - repeat: - for_each: "{{ home_page_status_bar }}" + for_each: '{{ home_page_status_bar }}' sequence: - &display-home_page_status_bar - if: "{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}" + if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}' then: - variables: - repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}" - repeat_item_state_is_on: "{{ repeat_item_state in ['on', 'open'] }}" + repeat_item_state: '{{ states(repeat.item.entity) | default("unavailable") }}' + repeat_item_state_is_on: '{{ repeat_item_state in ["on", "open"] }}' repeat_item_icon: > - {% if repeat_item_state_is_on and repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon) }} - {% elif repeat_item_state_is_on and state_attr(repeat.item.entity, 'icon') | default('') not in ['unavailable', 'unknown', '', None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, 'icon').split(':')[1]] | default(nextion.icons.blank) }} + {% if repeat_item_state_is_on and repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(":")[1]] | default(repeat.item.icon) }} + {% elif repeat_item_state_is_on and state_attr(repeat.item.entity, "icon") | default("") not in ["unavailable", "unknown", "", None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, "icon").split(":")[1]] | default(nextion.icons.blank) }} {% else %}{{ nextion.icons.blank }} {% endif %} - - if: "{{ repeat_item_state_is_on }}" + - if: '{{ repeat_item_state_is_on }}' then: ### ICON Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: - component: "{{ repeat.item.page }}.{{ repeat.item.component }}" - message: "{{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) else ((repeat.item.icon_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.icon_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.icon_color_rgb[2] //(2**3)) }}" + component: '{{ repeat.item.page }}.{{ repeat.item.component }}' + message: '{{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) else ((repeat.item.icon_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.icon_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.icon_color_rgb[2] //(2**3)) }}' continue_on_error: true ### ICON Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ repeat.item.page }}.{{ repeat.item.component }}" - message: "{{ repeat_item_icon }}" + component: '{{ repeat.item.page }}.{{ repeat.item.component }}' + message: '{{ repeat_item_icon }}' continue_on_error: true - # {{ is_state(repeat.item.entity, 'on') | default(False) if repeat.item.entity is string else 'unavailable' }} + # {{ is_state(repeat.item.entity, "on") | default(False) if repeat.item.entity is string else "unavailable" }} ##### HOME VALUE 01 - 03 - *delay-default - &variables-home_page_values variables: home_page_values: - - entity: !input "home_value01" - icon: !input "home_value01_icon" - icon_color_rgb: !input "home_value01_icon_color" - label_color_rgb: !input "home_value01_label_color" + - entity: !input 'home_value01' + icon: !input 'home_value01_icon' + icon_color_rgb: !input 'home_value01_icon_color' + label_color_rgb: !input 'home_value01_label_color' page: home component: value01 - - entity: !input "home_value02" - icon: !input "home_value02_icon" - icon_color_rgb: !input "home_value02_icon_color" - label_color_rgb: !input "home_value02_label_color" + - entity: !input 'home_value02' + icon: !input 'home_value02_icon' + icon_color_rgb: !input 'home_value02_icon_color' + label_color_rgb: !input 'home_value02_label_color' page: home component: value02 - - entity: !input "home_value03" - icon: !input "home_value03_icon" - icon_color_rgb: !input "home_value03_icon_color" - label_color_rgb: !input "home_value03_label_color" + - entity: !input 'home_value03' + icon: !input 'home_value03_icon' + icon_color_rgb: !input 'home_value03_icon_color' + label_color_rgb: !input 'home_value03_label_color' page: home component: value03 - repeat: - for_each: "{{ home_page_values }}" + for_each: '{{ home_page_values }}' sequence: - &display-home_page_value - if: "{{ repeat.item.entity is string and repeat.item.entity is match 'sensor.' and states(repeat.item.entity) not in ['unavailable', 'unknown', None] }}" + if: '{{ repeat.item.entity is string and repeat.item.entity is match "sensor." and states(repeat.item.entity) not in ["unavailable", "unknown", None] }}' then: - - if: "{{ repeat.item.icon | length > 0 }}" + - if: '{{ repeat.item.icon | length > 0 }}' then: ### ICON Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: - component: "{{ repeat.item.page }}.{{ repeat.item.component }}_icon" + component: '{{ repeat.item.page }}.{{ repeat.item.component }}_icon' message: > {{ repeat.item.icon_color_rgb @@ -4116,21 +4131,21 @@ action: continue_on_error: true ### ICON Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ repeat.item.page }}.{{ repeat.item.component }}_icon" - message: "{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon if repeat.item.icon is string else '\U0000E2D5') }}" + component: '{{ repeat.item.page }}.{{ repeat.item.component }}_icon' + message: '{{ nextion.icons.all[repeat.item.icon.split(":")[1]] | default(repeat.item.icon if repeat.item.icon is string else "\U0000E2D5") }}' continue_on_error: true - variables: - repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}" - repeat_item_state_available: "{{ repeat_item_state not in ['unavailable', 'unknown', None] }}" - - if: "{{ repeat_item_state_available }}" + repeat_item_state: '{{ states(repeat.item.entity) | default("unavailable") }}' + repeat_item_state_available: '{{ repeat_item_state not in ["unavailable", "unknown", None] }}' + - if: '{{ repeat_item_state_available }}' then: ### LABEL Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: - component: "{{ repeat.item.page }}.{{ repeat.item.component }}_state" + component: '{{ repeat.item.page }}.{{ repeat.item.component }}_state' message: > {{ repeat.item.label_color_rgb @@ -4140,12 +4155,12 @@ action: continue_on_error: true ### LABEL Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ repeat.item.page }}.{{ repeat.item.component }}_state" + component: '{{ repeat.item.page }}.{{ repeat.item.component }}_state' message: > {{ - (repeat_item_state | round(1) ~ state_attr(repeat.item.entity, 'unit_of_measurement') | default('')) + (repeat_item_state | round(1) ~ state_attr(repeat.item.entity, "unit_of_measurement") | default("")) if is_number(repeat_item_state) else repeat_item_state }} @@ -4153,15 +4168,15 @@ action: ##### Set notify icon ##### - variables: - notification_unread_state: "{{ states(notification_unread) | default('unavailable') if notification_unread is string else 'unavailable' }}" - - if: "{{ notification_unread_state in ['on', 'off'] }}" + notification_unread_state: '{{ states(notification_unread) | default("unavailable") if notification_unread is string else "unavailable" }}' + - if: '{{ notification_unread_state in ["on", "off"] }}' then: - variables: - notification_text_state: "{{ states(notification_text) | default(None) if notification_text is string else None }}" + notification_text_state: '{{ states(notification_text) | default(None) if notification_text is string else None }}' set_button04_icon: > {{ - nextion.icons.all[page_home.buttons[3].icon.split(':')[1]] | default(page_home.buttons[3].icon if page_home.buttons[3].icon is string else '\U0000E2D5') - if notification_unread_state == 'on' and notification_text_state | length > 0 + nextion.icons.all[page_home.buttons[3].icon.split(":")[1]] | default(page_home.buttons[3].icon if page_home.buttons[3].icon is string else "\U0000E2D5") + if notification_unread_state == "on" and notification_text_state | length > 0 else nextion.icons.blank }} set_button04_icon_font: > @@ -4171,31 +4186,31 @@ action: if is_number(page_home.buttons[3].color_rgb[notification_unread_state]) else ((page_home.buttons[3].color_rgb[notification_unread_state][0] //(2**3)) *(2**11))+((page_home.buttons[3].color_rgb[notification_unread_state][1] //(2**2)) *(2**5))+(page_home.buttons[3].color_rgb[notification_unread_state][2] //(2**3)) ) - if notification_unread_state in ['on', 'off'] and notification_text_state | length > 0 + if notification_unread_state in ["on", "off"] and notification_text_state | length > 0 else nextion.colors.grey_light }} ##### SET ICON Font - Notify ##### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.button04_icon - message: "{{ set_button04_icon }}" + message: '{{ set_button04_icon }}' continue_on_error: true ##### SET ICON Font Color - Notify ##### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.button04_icon - message: "{{ set_button04_icon_font }}" + message: '{{ set_button04_icon_font }}' continue_on_error: true ###### QR Code - Icon ###### - *delay-default - - if: "{{ qrcode_enabled == true }}" + - if: '{{ qrcode_enabled == true }}' then: # Display QR code icon ### ICON Font Color ### - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.button05_icon message: > @@ -4207,24 +4222,24 @@ action: continue_on_error: true ### ICON Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.button05_icon - message: "{{ nextion.icons.all[page_home.buttons[4].icon.split(':')[1]] | default(page_home.buttons[4].icon if page_home.buttons[4].icon is string else '\U0000E2D5') }}" + message: '{{ nextion.icons.all[page_home.buttons[4].icon.split(":")[1]] | default(page_home.buttons[4].icon if page_home.buttons[4].icon is string else "\U0000E2D5") }}' continue_on_error: true else: # Display blank icon - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.button05_icon - message: "{{ nextion.icons.blank }}" + message: '{{ nextion.icons.blank }}' continue_on_error: true ###### ENTITIES - Icon ###### - *delay-default - - if: "{{ entitypages_enabled }}" + - if: '{{ entitypages_enabled }}' then: # Display entities icon ### ICON Font Color ### - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.button06_icon message: > @@ -4236,32 +4251,32 @@ action: continue_on_error: true ### ICON Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.button06_icon - message: "{{ nextion.icons.all[page_home.buttons[5].icon.split(':')[1]] | default(page_home.buttons[5].icon if page_home.buttons[5].icon is string else '\U0000E2D5') }}" + message: '{{ nextion.icons.all[page_home.buttons[5].icon.split(":")[1]] | default(page_home.buttons[5].icon if page_home.buttons[5].icon is string else "\U0000E2D5") }}' continue_on_error: true else: # Display blank icon - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.button06_icon - message: "{{ nextion.icons.blank }}" + message: '{{ nextion.icons.blank }}' continue_on_error: true ###### SHOW All component when page loading done ##### - *delay-default - - service: "{{ nextion.commands.show_all }}" + - service: '{{ nextion.commands.show_all }}' continue_on_error: true ## BUTTON PAGES 01 - 04 ## - alias: Button pages - conditions: "{{ nspanel_event.page in nextion.pages.buttonpages }}" + conditions: '{{ nspanel_event.page in nextion.pages.buttonpages }}' sequence: &refresh_page_buttonpage - &variables-page_buttons variables: - button_page_index: "{{ (nspanel_event.page[-2:] | int(-1)) - 1 }}" - first_button: "{{ button_page_index * 8 }}" - last_button: "{{ first_button + 8 }}" + button_page_index: '{{ (nspanel_event.page[-2:] | int(-1)) - 1 }}' + first_button: '{{ button_page_index * 8 }}' + last_button: '{{ first_button + 8 }}' ##### BUTTON Page Labels ##### button_pages_labels: - label: !input button_page01_label @@ -4270,286 +4285,286 @@ action: - label: !input button_page04_label ##### BUTTONS Page - Buttons 1 - 32 ##### button_pages_buttons: - - entity: !input "entity01" - name: !input "entity01_name" - icon: !input "entity01_icon" - icon_color_rgb: !input "entity01_icon_color" - confirm: !input "entity01_confirm" + - entity: !input 'entity01' + name: !input 'entity01_name' + icon: !input 'entity01_icon' + icon_color_rgb: !input 'entity01_icon_color' + confirm: !input 'entity01_confirm' page: buttonpage01 component: button01 - - entity: !input "entity02" - name: !input "entity02_name" - icon: !input "entity02_icon" - icon_color_rgb: !input "entity02_icon_color" - confirm: !input "entity02_confirm" + - entity: !input 'entity02' + name: !input 'entity02_name' + icon: !input 'entity02_icon' + icon_color_rgb: !input 'entity02_icon_color' + confirm: !input 'entity02_confirm' page: buttonpage01 component: button02 - - entity: !input "entity03" - name: !input "entity03_name" - icon: !input "entity03_icon" - icon_color_rgb: !input "entity03_icon_color" - confirm: !input "entity03_confirm" + - entity: !input 'entity03' + name: !input 'entity03_name' + icon: !input 'entity03_icon' + icon_color_rgb: !input 'entity03_icon_color' + confirm: !input 'entity03_confirm' page: buttonpage01 component: button03 - - entity: !input "entity04" - name: !input "entity04_name" - icon: !input "entity04_icon" - icon_color_rgb: !input "entity04_icon_color" - confirm: !input "entity04_confirm" + - entity: !input 'entity04' + name: !input 'entity04_name' + icon: !input 'entity04_icon' + icon_color_rgb: !input 'entity04_icon_color' + confirm: !input 'entity04_confirm' page: buttonpage01 component: button04 - - entity: !input "entity05" - name: !input "entity05_name" - icon: !input "entity05_icon" - icon_color_rgb: !input "entity05_icon_color" - confirm: !input "entity05_confirm" + - entity: !input 'entity05' + name: !input 'entity05_name' + icon: !input 'entity05_icon' + icon_color_rgb: !input 'entity05_icon_color' + confirm: !input 'entity05_confirm' page: buttonpage01 component: button05 - - entity: !input "entity06" - name: !input "entity06_name" - icon: !input "entity06_icon" - icon_color_rgb: !input "entity06_icon_color" - confirm: !input "entity06_confirm" + - entity: !input 'entity06' + name: !input 'entity06_name' + icon: !input 'entity06_icon' + icon_color_rgb: !input 'entity06_icon_color' + confirm: !input 'entity06_confirm' page: buttonpage01 component: button06 - - entity: !input "entity07" - name: !input "entity07_name" - icon: !input "entity07_icon" - icon_color_rgb: !input "entity07_icon_color" - confirm: !input "entity07_confirm" + - entity: !input 'entity07' + name: !input 'entity07_name' + icon: !input 'entity07_icon' + icon_color_rgb: !input 'entity07_icon_color' + confirm: !input 'entity07_confirm' page: buttonpage01 component: button07 - - entity: !input "entity08" - name: !input "entity08_name" - icon: !input "entity08_icon" - icon_color_rgb: !input "entity08_icon_color" - confirm: !input "entity08_confirm" + - entity: !input 'entity08' + name: !input 'entity08_name' + icon: !input 'entity08_icon' + icon_color_rgb: !input 'entity08_icon_color' + confirm: !input 'entity08_confirm' page: buttonpage01 component: button08 - - entity: !input "entity09" - name: !input "entity09_name" - icon: !input "entity09_icon" - icon_color_rgb: !input "entity09_icon_color" - confirm: !input "entity09_confirm" + - entity: !input 'entity09' + name: !input 'entity09_name' + icon: !input 'entity09_icon' + icon_color_rgb: !input 'entity09_icon_color' + confirm: !input 'entity09_confirm' page: buttonpage02 component: button01 - - entity: !input "entity10" - name: !input "entity10_name" - icon: !input "entity10_icon" - icon_color_rgb: !input "entity10_icon_color" - confirm: !input "entity10_confirm" + - entity: !input 'entity10' + name: !input 'entity10_name' + icon: !input 'entity10_icon' + icon_color_rgb: !input 'entity10_icon_color' + confirm: !input 'entity10_confirm' page: buttonpage02 component: button02 - - entity: !input "entity11" - name: !input "entity11_name" - icon: !input "entity11_icon" - icon_color_rgb: !input "entity11_icon_color" - confirm: !input "entity11_confirm" + - entity: !input 'entity11' + name: !input 'entity11_name' + icon: !input 'entity11_icon' + icon_color_rgb: !input 'entity11_icon_color' + confirm: !input 'entity11_confirm' page: buttonpage02 component: button03 - - entity: !input "entity12" - name: !input "entity12_name" - icon: !input "entity12_icon" - icon_color_rgb: !input "entity12_icon_color" - confirm: !input "entity12_confirm" + - entity: !input 'entity12' + name: !input 'entity12_name' + icon: !input 'entity12_icon' + icon_color_rgb: !input 'entity12_icon_color' + confirm: !input 'entity12_confirm' page: buttonpage02 component: button04 - - entity: !input "entity13" - name: !input "entity13_name" - icon: !input "entity13_icon" - icon_color_rgb: !input "entity13_icon_color" - confirm: !input "entity13_confirm" + - entity: !input 'entity13' + name: !input 'entity13_name' + icon: !input 'entity13_icon' + icon_color_rgb: !input 'entity13_icon_color' + confirm: !input 'entity13_confirm' page: buttonpage02 component: button05 - - entity: !input "entity14" - name: !input "entity14_name" - icon: !input "entity14_icon" - icon_color_rgb: !input "entity14_icon_color" - confirm: !input "entity14_confirm" + - entity: !input 'entity14' + name: !input 'entity14_name' + icon: !input 'entity14_icon' + icon_color_rgb: !input 'entity14_icon_color' + confirm: !input 'entity14_confirm' page: buttonpage02 component: button06 - - entity: !input "entity15" - name: !input "entity15_name" - icon: !input "entity15_icon" - icon_color_rgb: !input "entity15_icon_color" - confirm: !input "entity15_confirm" + - entity: !input 'entity15' + name: !input 'entity15_name' + icon: !input 'entity15_icon' + icon_color_rgb: !input 'entity15_icon_color' + confirm: !input 'entity15_confirm' page: buttonpage02 component: button07 - - entity: !input "entity16" - name: !input "entity16_name" - icon: !input "entity16_icon" - icon_color_rgb: !input "entity16_icon_color" - confirm: !input "entity16_confirm" + - entity: !input 'entity16' + name: !input 'entity16_name' + icon: !input 'entity16_icon' + icon_color_rgb: !input 'entity16_icon_color' + confirm: !input 'entity16_confirm' page: buttonpage02 component: button08 - - entity: !input "entity17" - name: !input "entity17_name" - icon: !input "entity17_icon" - icon_color_rgb: !input "entity17_icon_color" - confirm: !input "entity17_confirm" + - entity: !input 'entity17' + name: !input 'entity17_name' + icon: !input 'entity17_icon' + icon_color_rgb: !input 'entity17_icon_color' + confirm: !input 'entity17_confirm' page: buttonpage03 component: button01 - - entity: !input "entity18" - name: !input "entity18_name" - icon: !input "entity18_icon" - icon_color_rgb: !input "entity18_icon_color" - confirm: !input "entity18_confirm" + - entity: !input 'entity18' + name: !input 'entity18_name' + icon: !input 'entity18_icon' + icon_color_rgb: !input 'entity18_icon_color' + confirm: !input 'entity18_confirm' page: buttonpage03 component: button02 - - entity: !input "entity19" - name: !input "entity19_name" - icon: !input "entity19_icon" - icon_color_rgb: !input "entity19_icon_color" - confirm: !input "entity19_confirm" + - entity: !input 'entity19' + name: !input 'entity19_name' + icon: !input 'entity19_icon' + icon_color_rgb: !input 'entity19_icon_color' + confirm: !input 'entity19_confirm' page: buttonpage03 component: button03 - - entity: !input "entity20" - name: !input "entity20_name" - icon: !input "entity20_icon" - icon_color_rgb: !input "entity20_icon_color" - confirm: !input "entity20_confirm" + - entity: !input 'entity20' + name: !input 'entity20_name' + icon: !input 'entity20_icon' + icon_color_rgb: !input 'entity20_icon_color' + confirm: !input 'entity20_confirm' page: buttonpage03 component: button04 - - entity: !input "entity21" - name: !input "entity21_name" - icon: !input "entity21_icon" - icon_color_rgb: !input "entity21_icon_color" - confirm: !input "entity21_confirm" + - entity: !input 'entity21' + name: !input 'entity21_name' + icon: !input 'entity21_icon' + icon_color_rgb: !input 'entity21_icon_color' + confirm: !input 'entity21_confirm' page: buttonpage03 component: button05 - - entity: !input "entity22" - name: !input "entity22_name" - icon: !input "entity22_icon" - icon_color_rgb: !input "entity22_icon_color" - confirm: !input "entity22_confirm" + - entity: !input 'entity22' + name: !input 'entity22_name' + icon: !input 'entity22_icon' + icon_color_rgb: !input 'entity22_icon_color' + confirm: !input 'entity22_confirm' page: buttonpage03 component: button06 - - entity: !input "entity23" - name: !input "entity23_name" - icon: !input "entity23_icon" - icon_color_rgb: !input "entity23_icon_color" - confirm: !input "entity23_confirm" + - entity: !input 'entity23' + name: !input 'entity23_name' + icon: !input 'entity23_icon' + icon_color_rgb: !input 'entity23_icon_color' + confirm: !input 'entity23_confirm' page: buttonpage03 component: button07 - - entity: !input "entity24" - name: !input "entity24_name" - icon: !input "entity24_icon" - icon_color_rgb: !input "entity24_icon_color" - confirm: !input "entity24_confirm" + - entity: !input 'entity24' + name: !input 'entity24_name' + icon: !input 'entity24_icon' + icon_color_rgb: !input 'entity24_icon_color' + confirm: !input 'entity24_confirm' page: buttonpage03 component: button08 - - entity: !input "entity25" - name: !input "entity25_name" - icon: !input "entity25_icon" - icon_color_rgb: !input "entity25_icon_color" - confirm: !input "entity25_confirm" + - entity: !input 'entity25' + name: !input 'entity25_name' + icon: !input 'entity25_icon' + icon_color_rgb: !input 'entity25_icon_color' + confirm: !input 'entity25_confirm' page: buttonpage04 component: button01 - - entity: !input "entity26" - name: !input "entity26_name" - icon: !input "entity26_icon" - icon_color_rgb: !input "entity26_icon_color" - confirm: !input "entity26_confirm" + - entity: !input 'entity26' + name: !input 'entity26_name' + icon: !input 'entity26_icon' + icon_color_rgb: !input 'entity26_icon_color' + confirm: !input 'entity26_confirm' page: buttonpage04 component: button02 - - entity: !input "entity27" - name: !input "entity27_name" - icon: !input "entity27_icon" - icon_color_rgb: !input "entity27_icon_color" - confirm: !input "entity27_confirm" + - entity: !input 'entity27' + name: !input 'entity27_name' + icon: !input 'entity27_icon' + icon_color_rgb: !input 'entity27_icon_color' + confirm: !input 'entity27_confirm' page: buttonpage04 component: button03 - - entity: !input "entity28" - name: !input "entity28_name" - icon: !input "entity28_icon" - icon_color_rgb: !input "entity28_icon_color" - confirm: !input "entity28_confirm" + - entity: !input 'entity28' + name: !input 'entity28_name' + icon: !input 'entity28_icon' + icon_color_rgb: !input 'entity28_icon_color' + confirm: !input 'entity28_confirm' page: buttonpage04 component: button04 - - entity: !input "entity29" - name: !input "entity29_name" - icon: !input "entity29_icon" - icon_color_rgb: !input "entity29_icon_color" - confirm: !input "entity29_confirm" + - entity: !input 'entity29' + name: !input 'entity29_name' + icon: !input 'entity29_icon' + icon_color_rgb: !input 'entity29_icon_color' + confirm: !input 'entity29_confirm' page: buttonpage04 component: button05 - - entity: !input "entity30" - name: !input "entity30_name" - icon: !input "entity30_icon" - icon_color_rgb: !input "entity30_icon_color" - confirm: !input "entity30_confirm" + - entity: !input 'entity30' + name: !input 'entity30_name' + icon: !input 'entity30_icon' + icon_color_rgb: !input 'entity30_icon_color' + confirm: !input 'entity30_confirm' page: buttonpage04 component: button06 - - entity: !input "entity31" - name: !input "entity31_name" - icon: !input "entity31_icon" - icon_color_rgb: !input "entity31_icon_color" - confirm: !input "entity31_confirm" + - entity: !input 'entity31' + name: !input 'entity31_name' + icon: !input 'entity31_icon' + icon_color_rgb: !input 'entity31_icon_color' + confirm: !input 'entity31_confirm' page: buttonpage04 component: button07 - - entity: !input "entity32" - name: !input "entity32_name" - icon: !input "entity32_icon" - icon_color_rgb: !input "entity32_icon_color" - confirm: !input "entity32_confirm" + - entity: !input 'entity32' + name: !input 'entity32_name' + icon: !input 'entity32_icon' + icon_color_rgb: !input 'entity32_icon_color' + confirm: !input 'entity32_confirm' page: buttonpage04 component: button08 - - if: "{{ button_page_index >= 0 and button_page_index <= 3 }}" + - if: '{{ button_page_index >= 0 and button_page_index <= 3 }}' then: - - service: "{{ nextion.commands.set_settings_entity }}" + - service: '{{ nextion.commands.set_settings_entity }}' data: - entity: "{{ nspanel_event }}" + entity: '{{ nspanel_event }}' continue_on_error: true ##### Button Page Label ##### - - if: "{{ button_pages_labels[button_page_index].label | length > 0 }}" + - if: '{{ button_pages_labels[button_page_index].label | length > 0 }}' then: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ 'bpage%02d_label' | format(button_page_index+1) }}" - message: "{{ button_pages_labels[button_page_index].label }}" + component: '{{ "bpage%02d_label" | format(button_page_index+1) }}' + message: '{{ button_pages_labels[button_page_index].label }}' continue_on_error: true ##### NSPanel build Button page ##### - repeat: - for_each: "{{ button_pages_buttons[first_button:last_button] }}" + for_each: '{{ button_pages_buttons[first_button:last_button] }}' sequence: &display-button_page_button - - if: "{{ repeat.item.entity is string and repeat.item.entity | length > 0 and repeat.item.entity.split('.') | default([]) | count > 0 }}" + - if: '{{ repeat.item.entity is string and repeat.item.entity | length > 0 and repeat.item.entity.split(".") | default([]) | count > 0 }}' then: - variables: - item_domain: "{{ repeat.item.entity.split('.')[0] | default('unknown') }}" - # {{ states(entity_id) | default('unavailable') if entity_id is string else 'unavailable' }} - current_entity_state: "{{ states(repeat.item.entity) | default('unavailable') }}" - current_entity_state_available: "{{ current_entity_state not in ['unavailable'] }}" + item_domain: '{{ repeat.item.entity.split(".")[0] | default("unknown") }}' + # {{ states(entity_id) | default("unavailable") if entity_id is string else "unavailable" }} + current_entity_state: '{{ states(repeat.item.entity) | default("unavailable") }}' + current_entity_state_available: '{{ current_entity_state not in ["unavailable"] }}' # Button PIC GRAY/WHITE btn_pic: > {{ nextion.pics.button.on - if current_entity_state in ['on', 'open', 'opening', 'home'] - or (item_domain == 'climate' and current_entity_state != 'off') - or (item_domain in ['button','input_button','scene'] and trigger.id is match 'current_state_entity') + if current_entity_state in ["on", "open", "opening", "home"] + or (item_domain == "climate" and current_entity_state != "off") + or (item_domain in ["button","input_button","scene"] and trigger.id is match "current_state_entity") else nextion.pics.button.off }} # TEXT, BRIGHTNESS and ICON Background btn_bg: > {{ nextion.colors.white - if current_entity_state in ['on', 'open', 'opening', 'home'] - or (item_domain == 'climate' and current_entity_state != 'off') - or (item_domain in ['button','input_button','scene'] and trigger.id is match 'current_state_entity') + if current_entity_state in ["on", "open", "opening", "home"] + or (item_domain == "climate" and current_entity_state != "off") + or (item_domain in ["button","input_button","scene"] and trigger.id is match "current_state_entity") else nextion.colors.grey_dark }} # ICON Font Color btn_icon_font: > {% if not current_entity_state_available %}{{ nextion.colors.red }} - {% elif current_entity_state in ['off', 'closed', 'closing'] or (item_domain == 'person' and current_entity_state != 'home') %}{{ nextion.colors.grey_light }} - {% elif item_domain in ['button', 'input_button', 'scene'] and trigger.id is match 'current_state_entity' %} + {% elif current_entity_state in ["off", "closed", "closing"] or (item_domain == "person" and current_entity_state != "home") %}{{ nextion.colors.grey_light }} + {% elif item_domain in ["button", "input_button", "scene"] and trigger.id is match "current_state_entity" %} {{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) else ((repeat.item.icon_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.icon_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.icon_color_rgb[2] //(2**3)) }} - {% elif item_domain in ['button', 'input_button', 'scene'] %}{{ nextion.colors.grey_light }} - {% elif current_entity_state in ['on', 'open', 'opening', 'home'] or (item_domain == 'climate' and current_entity_state != 'off') %} + {% elif item_domain in ["button", "input_button", "scene"] %}{{ nextion.colors.grey_light }} + {% elif current_entity_state in ["on", "open", "opening", "home"] or (item_domain == "climate" and current_entity_state != "off") %} {{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) @@ -4560,83 +4575,83 @@ action: # LABEL Font Color btn_txt_font: >- {% if not current_entity_state_available %} {{ nextion.colors.white }} - {% elif current_entity_state in ['off', 'closed', 'closing'] or (item_domain == 'person' and current_entity_state != 'home') %}{{ nextion.colors.white }} - {% elif item_domain in ['button', 'input_button', 'scene'] and trigger.id is match 'current_state_entity' %}{{ nextion.colors.grey_dark }} - {% elif item_domain in ['button', 'input_button', 'scene'] %}{{ nextion.colors.white }} - {% elif current_entity_state in ['on', 'open', 'opening', 'home'] or (item_domain == 'climate' and current_entity_state != 'off') %}{{ nextion.colors.grey_dark }} + {% elif current_entity_state in ["off", "closed", "closing"] or (item_domain == "person" and current_entity_state != "home") %}{{ nextion.colors.white }} + {% elif item_domain in ["button", "input_button", "scene"] and trigger.id is match "current_state_entity" %}{{ nextion.colors.grey_dark }} + {% elif item_domain in ["button", "input_button", "scene"] %}{{ nextion.colors.white }} + {% elif current_entity_state in ["on", "open", "opening", "home"] or (item_domain == "climate" and current_entity_state != "off") %}{{ nextion.colors.grey_dark }} {% else %}{{ nextion.colors.white }} {% endif %} # BRIGHTNESS Font Color - btn_bri_font: "{{ btn_txt_font }}" #"{{ nextion.colors.grey_dark }}" + btn_bri_font: '{{ btn_txt_font }}' #'{{ nextion.colors.grey_dark }}' # ICON Value btn_icon: > {% if not current_entity_state_available %}{{ nextion.icons.buttons.unknown }} {% elif repeat.item.icon | length > 0 %} - {{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon if repeat.item.icon is string else '\U0000E2D5') }} - {% elif repeat.item.entity and repeat.item.entity.split('.') | count > 1 %} - {{ nextion.icons.buttons[repeat.item.entity.split('.')[0] if repeat.item.entity else 'unknown'] }} + {{ nextion.icons.all[repeat.item.icon.split(":")[1]] | default(repeat.item.icon if repeat.item.icon is string else "\U0000E2D5") }} + {% elif repeat.item.entity and repeat.item.entity.split(".") | count > 1 %} + {{ nextion.icons.buttons[repeat.item.entity.split(".")[0] if repeat.item.entity else "unknown"] }} {% else %}{{ nextion.icons.buttons.unknown }} {% endif %} # LABEL Value - btn_label: "{{ repeat.item.name }}" + btn_label: '{{ repeat.item.name }}' # BRIGHTNESS Value btn_bri_txt: >- {% if not current_entity_state_available %} 0 - {% elif item_domain == 'light' and current_entity_state == 'on' and state_attr(repeat.item.entity, 'brightness') != None %} - {{ (state_attr(repeat.item.entity, 'brightness') | int * 100 /255) | round(0) }}% - {% elif item_domain == 'cover' and current_entity_state in ['open', 'opening', 'closing'] and state_attr(repeat.item.entity, 'current_position') != None %} - {{ (state_attr(repeat.item.entity, 'current_position') | int(100)) | round(0) }}% - {% elif item_domain == 'climate' and current_entity_state != 'off' and state_attr(repeat.item.entity, "current_temperature") != None %} - {{ (state_attr(repeat.item.entity, "current_temperature") | float) | round(0) }}{{ temperature_units }} + {% elif item_domain == "light" and current_entity_state == "on" and state_attr(repeat.item.entity, "brightness") != None %} + {{ (state_attr(repeat.item.entity, "brightness") | int * 100 /255) | round(0) }}% + {% elif item_domain == "cover" and current_entity_state in ["open", "opening", "closing"] and state_attr(repeat.item.entity, "current_position") != None %} + {{ (state_attr(repeat.item.entity, "current_position") | int(100)) | round(0) }}% + {% elif item_domain == "climate" and current_entity_state != "off" and state_attr(repeat.item.entity, 'current_temperature') != None %} + {{ (state_attr(repeat.item.entity, 'current_temperature') | float) | round(0) }}{{ temperature_units }} {% else -%} 0 {% endif -%} - *delay-default - - service: "{{ nextion.commands.set_button }}" + - service: '{{ nextion.commands.set_button }}' data: - btn_id: "{{ repeat.item.page }}.{{ repeat.item.component }}" - btn_pic: "{{ btn_pic }}" - btn_bg: "{{ btn_bg }}" - btn_icon_font: "{{ btn_icon_font }}" - btn_txt_font: "{{ btn_txt_font }}" - btn_bri_font: "{{ btn_bri_font }}" - btn_icon: "{{ btn_icon }}" - btn_label: "{{ btn_label }}" - btn_bri_txt: "{{ btn_bri_txt }}" + btn_id: '{{ repeat.item.page }}.{{ repeat.item.component }}' + btn_pic: '{{ btn_pic }}' + btn_bg: '{{ btn_bg }}' + btn_icon_font: '{{ btn_icon_font }}' + btn_txt_font: '{{ btn_txt_font }}' + btn_bri_font: '{{ btn_bri_font }}' + btn_icon: '{{ btn_icon }}' + btn_label: '{{ btn_label }}' + btn_bri_txt: '{{ btn_bri_txt }}' continue_on_error: true - - if: "{{ item_domain in ['button','input_button','scene'] and trigger.id is match 'current_state_entity' }}" + - if: '{{ item_domain in ["button","input_button","scene"] and trigger.id is match "current_state_entity" }}' then: - delay: - milliseconds: "1000" - - service: "{{ nextion.commands.set_button }}" + milliseconds: '1000' + - service: '{{ nextion.commands.set_button }}' data: - btn_id: "{{ repeat.item.page }}.{{ repeat.item.component }}" - btn_pic: "{{ nextion.pics.button.off }}" - btn_bg: "{{ nextion.colors.grey_dark }}" + btn_id: '{{ repeat.item.page }}.{{ repeat.item.component }}' + btn_pic: '{{ nextion.pics.button.off }}' + btn_bg: '{{ nextion.colors.grey_dark }}' btn_icon_font: > {{ repeat.item.icon_color_rgb if is_number(repeat.item.icon_color_rgb) else ((repeat.item.icon_color_rgb[0] //(2**3)) *(2**11))+((repeat.item.icon_color_rgb[1] //(2**2)) *(2**5))+(repeat.item.icon_color_rgb[2] //(2**3)) }} - btn_txt_font: "{{ nextion.colors.white }}" - btn_bri_font: "{{ btn_bri_font }}" - btn_icon: "{{ btn_icon }}" - btn_label: "{{ btn_label }}" - btn_bri_txt: "{{ btn_bri_txt }}" + btn_txt_font: '{{ nextion.colors.white }}' + btn_bri_font: '{{ btn_bri_font }}' + btn_icon: '{{ btn_icon }}' + btn_label: '{{ btn_label }}' + btn_bri_txt: '{{ btn_bri_txt }}' continue_on_error: true ###### SHOW All component when page loading done ##### - *delay-default - - service: "{{ nextion.commands.show_all }}" + - service: '{{ nextion.commands.show_all }}' continue_on_error: true ## PAGE LIGHTSETTINGS ## - alias: Light settings page - conditions: "{{ nspanel_event.page == nextion.pages.light }}" + conditions: '{{ nspanel_event.page == nextion.pages.light }}' sequence: - *variables-settings_entity - - if: "{{ settings_entity_domain == 'light' }}" + - if: '{{ settings_entity_domain == "light" }}' then: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.light_name message: > @@ -4645,11 +4660,11 @@ action: if settings_entity_dict.name is defined and settings_entity_dict.name is string and settings_entity_dict.name | length > 0 else ( - state_attr(settings_entity_dict.entity, 'friendly_name') - if state_attr(settings_entity_dict.entity, 'friendly_name') | length > 0 + state_attr(settings_entity_dict.entity, "friendly_name") + if state_attr(settings_entity_dict.entity, "friendly_name") | length > 0 else ( - 'Light' ~ (': ' ~ settings_entity_dict.component) + "Light" ~ (": " ~ settings_entity_dict.component) if settings_entity_dict.component is string and settings_entity_dict.component | length > 0 ) ) @@ -4657,18 +4672,18 @@ action: continue_on_error: true ##### LIGHT ICON - ON / OFF ##### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.icon_state message: > {{ - nextion.icons.all[settings_entity_dict.icon.split(':')[1]] | default(settings_entity_dict.icon if settings_entity_dict.icon is defined and settings_entity_dict.icon is string else nextion.icons.buttons.light) - if settings_entity_dict.icon not in ['unavailable', 'unknown', None] and settings_entity_dict.icon | length > 0 + nextion.icons.all[settings_entity_dict.icon.split(":")[1]] | default(settings_entity_dict.icon if settings_entity_dict.icon is defined and settings_entity_dict.icon is string else nextion.icons.buttons.light) + if settings_entity_dict.icon not in ["unavailable", "unknown", None] and settings_entity_dict.icon | length > 0 else nextion.icons.buttons.light }} continue_on_error: true - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: lightsettings.icon_state message: > @@ -4679,517 +4694,517 @@ action: else ((settings_entity_dict.icon_color_rgb[0] //(2**3)) *(2**11))+((settings_entity_dict.icon_color_rgb[1] //(2**2)) *(2**5))+(settings_entity_dict.icon_color_rgb[2] //(2**3)) ) - if is_state(settings_entity_dict.entity, 'on') + if is_state(settings_entity_dict.entity, "on") else nextion.colors.grey_light }} continue_on_error: true ##### LIGHT State ##### - *delay-default - - if: "{{ state_attr(settings_entity_dict.entity, 'brightness') != none }}" + - if: '{{ state_attr(settings_entity_dict.entity, "brightness") != none }}' then: - - service: "{{ nextion.commands.value }}" + - service: '{{ nextion.commands.value }}' data: component: lightsettings.lightslider - message: "{{ (state_attr(settings_entity_dict.entity, 'brightness') | int * 100 / 255) | round(0) }}" + message: '{{ (state_attr(settings_entity_dict.entity, "brightness") | int * 100 / 255) | round(0) }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.light_value - message: "{{ (state_attr(settings_entity_dict.entity, 'brightness') | int * 100 / 255) | round(0) }}%" + message: '{{ (state_attr(settings_entity_dict.entity, "brightness") | int * 100 / 255) | round(0) }}%' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.light_value_2 - message: "{{ (state_attr(settings_entity_dict.entity, 'brightness') | int * 100 /255) | round(0) }}%" + message: '{{ (state_attr(settings_entity_dict.entity, "brightness") | int * 100 /255) | round(0) }}%' continue_on_error: true else: - - service: "{{ nextion.commands.value }}" + - service: '{{ nextion.commands.value }}' data: component: lightsettings.lightslider - message: '0' + message: "0" continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.light_value - message: '0 %' + message: "0 %" continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.light_value_2 - message: '0 %' + message: "0 %" continue_on_error: true ##### LIGHT Check Color_Temp Value is available when yes send some current Values ##### - - if: "{{ state_attr(settings_entity_dict.entity, 'color_temp') != none }}" + - if: '{{ state_attr(settings_entity_dict.entity, "color_temp") != none }}' then: - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.temp_value - message: "{{ (state_attr(settings_entity_dict.entity, 'color_temp') | int ) | round(0) }}" + message: '{{ (state_attr(settings_entity_dict.entity, "color_temp") | int ) | round(0) }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: lightsettings.temp_value_2 - message: "{{ (state_attr(settings_entity_dict.entity, 'color_temp') | int ) | round(0) }}" + message: '{{ (state_attr(settings_entity_dict.entity, "color_temp") | int ) | round(0) }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.value }}" + - service: '{{ nextion.commands.value }}' data: component: lightsettings.tempslider - message: "{{ (state_attr(settings_entity_dict.entity, 'color_temp') | int ) | round(0) }}" + message: '{{ (state_attr(settings_entity_dict.entity, "color_temp") | int ) | round(0) }}' continue_on_error: true ## PAGE COVERSETTINGS ## - alias: Cover settings page - conditions: "{{ nspanel_event.page == nextion.pages.cover }}" + conditions: '{{ nspanel_event.page == nextion.pages.cover }}' sequence: ##### COVER - OPEN / CLOSE ##### - *variables-settings_entity - - if: "{{ settings_entity_domain == 'cover' }}" + - if: '{{ settings_entity_domain == "cover" }}' then: - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: coversettings.icon_state message: > {{ - nextion.icons.all[settings_entity_dict.icon.split(':')[1]] | default(settings_entity_dict.icon if settings_entity_dict.icon is defined and settings_entity_dict.icon is string else nextion.icons.buttons.cover) - if settings_entity_dict.icon not in ['unavailable', 'unknown', None] and settings_entity_dict.icon | length > 0 + nextion.icons.all[settings_entity_dict.icon.split(":")[1]] | default(settings_entity_dict.icon if settings_entity_dict.icon is defined and settings_entity_dict.icon is string else nextion.icons.buttons.cover) + if settings_entity_dict.icon not in ["unavailable", "unknown", None] and settings_entity_dict.icon | length > 0 else nextion.icons.buttons.cover }} continue_on_error: true - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: coversettings.icon_state - message: "{{ (settings_entity_dict.icon_color_rgb if is_number(settings_entity_dict.icon_color_rgb) else ((settings_entity_dict.icon_color_rgb[0] //(2**3)) *(2**11))+((settings_entity_dict.icon_color_rgb[1] //(2**2)) *(2**5))+(settings_entity_dict.icon_color_rgb[2] //(2**3))) if states(settings_entity_dict.entity) in ['open', 'opening'] else nextion.colors.grey_light }}" + message: '{{ (settings_entity_dict.icon_color_rgb if is_number(settings_entity_dict.icon_color_rgb) else ((settings_entity_dict.icon_color_rgb[0] //(2**3)) *(2**11))+((settings_entity_dict.icon_color_rgb[1] //(2**2)) *(2**5))+(settings_entity_dict.icon_color_rgb[2] //(2**3))) if states(settings_entity_dict.entity) in ["open", "opening"] else nextion.colors.grey_light }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: coversettings.cover_name - message: "{{ settings_entity_dict.entity }}" + message: '{{ settings_entity_dict.entity }}' continue_on_error: true ##### COVER State - - service: "{{ nextion.commands.value }}" + - service: '{{ nextion.commands.value }}' data: component: coversettings.coverslider - message: "{{ (state_attr(settings_entity_dict.entity, 'current_position') | int ) | round(0) }}" + message: '{{ (state_attr(settings_entity_dict.entity, "current_position") | int ) | round(0) }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: coversettings.cover_value - message: "{{ (state_attr(settings_entity_dict.entity, 'current_position') | int ) | round(0) }} %" + message: '{{ (state_attr(settings_entity_dict.entity, "current_position") | int ) | round(0) }} %' continue_on_error: true ##### COVER Battery ICON Yes / NO ##### - variables: battery_level: > - {% if state_attr(settings_entity_dict.entity, 'battery') | default('unavailable') not in ['unavailable', 'unknown', None] %} - {{ state_attr(settings_entity_dict.entity, 'battery') | default('unavailable') }} - {% elif expand(device_entities(device_id(settings_entity_dict.entity))) | selectattr('attributes.device_class', 'defined') | selectattr('attributes.device_class', 'eq', 'battery') | map(attribute='state') | map('float') | list | count > 0 %} - {{ expand(device_entities(device_id(settings_entity_dict.entity))) | selectattr('attributes.device_class', 'defined') | selectattr('attributes.device_class', 'eq', 'battery') | map(attribute='state') | map('float') | list | first }} - {% elif states(settings_entity_dict.entity | replace('cover.','sensor.') ~ '_battery') | default('unavailable') not in ['unavailable', 'unknown', None] %} - {{ states(settings_entity_dict.entity | replace('cover.','sensor.') ~ '_battery') | default('unavailable') }} - {% elif states(settings_entity_dict.entity | replace('cover.','sensor.') | replace('cover', 'battery')) | default('unavailable') not in ['unavailable', 'unknown', None] %} - {{ states(settings_entity_dict.entity | replace('cover.','sensor.') | replace('cover', 'battery')) | default('unavailable') }} + {% if state_attr(settings_entity_dict.entity, "battery") | default("unavailable") not in ["unavailable", "unknown", None] %} + {{ state_attr(settings_entity_dict.entity, "battery") | default("unavailable") }} + {% elif expand(device_entities(device_id(settings_entity_dict.entity))) | selectattr("attributes.device_class", "defined") | selectattr("attributes.device_class", "eq", "battery") | map(attribute="state") | map("float") | list | count > 0 %} + {{ expand(device_entities(device_id(settings_entity_dict.entity))) | selectattr("attributes.device_class", "defined") | selectattr("attributes.device_class", "eq", "battery") | map(attribute="state") | map("float") | list | first }} + {% elif states(settings_entity_dict.entity | replace("cover.","sensor.") ~ "_battery") | default("unavailable") not in ["unavailable", "unknown", None] %} + {{ states(settings_entity_dict.entity | replace("cover.","sensor.") ~ "_battery") | default("unavailable") }} + {% elif states(settings_entity_dict.entity | replace("cover.","sensor.") | replace("cover", "battery")) | default("unavailable") not in ["unavailable", "unknown", None] %} + {{ states(settings_entity_dict.entity | replace("cover.","sensor.") | replace("cover", "battery")) | default("unavailable") }} {% else %} unavailable {% endif %} - - if: "{{ is_number(battery_level) }}" + - if: '{{ is_number(battery_level) }}' then: - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: coversettings.battery_value - message: "{{ battery_level | round(0) }} %" + message: '{{ battery_level | round(0) }} %' continue_on_error: true ### ICON Battery Font Color ### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: coversettings.battery_icon - message: "{{ nextion.colors.grey_super_light }}" + message: '{{ nextion.colors.grey_super_light }}' continue_on_error: true ### ICON Battery Font ### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: coversettings.battery_icon - message: "{{ nextion.icons.battery }}" + message: '{{ nextion.icons.battery }}' continue_on_error: true ## PAGE CLIMATE ## - alias: Climate page - conditions: "{{ nspanel_event.page == nextion.pages.climate }}" + conditions: '{{ nspanel_event.page == nextion.pages.climate }}' sequence: - *variables-settings_entity - variables: settings_entity_dict: > - {% if settings_entity_dict.entity is not defined and settings_entity_dict.page == nextion.pages.home and settings_entity_dict.component == "climate" %} + {% if settings_entity_dict.entity is not defined and settings_entity_dict.page == nextion.pages.home and settings_entity_dict.component == 'climate' %} { - "page": "{{ settings_entity_dict.page }}", - "entity": "{{ climate }}", - "name": "{{ state_attr(climate, 'friendly_name') | default(mui[language].no_name) if climate is string and state_attr(climate, 'friendly_name') is string and state_attr(climate, 'friendly_name') | length > 0 else climate }}" + 'page': '{{ settings_entity_dict.page }}', + 'entity': '{{ climate }}', + 'name': '{{ state_attr(climate, "friendly_name") | default(mui[language].no_name) if climate is string and state_attr(climate, "friendly_name") is string and state_attr(climate, "friendly_name") | length > 0 else climate }}' } {% else %}{{ settings_entity_dict }} {% endif %} - settings_entity_domain: "{{ settings_entity_dict.entity.split('.')[0] if settings_entity_dict.entity is defined and settings_entity_dict.entity is string and settings_entity_dict.entity.split('.') | count > 0 else 'unknown' }}" - - condition: "{{ settings_entity_domain == 'climate' }}" + settings_entity_domain: '{{ settings_entity_dict.entity.split(".")[0] if settings_entity_dict.entity is defined and settings_entity_dict.entity is string and settings_entity_dict.entity.split(".") | count > 0 else "unknown" }}' + - condition: '{{ settings_entity_domain == "climate" }}' - variables: - hvac_mode: "{{ states(settings_entity_dict.entity) | default('unavailable') if settings_entity_dict.entity is string else 'unavailable' }}" - outdoor_temp_state: "{{ states(outdoortemp) | default('unavailable') if outdoortemp is string else 'unavailable' }}" - outdoor_temp: "{{ outdoor_temp_state if is_number(outdoor_temp_state) else state_attr(weather_entity, 'temperature') | default('unavailable') if weather_entity is string else 'unavailable' }}" - heating_state: "{{ mui[language].climate.states.off if hvac_mode == 'off' else mui[language].climate.states.on }}" - - service: "{{ nextion.commands.text_printf }}" + hvac_mode: '{{ states(settings_entity_dict.entity) | default("unavailable") if settings_entity_dict.entity is string else "unavailable" }}' + outdoor_temp_state: '{{ states(outdoortemp) | default("unavailable") if outdoortemp is string else "unavailable" }}' + outdoor_temp: '{{ outdoor_temp_state if is_number(outdoor_temp_state) else state_attr(weather_entity, "temperature") | default("unavailable") if weather_entity is string else "unavailable" }}' + heating_state: '{{ mui[language].climate.states.off if hvac_mode == "off" else mui[language].climate.states.on }}' + - service: '{{ nextion.commands.text_printf }}' data: component: climate.climate_label - message: "{{ settings_entity_dict.name }}" + message: '{{ settings_entity_dict.name }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: outdoor_temp - message: "{{ (outdoor_temp | round(1) ~ temperature_units) if is_number(outdoor_temp) else (mui[language].unavailable if outdoor_temp in ['unavailable', 'unknown', None] else outdoor_temp) }}" + message: '{{ (outdoor_temp | round(1) ~ temperature_units) if is_number(outdoor_temp) else (mui[language].unavailable if outdoor_temp in ["unavailable", "unknown", None] else outdoor_temp) }}' continue_on_error: true - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: current_temp - message: "{{ (state_attr(settings_entity_dict.entity, 'current_temperature') | round(1) ~ temperature_units) if is_number(state_attr(settings_entity_dict.entity, 'current_temperature')) else '' }}" # mui[language].unavailable? + message: '{{ (state_attr(settings_entity_dict.entity, "current_temperature") | round(1) ~ temperature_units) if is_number(state_attr(settings_entity_dict.entity, "current_temperature")) else "" }}' # mui[language].unavailable? continue_on_error: true - - if: "{{ hvac_mode != 'off' and is_number(state_attr(settings_entity_dict.entity, 'temperature')) }}" + - if: '{{ hvac_mode != "off" and is_number(state_attr(settings_entity_dict.entity, "temperature")) }}' then: - variables: - target_temp: "{{state_attr(settings_entity_dict.entity, 'temperature') | round(1)}}" - - service: "{{ nextion.commands.thermostat_cycle }}" + target_temp: '{{state_attr(settings_entity_dict.entity, "temperature") | round(1)}}' + - service: '{{ nextion.commands.thermostat_cycle }}' data: - value: "{{ target_temp }}" + value: '{{ target_temp }}' continue_on_error: true else: - - service: "{{ nextion.commands.thermostat_cycle }}" + - service: '{{ nextion.commands.thermostat_cycle }}' data: - value: "0" + value: '0' continue_on_error: true - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: target_temp - message: " " + message: ' ' continue_on_error: true - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: heating_state - message: "{{ heating_state }}" + message: '{{ heating_state }}' continue_on_error: true # HVAC Button PIC - variables: - heating_bt_pic: "{{ nextion.pics.heating.button.off if hvac_mode == 'off' else nextion.pics.heating.button.on }}" + heating_bt_pic: '{{ nextion.pics.heating.button.off if hvac_mode == "off" else nextion.pics.heating.button.on }}' - *delay-default - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: cmd: heating_bt_pic.pic={{ heating_bt_pic }} continue_on_error: true - variables: - hotwatercharge_state: "{{ states(hotwatercharge) | default('unavailable') if hotwatercharge is string else 'unavailable' }}" - hotwatertemp_state: "{{ states(hotwatertemp) | default('unavailable') if hotwatertemp is string else 'unavailable' }}" - hotw_bt_pic: "{{ nextion.pics.hvac.button[hotwatercharge_state] | default(nextion.pics.hvac.button.blank) if hotwatercharge_state not in ['unavailable', 'unknown', None] else nextion.pics.hvac.button.blank }}" + hotwatercharge_state: '{{ states(hotwatercharge) | default("unavailable") if hotwatercharge is string else "unavailable" }}' + hotwatertemp_state: '{{ states(hotwatertemp) | default("unavailable") if hotwatertemp is string else "unavailable" }}' + hotw_bt_pic: '{{ nextion.pics.hvac.button[hotwatercharge_state] | default(nextion.pics.hvac.button.blank) if hotwatercharge_state not in ["unavailable", "unknown", None] else nextion.pics.hvac.button.blank }}' - *delay-default - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: cmd: hotw_bt_pic.pic={{ hotw_bt_pic }} continue_on_error: true - - if: "{{ hotwatertemp_state not in ['unavailable', 'unknown', None] }}" + - if: '{{ hotwatertemp_state not in ["unavailable", "unknown", None] }}' then: - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: climate.hotwater_temp - message: "{{ (hotwatertemp_state | round(1) ~ temperature_units) if is_number(hotwatertemp_state) else hotwatertemp_state }}" + message: '{{ (hotwatertemp_state | round(1) ~ temperature_units) if is_number(hotwatertemp_state) else hotwatertemp_state }}' continue_on_error: true ## ENTITY PAGES 01 - 04 ## - alias: Entity pages - conditions: "{{ nspanel_event.page in nextion.pages.entitypages }}" + conditions: '{{ nspanel_event.page in nextion.pages.entitypages }}' sequence: &refresh-entity_pages - &variables-entity_pages variables: ##### Entity pages ##### entity_pages_labels: - - label: !input "entity_page01_label" - - label: !input "entity_page02_label" - - label: !input "entity_page03_label" - - label: !input "entity_page04_label" + - label: !input 'entity_page01_label' + - label: !input 'entity_page02_label' + - label: !input 'entity_page03_label' + - label: !input 'entity_page04_label' entity_pages_entities: - - entity: !input "entities_entity01" - name: !input "entities_entity01_name" - icon: !input "entities_entity01_icon" + - entity: !input 'entities_entity01' + name: !input 'entities_entity01_name' + icon: !input 'entities_entity01_icon' page: entitypage01 component: value01 - - entity: !input "entities_entity02" - name: !input "entities_entity02_name" - icon: !input "entities_entity02_icon" + - entity: !input 'entities_entity02' + name: !input 'entities_entity02_name' + icon: !input 'entities_entity02_icon' page: entitypage01 component: value02 - - entity: !input "entities_entity03" - name: !input "entities_entity03_name" - icon: !input "entities_entity03_icon" + - entity: !input 'entities_entity03' + name: !input 'entities_entity03_name' + icon: !input 'entities_entity03_icon' page: entitypage01 component: value03 - - entity: !input "entities_entity04" - name: !input "entities_entity04_name" - icon: !input "entities_entity04_icon" + - entity: !input 'entities_entity04' + name: !input 'entities_entity04_name' + icon: !input 'entities_entity04_icon' page: entitypage01 component: value04 - - entity: !input "entities_entity05" - name: !input "entities_entity05_name" - icon: !input "entities_entity05_icon" + - entity: !input 'entities_entity05' + name: !input 'entities_entity05_name' + icon: !input 'entities_entity05_icon' page: entitypage01 component: value05 - - entity: !input "entities_entity06" - name: !input "entities_entity06_name" - icon: !input "entities_entity06_icon" + - entity: !input 'entities_entity06' + name: !input 'entities_entity06_name' + icon: !input 'entities_entity06_icon' page: entitypage01 component: value06 - - entity: !input "entities_entity07" - name: !input "entities_entity07_name" - icon: !input "entities_entity07_icon" + - entity: !input 'entities_entity07' + name: !input 'entities_entity07_name' + icon: !input 'entities_entity07_icon' page: entitypage01 component: value07 - - entity: !input "entities_entity08" - name: !input "entities_entity08_name" - icon: !input "entities_entity08_icon" + - entity: !input 'entities_entity08' + name: !input 'entities_entity08_name' + icon: !input 'entities_entity08_icon' page: entitypage01 component: value08 - - entity: !input "entities_entity09" - name: !input "entities_entity09_name" - icon: !input "entities_entity09_icon" + - entity: !input 'entities_entity09' + name: !input 'entities_entity09_name' + icon: !input 'entities_entity09_icon' page: entitypage02 component: value01 - - entity: !input "entities_entity10" - name: !input "entities_entity10_name" - icon: !input "entities_entity10_icon" + - entity: !input 'entities_entity10' + name: !input 'entities_entity10_name' + icon: !input 'entities_entity10_icon' page: entitypage02 component: value02 - - entity: !input "entities_entity11" - name: !input "entities_entity11_name" - icon: !input "entities_entity11_icon" + - entity: !input 'entities_entity11' + name: !input 'entities_entity11_name' + icon: !input 'entities_entity11_icon' page: entitypage02 component: value03 - - entity: !input "entities_entity12" - name: !input "entities_entity12_name" - icon: !input "entities_entity12_icon" + - entity: !input 'entities_entity12' + name: !input 'entities_entity12_name' + icon: !input 'entities_entity12_icon' page: entitypage02 component: value04 - - entity: !input "entities_entity13" - name: !input "entities_entity13_name" - icon: !input "entities_entity13_icon" + - entity: !input 'entities_entity13' + name: !input 'entities_entity13_name' + icon: !input 'entities_entity13_icon' page: entitypage02 component: value05 - - entity: !input "entities_entity14" - name: !input "entities_entity14_name" - icon: !input "entities_entity14_icon" + - entity: !input 'entities_entity14' + name: !input 'entities_entity14_name' + icon: !input 'entities_entity14_icon' page: entitypage02 component: value06 - - entity: !input "entities_entity15" - name: !input "entities_entity15_name" - icon: !input "entities_entity15_icon" + - entity: !input 'entities_entity15' + name: !input 'entities_entity15_name' + icon: !input 'entities_entity15_icon' page: entitypage02 component: value07 - - entity: !input "entities_entity16" - name: !input "entities_entity16_name" - icon: !input "entities_entity16_icon" + - entity: !input 'entities_entity16' + name: !input 'entities_entity16_name' + icon: !input 'entities_entity16_icon' page: entitypage02 component: value08 - - entity: !input "entities_entity17" - name: !input "entities_entity17_name" - icon: !input "entities_entity17_icon" + - entity: !input 'entities_entity17' + name: !input 'entities_entity17_name' + icon: !input 'entities_entity17_icon' page: entitypage03 component: value01 - - entity: !input "entities_entity18" - name: !input "entities_entity18_name" - icon: !input "entities_entity18_icon" + - entity: !input 'entities_entity18' + name: !input 'entities_entity18_name' + icon: !input 'entities_entity18_icon' page: entitypage03 component: value02 - - entity: !input "entities_entity19" - name: !input "entities_entity19_name" - icon: !input "entities_entity19_icon" + - entity: !input 'entities_entity19' + name: !input 'entities_entity19_name' + icon: !input 'entities_entity19_icon' page: entitypage03 component: value03 - - entity: !input "entities_entity20" - name: !input "entities_entity20_name" - icon: !input "entities_entity20_icon" + - entity: !input 'entities_entity20' + name: !input 'entities_entity20_name' + icon: !input 'entities_entity20_icon' page: entitypage03 component: value04 - - entity: !input "entities_entity21" - name: !input "entities_entity21_name" - icon: !input "entities_entity21_icon" + - entity: !input 'entities_entity21' + name: !input 'entities_entity21_name' + icon: !input 'entities_entity21_icon' page: entitypage03 component: value05 - - entity: !input "entities_entity22" - name: !input "entities_entity22_name" - icon: !input "entities_entity22_icon" + - entity: !input 'entities_entity22' + name: !input 'entities_entity22_name' + icon: !input 'entities_entity22_icon' page: entitypage03 component: value06 - - entity: !input "entities_entity23" - name: !input "entities_entity23_name" - icon: !input "entities_entity23_icon" + - entity: !input 'entities_entity23' + name: !input 'entities_entity23_name' + icon: !input 'entities_entity23_icon' page: entitypage03 component: value07 - - entity: !input "entities_entity24" - name: !input "entities_entity24_name" - icon: !input "entities_entity24_icon" + - entity: !input 'entities_entity24' + name: !input 'entities_entity24_name' + icon: !input 'entities_entity24_icon' page: entitypage03 component: value08 - - entity: !input "entities_entity25" - name: !input "entities_entity25_name" - icon: !input "entities_entity25_icon" + - entity: !input 'entities_entity25' + name: !input 'entities_entity25_name' + icon: !input 'entities_entity25_icon' page: entitypage04 component: value01 - - entity: !input "entities_entity26" - name: !input "entities_entity26_name" - icon: !input "entities_entity26_icon" + - entity: !input 'entities_entity26' + name: !input 'entities_entity26_name' + icon: !input 'entities_entity26_icon' page: entitypage04 component: value02 - - entity: !input "entities_entity27" - name: !input "entities_entity27_name" - icon: !input "entities_entity27_icon" + - entity: !input 'entities_entity27' + name: !input 'entities_entity27_name' + icon: !input 'entities_entity27_icon' page: entitypage04 component: value03 - - entity: !input "entities_entity28" - name: !input "entities_entity28_name" - icon: !input "entities_entity28_icon" + - entity: !input 'entities_entity28' + name: !input 'entities_entity28_name' + icon: !input 'entities_entity28_icon' page: entitypage04 component: value04 - - entity: !input "entities_entity29" - name: !input "entities_entity29_name" - icon: !input "entities_entity29_icon" + - entity: !input 'entities_entity29' + name: !input 'entities_entity29_name' + icon: !input 'entities_entity29_icon' page: entitypage04 component: value05 - - entity: !input "entities_entity30" - name: !input "entities_entity30_name" - icon: !input "entities_entity30_icon" + - entity: !input 'entities_entity30' + name: !input 'entities_entity30_name' + icon: !input 'entities_entity30_icon' page: entitypage04 component: value06 - - entity: !input "entities_entity31" - name: !input "entities_entity31_name" - icon: !input "entities_entity31_icon" + - entity: !input 'entities_entity31' + name: !input 'entities_entity31_name' + icon: !input 'entities_entity31_icon' page: entitypage04 component: value07 - - entity: !input "entities_entity32" - name: !input "entities_entity32_name" - icon: !input "entities_entity32_icon" + - entity: !input 'entities_entity32' + name: !input 'entities_entity32_name' + icon: !input 'entities_entity32_icon' page: entitypage04 component: value08 - variables: - entity_page_index: "{{ (nspanel_event.page[-2:] | int(-1)) - 1 }}" - first_entity: "{{ entity_page_index * 8 }}" - last_entity: "{{ first_entity + 8 }}" + entity_page_index: '{{ (nspanel_event.page[-2:] | int(-1)) - 1 }}' + first_entity: '{{ entity_page_index * 8 }}' + last_entity: '{{ first_entity + 8 }}' ##### Entity page - Label ##### - - if: "{{ entity_pages_labels[entity_page_index].label | length > 0 }}" + - if: '{{ entity_pages_labels[entity_page_index].label | length > 0 }}' then: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ 'entity%02d_label' | format(entity_page_index + 1) }}" - message: "{{ entity_pages_labels[entity_page_index].label }}" + component: '{{ "entity%02d_label" | format(entity_page_index + 1) }}' + message: '{{ entity_pages_labels[entity_page_index].label }}' continue_on_error: true - *delay-default ##### Entities ##### - repeat: - for_each: "{{ entity_pages_entities[first_entity:last_entity] }}" + for_each: '{{ entity_pages_entities[first_entity:last_entity] }}' sequence: &update-entity_page_entity - - if: "{{ repeat.item.entity is string and repeat.item.entity | length > 0 }}" + - if: '{{ repeat.item.entity is string and repeat.item.entity | length > 0 }}' then: - variables: - repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}" + repeat_item_state: '{{ states(repeat.item.entity) | default("unavailable") }}' repeat_item_icon: > - {% if repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon) }} - {% elif state_attr(repeat.item.entity, 'icon') | default('') not in ['unavailable', 'unknown', '', None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, 'icon').split(':')[1]] | default(None) }} + {% if repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(":")[1]] | default(repeat.item.icon) }} + {% elif state_attr(repeat.item.entity, "icon") | default("") not in ["unavailable", "unknown", "", None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, "icon").split(":")[1]] | default(None) }} {% endif %} - - service: "{{ nextion.commands.set_entity }}" + - service: '{{ nextion.commands.set_entity }}' data: - ent_id: "{{ repeat.item.page }}.{{ repeat.item.component }}" - ent_icon: "{{ repeat_item_icon if repeat_item_icon else nextion.icons.blank }}" + ent_id: '{{ repeat.item.page }}.{{ repeat.item.component }}' + ent_icon: '{{ repeat_item_icon if repeat_item_icon else nextion.icons.blank }}' ent_label: >- {%- if repeat.item.name | length > 0 -%} {{ repeat.item.name }} - {%- elif repeat_item_state in ['unavailable', 'unknown', None] -%} {{ repeat.item.entity }} - {%- else -%} {{ state_attr(repeat.item.entity, 'friendly_name') | default(mui[language].no_name) }} + {%- elif repeat_item_state in ["unavailable", "unknown", None] -%} {{ repeat.item.entity }} + {%- else -%} {{ state_attr(repeat.item.entity, "friendly_name") | default(mui[language].no_name) }} {%- endif -%} - ent_value: "{{ repeat_item_state ~ ((state_attr(repeat.item.entity, 'unit_of_measurement') | default('')) if state_attr(repeat.item.entity, 'unit_of_measurement') else '') }}" + ent_value: '{{ repeat_item_state ~ ((state_attr(repeat.item.entity, "unit_of_measurement") | default("")) if state_attr(repeat.item.entity, "unit_of_measurement") else "") }}' continue_on_error: true ## PAGE WEATHER (WEATHER01 to WEATHER05) ## - alias: Weather pages - conditions: "{{ nspanel_event.page in nextion.pages.weatherpages }}" + conditions: '{{ nspanel_event.page in nextion.pages.weatherpages }}' sequence: - variables: - weather_attribution: "{{ state_attr(weather_entity, 'attribution') if weather_entity is string }}" + weather_attribution: '{{ state_attr(weather_entity, "attribution") if weather_entity is string }}' weather_type: > {% if not weather_attribution %} unavailable - {% elif 'AccuWeather' in weather_attribution %} AccuWeather - {% elif 'OpenWeatherMap' in weather_attribution %} OpenWeather - {% elif 'SMHI' in weather_attribution %} SMHI - {% elif 'met.no' in weather_attribution %} Met.no - {% elif 'OpenWeatherMap' in weather_attribution %} OpenWeather + {% elif "AccuWeather" in weather_attribution %} AccuWeather + {% elif "OpenWeatherMap" in weather_attribution %} OpenWeather + {% elif "SMHI" in weather_attribution %} SMHI + {% elif "met.no" in weather_attribution %} Met.no + {% elif "OpenWeatherMap" in weather_attribution %} OpenWeather {% else %} Other {% endif %} weather_units: - hours_of_sun: "{{ state_attr(weather_entity, 'hours_of_sun_unit') | default('h') if weather_entity is string and state_attr(weather_entity, 'hours_of_sun_unit') else 'h' }}" - precipitation: "{{ state_attr(weather_entity, 'precipitation_unit') | default('') if weather_entity is string and state_attr(weather_entity, 'precipitation_unit') }}" - precipitation_probability: "{{ state_attr(weather_entity, 'precipitation_probability_unit') | default('%') if weather_entity is string and state_attr(weather_entity, 'precipitation_probability_unit') else '%' }}" - pressure: "{{ state_attr(weather_entity, 'pressure_unit') | default('') if weather_entity is string and state_attr(weather_entity, 'pressure_unit') }}" - #temperature: "{{ state_attr(weather_entity, 'temperature_unit') | default('°') if weather_entity is string and state_attr(weather_entity, 'temperature_unit') else '°' }}" - thunderstorm_probability: "{{ state_attr(weather_entity, 'thunderstorm_probability_unit') | default('%') if weather_entity is string and state_attr(weather_entity, 'thunderstorm_probability_unit') else '%' }}" - uv_index: "{{ state_attr(weather_entity, 'uv_index_unit') | default('') if weather_entity is string and state_attr(weather_entity, 'uv_index_unit') }}" - #visibility: "{{ state_attr(weather_entity, 'visibility_unit') | default('') if weather_entity is string and state_attr(weather_entity, 'visibility_unit') }}" - wind_speed: "{{ state_attr(weather_entity, 'wind_speed_unit') | default('') if weather_entity is string and state_attr(weather_entity, 'wind_speed_unit') }}" - page_name: "{{ nspanel_event.page }}" - page_index: "{{ (page_name[-2:] | int(0)) - 1 }}" + hours_of_sun: '{{ state_attr(weather_entity, "hours_of_sun_unit") | default("h") if weather_entity is string and state_attr(weather_entity, "hours_of_sun_unit") else "h" }}' + precipitation: '{{ state_attr(weather_entity, "precipitation_unit") | default("") if weather_entity is string and state_attr(weather_entity, "precipitation_unit") }}' + precipitation_probability: '{{ state_attr(weather_entity, "precipitation_probability_unit") | default("%") if weather_entity is string and state_attr(weather_entity, "precipitation_probability_unit") else "%" }}' + pressure: '{{ state_attr(weather_entity, "pressure_unit") | default("") if weather_entity is string and state_attr(weather_entity, "pressure_unit") }}' + #temperature: '{{ state_attr(weather_entity, "temperature_unit") | default("°") if weather_entity is string and state_attr(weather_entity, "temperature_unit") else "°" }}' + thunderstorm_probability: '{{ state_attr(weather_entity, "thunderstorm_probability_unit") | default("%") if weather_entity is string and state_attr(weather_entity, "thunderstorm_probability_unit") else "%" }}' + uv_index: '{{ state_attr(weather_entity, "uv_index_unit") | default("") if weather_entity is string and state_attr(weather_entity, "uv_index_unit") }}' + #visibility: '{{ state_attr(weather_entity, "visibility_unit") | default("") if weather_entity is string and state_attr(weather_entity, "visibility_unit") }}' + wind_speed: '{{ state_attr(weather_entity, "wind_speed_unit") | default("") if weather_entity is string and state_attr(weather_entity, "wind_speed_unit") }}' + page_name: '{{ nspanel_event.page }}' + page_index: '{{ (page_name[-2:] | int(0)) - 1 }}' ##### Display relative day ##### - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ page_name }}.day" - message: "{{ (dict.values(mui[language].relative_day) | list)[page_index] }}" + component: '{{ page_name }}.day' + message: '{{ (dict.values(mui[language].relative_day) | list)[page_index] }}' continue_on_error: true - *delay-default ##### Display date (long) ##### - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ page_name }}.date" - message: "{{ (dict.values(mui[language].weekdays) | list)[(now() + timedelta(days= (page_index))).weekday()] ~ ', ' ~ as_timestamp(now() + timedelta(days= (page_index))) | timestamp_custom(date_format) }}" + component: '{{ page_name }}.date' + message: '{{ (dict.values(mui[language].weekdays) | list)[(now() + timedelta(days= (page_index))).weekday()] ~ ", " ~ as_timestamp(now() + timedelta(days= (page_index))) | timestamp_custom(date_format) }}' continue_on_error: true - *delay-default ##### Display weather data only when available ##### - variables: forecast_day: > - {{ state_attr(weather_entity, 'forecast') | default([]) - | selectattr('datetime', 'defined') - | selectattr('datetime', '>=', (today_at('00:00') + timedelta(days= page_index)) | as_timestamp | timestamp_local ) - | selectattr('datetime', '<', (today_at('00:00') + timedelta(days= (page_index+1))) | as_timestamp | timestamp_local ) + {{ state_attr(weather_entity, "forecast") | default([]) + | selectattr("datetime", "defined") + | selectattr("datetime", ">=", (today_at("00:00") + timedelta(days= page_index)) | as_timestamp | timestamp_local ) + | selectattr("datetime", "<", (today_at("00:00") + timedelta(days= (page_index+1))) | as_timestamp | timestamp_local ) | list }} - - if: "{{ forecast_day | count > 0 or page_index == 0 }}" + - if: '{{ forecast_day | count > 0 or page_index == 0 }}' then: # Display forecast - variables: - metnoweather: "{{ weather_type == 'Met.no' }}" - metnoweather_hourly_forecast: "{{ state_attr(weather_entity ~ '_hourly', 'forecast') if metnoweather and states(weather_entity ~ '_hourly') not in ['unavailable', 'unknown', None] }}" + metnoweather: '{{ weather_type == "Met.no" }}' + metnoweather_hourly_forecast: '{{ state_attr(weather_entity ~ "_hourly", "forecast") if metnoweather and states(weather_entity ~ "_hourly") not in ["unavailable", "unknown", None] }}' forecast_day: > {% if forecast_day | count > 0 %}{{ forecast_day }} {% elif metnoweather and metnoweather_hourly_forecast %} {{ metnoweather_hourly_forecast - | selectattr('datetime', 'defined') - | selectattr('datetime', '>=', (today_at('00:00') + timedelta(days= page_index)) | as_timestamp | timestamp_local ) - | selectattr('datetime', '<', (today_at('00:00') + timedelta(days= (page_index+1))) | as_timestamp | timestamp_local ) + | selectattr("datetime", "defined") + | selectattr("datetime", ">=", (today_at("00:00") + timedelta(days= page_index)) | as_timestamp | timestamp_local ) + | selectattr("datetime", "<", (today_at("00:00") + timedelta(days= (page_index+1))) | as_timestamp | timestamp_local ) | list }} {% endif %} @@ -5199,70 +5214,70 @@ action: {% elif page_index == 0 %} [ { - "condition": "{{ states(weather_entity) }}", - "temperature": "{{ state_attr(weather_entity, 'temperature') }}", - "wind_speed": "{{ state_attr(weather_entity, 'wind_speed') }}" + 'condition': '{{ states(weather_entity) }}', + 'temperature': '{{ state_attr(weather_entity, "temperature") }}', + 'wind_speed': '{{ state_attr(weather_entity, "wind_speed") }}' } ] {% endif %} - - if: "{{ forecast_day | count > 0 }}" + - if: '{{ forecast_day | count > 0 }}' then: - variables: - accuweather: "{{ weather_type == 'AccuWeather' }}" - accuweather_day_name: "{{ 'day_' ~ page_index }}" - accuweather_sensor_prefix: "{{ 'sensor.' ~ (weather_entity | replace('weather.','')) ~ '_' }}" - accuweather_sensor_sufix: "{{ '_' ~ page_index ~ 'd' }}" + accuweather: '{{ weather_type == "AccuWeather" }}' + accuweather_day_name: '{{ "day_" ~ page_index }}' + accuweather_sensor_prefix: '{{ "sensor." ~ (weather_entity | replace("weather.","")) ~ "_" }}' + accuweather_sensor_sufix: '{{ "_" ~ page_index ~ "d" }}' temp_min: > - {{ forecast_day | selectattr('templow', 'defined') | map(attribute='templow') | map('float') | list | min - if forecast_day | selectattr('templow', 'defined') | map(attribute='templow') | map('float') | list | count > 0 - else forecast_day | selectattr('temperature', 'defined') | map(attribute='temperature') | map('float') | list | min | default('unknown') + {{ forecast_day | selectattr("templow", "defined") | map(attribute="templow") | map("float") | list | min + if forecast_day | selectattr("templow", "defined") | map(attribute="templow") | map("float") | list | count > 0 + else forecast_day | selectattr("temperature", "defined") | map(attribute="temperature") | map("float") | list | min | default("unknown") }} - temp_max: "{{ forecast_day | selectattr('temperature', 'defined') | map(attribute='temperature') | map('float') | list | max if forecast_day | selectattr('temperature', 'defined') | map(attribute='temperature') | map('float') | list | count > 0 }}" - condition: "{{ forecast_day | selectattr('condition', 'defined') | map(attribute='condition') | list | first if forecast_day | selectattr('condition', 'defined') | map(attribute='condition') | list | count > 0 }}" - precipitation: "{{ forecast_day | selectattr('precipitation', 'defined') | map(attribute='precipitation') | map('float') | list | sum if forecast_day | selectattr('precipitation', 'defined') | map(attribute='precipitation') | map('float') | list | count > 0 }}" - precipitation_probability: "{{ forecast_day | selectattr('precipitation_probability', 'defined') | map(attribute='precipitation_probability') | map('float') | list | max if forecast_day | selectattr('precipitation_probability', 'defined') | map(attribute='precipitation_probability') | map('float') | list | count > 0 }}" - pressure: "{{ forecast_day | selectattr('pressure', 'defined') | map(attribute='pressure') | map('float') | list | max if forecast_day | selectattr('pressure', 'defined') | map(attribute='pressure') | map('float') | list | count > 0 }}" - wind_speed: "{{ forecast_day | selectattr('wind_speed', 'defined') | map(attribute='wind_speed') | map('float') | list | max if forecast_day | selectattr('wind_speed', 'defined') | map(attribute='wind_speed') | map('float') | list | count > 0 }}" - hours_of_sun: "{{ states(accuweather_sensor_prefix ~ 'hours_of_sun' ~ accuweather_sensor_sufix) | default('unknown') if accuweather else (forecast_day | selectattr('hours_of_sun', 'defined') | map(attribute='hours_of_sun') | map('float') | list | sum if forecast_day | selectattr('hours_of_sun', 'defined') | map(attribute='hours_of_sun') | map('float') | list | count > 0) }}" - uv_index: "{{ states(accuweather_sensor_prefix ~ 'uv_index' ~ accuweather_sensor_sufix) | default('unknown') if accuweather else (forecast_day | selectattr('uv_index', 'defined') | map(attribute='uv_index') | map('float') | list | max if forecast_day | selectattr('uv_index', 'defined') | map(attribute='uv_index') | map('float') | list | count > 0) }}" - thunderstorm_probability: "{{ states(accuweather_sensor_prefix ~ 'thunderstorm_probability_day' ~ accuweather_sensor_sufix) | default('unknown') if accuweather else (forecast_day | selectattr('thunderstorm_probability', 'defined') | map(attribute='thunderstorm_probability') | map('float') | list | max if forecast_day | selectattr('thunderstorm_probability', 'defined') | map(attribute='thunderstorm_probability') | map('float') | list | count > 0) }}" + temp_max: '{{ forecast_day | selectattr("temperature", "defined") | map(attribute="temperature") | map("float") | list | max if forecast_day | selectattr("temperature", "defined") | map(attribute="temperature") | map("float") | list | count > 0 }}' + condition: '{{ forecast_day | selectattr("condition", "defined") | map(attribute="condition") | list | first if forecast_day | selectattr("condition", "defined") | map(attribute="condition") | list | count > 0 }}' + precipitation: '{{ forecast_day | selectattr("precipitation", "defined") | map(attribute="precipitation") | map("float") | list | sum if forecast_day | selectattr("precipitation", "defined") | map(attribute="precipitation") | map("float") | list | count > 0 }}' + precipitation_probability: '{{ forecast_day | selectattr("precipitation_probability", "defined") | map(attribute="precipitation_probability") | map("float") | list | max if forecast_day | selectattr("precipitation_probability", "defined") | map(attribute="precipitation_probability") | map("float") | list | count > 0 }}' + pressure: '{{ forecast_day | selectattr("pressure", "defined") | map(attribute="pressure") | map("float") | list | max if forecast_day | selectattr("pressure", "defined") | map(attribute="pressure") | map("float") | list | count > 0 }}' + wind_speed: '{{ forecast_day | selectattr("wind_speed", "defined") | map(attribute="wind_speed") | map("float") | list | max if forecast_day | selectattr("wind_speed", "defined") | map(attribute="wind_speed") | map("float") | list | count > 0 }}' + hours_of_sun: '{{ states(accuweather_sensor_prefix ~ "hours_of_sun" ~ accuweather_sensor_sufix) | default("unknown") if accuweather else (forecast_day | selectattr("hours_of_sun", "defined") | map(attribute="hours_of_sun") | map("float") | list | sum if forecast_day | selectattr("hours_of_sun", "defined") | map(attribute="hours_of_sun") | map("float") | list | count > 0) }}' + uv_index: '{{ states(accuweather_sensor_prefix ~ "uv_index" ~ accuweather_sensor_sufix) | default("unknown") if accuweather else (forecast_day | selectattr("uv_index", "defined") | map(attribute="uv_index") | map("float") | list | max if forecast_day | selectattr("uv_index", "defined") | map(attribute="uv_index") | map("float") | list | count > 0) }}' + thunderstorm_probability: '{{ states(accuweather_sensor_prefix ~ "thunderstorm_probability_day" ~ accuweather_sensor_sufix) | default("unknown") if accuweather else (forecast_day | selectattr("thunderstorm_probability", "defined") | map(attribute="thunderstorm_probability") | map("float") | list | max if forecast_day | selectattr("thunderstorm_probability", "defined") | map(attribute="thunderstorm_probability") | map("float") | list | count > 0) }}' parameters: - name: hours_of_sun - visibility: "{{ is_number(hours_of_sun) }}" - value: "{{ (hours_of_sun | round(0) ~ ' ' ~ weather_units.hours_of_sun) if is_number(hours_of_sun) }}" - icon: "{{ nextion.icons.weather.sun }}" + visibility: '{{ is_number(hours_of_sun) }}' + value: '{{ (hours_of_sun | round(0) ~ " " ~ weather_units.hours_of_sun) if is_number(hours_of_sun) }}' + icon: '{{ nextion.icons.weather.sun }}' - name: thunderstorm_probability - visibility: "{{ is_number(thunderstorm_probability) }}" - value: "{{ (thunderstorm_probability | round(0) ~ weather_units.thunderstorm_probability) if is_number(thunderstorm_probability) }}" - icon: "{{ nextion.icons.weather.lightning }}" + visibility: '{{ is_number(thunderstorm_probability) }}' + value: '{{ (thunderstorm_probability | round(0) ~ weather_units.thunderstorm_probability) if is_number(thunderstorm_probability) }}' + icon: '{{ nextion.icons.weather.lightning }}' - name: precipitation - visibility: "{{ is_number(precipitation) or is_number(precipitation_probability) }}" + visibility: '{{ is_number(precipitation) or is_number(precipitation_probability) }}' value: > - {{ (precipitation | round(0) ~ ' ' ~ weather_units.precipitation) if is_number(precipitation) }} - {{ '-' if is_number(precipitation) and is_number(precipitation_probability) }} + {{ (precipitation | round(0) ~ " " ~ weather_units.precipitation) if is_number(precipitation) }} + {{ "-" if is_number(precipitation) and is_number(precipitation_probability) }} {{ (precipitation_probability | round(0) ~ weather_units.precipitation_probability) if is_number(precipitation_probability) }} - icon: "{{ nextion.icons.weather.rain }}" + icon: '{{ nextion.icons.weather.rain }}' - name: uv_index - visibility: "{{ is_number(uv_index) }}" + visibility: '{{ is_number(uv_index) }}' value: > - {{ (state_attr(accuweather_sensor_prefix ~ 'uv_index' ~ accuweather_sensor_sufix, 'level') | default(None) ~ ': ') if weather_type == 'AccuWeather' }} + {{ (state_attr(accuweather_sensor_prefix ~ "uv_index" ~ accuweather_sensor_sufix, "level") | default(None) ~ ": ") if weather_type == "AccuWeather" }} {{ (uv_index | round(0) ~ weather_units.uv_index) if is_number(uv_index) }} - icon: "{{ nextion.icons.weather.protect }}" + icon: '{{ nextion.icons.weather.protect }}' - name: wind_speed - visibility: "{{ is_number(wind_speed) }}" - value: "{{ (wind_speed | round(0) ~ ' ' ~ weather_units.wind_speed) if is_number(wind_speed) }}" - icon: "{{ nextion.icons.weather.wind }}" + visibility: '{{ is_number(wind_speed) }}' + value: '{{ (wind_speed | round(0) ~ " " ~ weather_units.wind_speed) if is_number(wind_speed) }}' + icon: '{{ nextion.icons.weather.wind }}' - name: pressure - visibility: "{{ is_number(pressure) }}" - value: "{{ (pressure | round(0) ~ ' ' ~ weather_units.pressure) if is_number(pressure) }}" - icon: "{{ nextion.icons.weather.gauge }}" + visibility: '{{ is_number(pressure) }}' + value: '{{ (pressure | round(0) ~ " " ~ weather_units.pressure) if is_number(pressure) }}' + icon: '{{ nextion.icons.weather.gauge }}' ##### Display weather PIC when available - - if: "{{ condition not in ['unknown', None] }}" + - if: '{{ condition not in ["unknown", None] }}' then: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "{{ page_name }}.weather_icon.pic={{ nextion.pics.weather[states(weather_entity) | default('unavailable') if weather_entity is string else 'unavailable'] | default(None) if condition == 'unknown' and page_name == nextion.pages.weatherpages[0] else nextion.pics.weather[condition] | default(None) }}" + cmd: '{{ page_name }}.weather_icon.pic={{ nextion.pics.weather[states(weather_entity) | default("unavailable") if weather_entity is string else "unavailable"] | default(None) if condition == "unknown" and page_name == nextion.pages.weatherpages[0] else nextion.pics.weather[condition] | default(None) }}' continue_on_error: true - *delay-default @@ -5270,101 +5285,101 @@ action: - variables: temperature_string: > {{ (temp_min | round(0) ~ temperature_units) if is_number(temp_min) }} - {{ '/' if is_number(temp_min) and is_number(temp_max) and temp_min != temp_max }} + {{ "/" if is_number(temp_min) and is_number(temp_max) and temp_min != temp_max }} {{ (temp_max | round(0) ~ temperature_units) if is_number(temp_max) and temp_min != temp_max }} - - if: "{{ (is_number(temp_min) or is_number(temp_max)) and temperature_string is string and temperature_string | length > 0 }}" + - if: '{{ (is_number(temp_min) or is_number(temp_max)) and temperature_string is string and temperature_string | length > 0 }}' then: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ page_name }}.temperature" ### Temperature MIN/MAX ### - message: "{{ temperature_string }}" + component: '{{ page_name }}.temperature' ### Temperature MIN/MAX ### + message: '{{ temperature_string }}' continue_on_error: true - *delay-default ##### fields 1 to 5 (Parameters) ##### - repeat: - for_each: "{{ (parameters | selectattr('visibility', 'eq', true) | list)[:5] }}" + for_each: '{{ (parameters | selectattr("visibility", "eq", true) | list)[:5] }}' sequence: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ page_name }}.value0{{ repeat.index }}" - message: "{{ repeat.item.value }}" + component: '{{ page_name }}.value0{{ repeat.index }}' + message: '{{ repeat.item.value }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ page_name }}.value0{{ repeat.index }}_icon" - message: "{{ repeat.item.icon }}" + component: '{{ page_name }}.value0{{ repeat.index }}_icon' + message: '{{ repeat.item.icon }}' continue_on_error: true - *delay-default else: &forecast_unavailable - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "{{ page_name }}.value01" - message: "{{ mui[language].unavailable }}" + component: '{{ page_name }}.value01' + message: '{{ mui[language].unavailable }}' continue_on_error: true - *delay-default else: *forecast_unavailable ## PAGE NOTIFICATION ## - alias: Notification page - conditions: "{{ nspanel_event.page == nextion.pages.notification }}" + conditions: '{{ nspanel_event.page == nextion.pages.notification }}' sequence: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: notification.notifi_text01 - message: "{{ states(notification_text) | default(mui[language].unavailable) if notification_text is string else mui[language].unavailable }}" + message: '{{ states(notification_text) | default(mui[language].unavailable) if notification_text is string else mui[language].unavailable }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: notification.notifi_label - message: "{{ states(notification_label) | default(mui[language].unavailable) if notification_label is string else mui[language].unavailable }}" + message: '{{ states(notification_label) | default(mui[language].unavailable) if notification_label is string else mui[language].unavailable }}' continue_on_error: true ## PAGE QR Code ## - alias: QRCode page - conditions: "{{ nspanel_event.page == nextion.pages.qrcode }}" + conditions: '{{ nspanel_event.page == nextion.pages.qrcode }}' sequence: - variables: - qrcode_label: !input "qrcode_label" - qrcode_value: !input "qrcode_value" - - if: "{{ qrcode_label | length > 0 }}" + qrcode_label: !input 'qrcode_label' + qrcode_value: !input 'qrcode_value' + - if: '{{ qrcode_label | length > 0 }}' then: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "qrcode_label" - message: "{{ qrcode_label }}" + component: 'qrcode_label' + message: '{{ qrcode_label }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: - component: "qrcode_value" - message: "{{ qrcode_value }}" + component: 'qrcode_value' + message: '{{ qrcode_value }}' continue_on_error: true ## PAGE SETTINGS ## #- alias: Settings page - # conditions: "{{ nspanel_event.page == nextion.pages.settings }}" + # conditions: '{{ nspanel_event.page == nextion.pages.settings }}' # sequence: ## PAGE BOOT ## #- alias: Boot page - # conditions: "{{ nspanel_event.page == nextion.pages.boot }}" + # conditions: '{{ nspanel_event.page == nextion.pages.boot }}' # sequence: ## PAGE SCREENSAVER ## #- alias: Screensaver page - # conditions: "{{ nspanel_event.page == nextion.pages.screensaver }}" + # conditions: '{{ nspanel_event.page == nextion.pages.screensaver }}' # sequence: - alias: Page close # general conditions: '{{ nspanel_event.component == "close" and nspanel_event.value == "release" }}' sequence: - *variables-settings_entity - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ settings_entity_dict.page if settings_entity_dict.page is defined else nextion.pages.home }}" + cmd: 'page {{ settings_entity_dict.page if settings_entity_dict.page is defined else nextion.pages.home }}' continue_on_error: true - alias: lightsetting # rgb_color, brightness, color_temp @@ -5373,123 +5388,123 @@ action: - *variables-settings_entity - service: light.turn_on data: - entity_id: "{{ settings_entity_dict.entity }}" - "{{ nspanel_event.component }}": "{{ nspanel_event.value }}" + entity_id: '{{ settings_entity_dict.entity }}' + '{{ nspanel_event.component }}': '{{ nspanel_event.value }}' continue_on_error: true - alias: coversetting position conditions: '{{ nspanel_event.component == "cover_position" }}' sequence: - *variables-settings_entity - - service: "cover.set_cover_position" + - service: 'cover.set_cover_position' data: - entity_id: "{{ settings_entity_dict.entity }}" - position: "{{ nspanel_event.value }}" + entity_id: '{{ settings_entity_dict.entity }}' + position: '{{ nspanel_event.value }}' continue_on_error: true - alias: coversetting open close stop conditions: '{{ nspanel_event.component in ["open_cover", "close_cover", "stop_cover"] }}' sequence: - *variables-settings_entity - - service: "cover.{{ nspanel_event.component }}" + - service: 'cover.{{ nspanel_event.component }}' data: - entity_id: "{{ settings_entity_dict.entity }}" + entity_id: '{{ settings_entity_dict.entity }}' continue_on_error: true - alias: climate hotwater conditions: '{{ nspanel_event.component == "hotwater" and nspanel_event.value == "release" }}' sequence: - service: >- - {% if hotwatercharge is match 'switch.' %} + {% if hotwatercharge is match "switch." %} switch.toggle - {% elif hotwatercharge is match 'input_boolean.' %} + {% elif hotwatercharge is match "input_boolean." %} input_boolean.toggle {% endif %} data: - entity_id: "{{ hotwatercharge }}" + entity_id: '{{ hotwatercharge }}' continue_on_error: true - alias: climate heating conditions: '{{ nspanel_event.component == "heating" and nspanel_event.value == "release" }}' sequence: - *variables-settings_entity - - if: "{{ settings_entity_dict.entity is string and states(settings_entity_dict.entity) == 'off' }}" + - if: '{{ settings_entity_dict.entity is string and states(settings_entity_dict.entity) == "off" }}' then: - service: climate.turn_on data: - entity_id: "{{ settings_entity_dict.entity }}" + entity_id: '{{ settings_entity_dict.entity }}' continue_on_error: true else: - service: climate.turn_off data: - entity_id: "{{ settings_entity_dict.entity }}" + entity_id: '{{ settings_entity_dict.entity }}' continue_on_error: true - alias: climate increasetemp decreasetemp conditions: '{{ nspanel_event.component in ["decreasetemp", "increasetemp"] and nspanel_event.value == "release" }}' sequence: - *variables-settings_entity - - if: "{{ settings_entity_dict.entity is string and states(settings_entity_dict.entity) != 'off' }}" + - if: '{{ settings_entity_dict.entity is string and states(settings_entity_dict.entity) != "off" }}' then: - variables: - delta: "{{ +0.5 if nspanel_event.component == 'increasetemp' else -0.5 }}" - - if: "{{ climate_optimistic == true }}" ## TODO - remove from here + delta: '{{ +0.5 if nspanel_event.component == "increasetemp" else -0.5 }}' + - if: '{{ climate_optimistic == true }}' ## TODO - remove from here then: - variables: - current_setpoint: "{{ states(display_target_temperature) | default('unavailable') if display_target_temperature is string else 'unavailable' }}" - - if: "{{ is_number(current_setpoint) }}" + current_setpoint: '{{ states(display_target_temperature) | default("unavailable") if display_target_temperature is string else "unavailable" }}' + - if: '{{ is_number(current_setpoint) }}' then: - - service: "{{ nextion.commands.thermostat_cycle }}" + - service: '{{ nextion.commands.thermostat_cycle }}' data: - value: "{{ (current_setpoint + delta) | round(1) }}" + value: '{{ (current_setpoint + delta) | round(1) }}' continue_on_error: true else: - variables: - current_setpoint: "{{state_attr(settings_entity_dict.entity, 'temperature') | default('unavailable') if settings_entity_dict.entity is string else 'unavailable' }}" - - if: "{{ is_number(current_setpoint) }}" + current_setpoint: '{{state_attr(settings_entity_dict.entity, "temperature") | default("unavailable") if settings_entity_dict.entity is string else "unavailable" }}' + - if: '{{ is_number(current_setpoint) }}' then: - service: climate.set_temperature data: - entity_id: "{{ settings_entity_dict.entity }}" - #hvac_mode: 'heat' - temperature: "{{ (current_setpoint + delta) | round(1) }}" + entity_id: '{{ settings_entity_dict.entity }}' + #hvac_mode: "heat" + temperature: '{{ (current_setpoint + delta) | round(1) }}' continue_on_error: true - alias: climate climateslider conditions: '{{ nspanel_event.component == "climateslider" }}' sequence: - *variables-settings_entity - - if: "{{ settings_entity_dict.entity is string and states(settings_entity_dict.entity) != 'off' }}" + - if: '{{ settings_entity_dict.entity is string and states(settings_entity_dict.entity) != "off" }}' then: - variables: - climateslider: "{{ nspanel_event.value | int(-1) }}" - new_setpoint: "{{ (13.0 + (climateslider * 0.5)) if climateslider >= 0 and climateslider <= 27 }}" - - if: "{{ climate_optimistic == true }}" ## TODO - remove from here + climateslider: '{{ nspanel_event.value | int(-1) }}' + new_setpoint: '{{ (13.0 + (climateslider * 0.5)) if climateslider >= 0 and climateslider <= 27 }}' + - if: '{{ climate_optimistic == true }}' ## TODO - remove from here then: - - service: "{{ nextion.commands.thermostat_cycle }}" + - service: '{{ nextion.commands.thermostat_cycle }}' data: - value: "{{ new_setpoint }}" + value: '{{ new_setpoint }}' continue_on_error: true else: - service: climate.set_temperature data: - entity_id: "{{ settings_entity_dict.entity }}" - #hvac_mode: 'heat' - temperature: "{{ new_setpoint }}" + entity_id: '{{ settings_entity_dict.entity }}' + #hvac_mode: "heat" + temperature: '{{ new_setpoint }}' continue_on_error: true - alias: Button page - Button press conditions: - - "{{ nspanel_event.page in nextion.pages.buttonpages }}" - - "{{ nspanel_event.value == 'press' }}" + - '{{ nspanel_event.page in nextion.pages.buttonpages }}' + - '{{ nspanel_event.value == "press" }}' sequence: - wait_template: > {% set button_wait = states(nspanelevent) %} {% set button_wait = button_wait | from_json if button_wait is string and button_wait not in ["unavailable", "unknown", None] else { "page": "unknown", "component": "unknown", "value": "unknown" } %} {{ - button_wait.page == nspanel_event.page and + button_wait.page == nspanel_event.page and button_wait.component == nspanel_event.component and - button_wait.value == 'release' + button_wait.value == "release" }} timeout: seconds: 1 @@ -5497,54 +5512,59 @@ action: - *variables-page_buttons - variables: ##### Entity - Page Button - Toggle Entity ##### - button_wait: '{{ states(nspanelevent) if nspanelevent is string and states(nspanelevent) not in ["unavailable", "unknown", None] else { "page": "unknown", "component": "unknown", "value": "unknown" } }}' - last_click_button: "{{ button_pages_buttons | selectattr('page', 'defined') | selectattr('page', 'eq', nspanel_event.page) | selectattr('component', 'defined') | selectattr('component', 'eq', nspanel_event.component) | list }}" - - condition: "{{ last_click_button | count >= 0 }}" - - if: "{{ not wait.completed }}" + button_wait: > + {{ + states(nspanelevent) + if nspanelevent is string and states(nspanelevent) not in ["unavailable", "unknown", None] + else { "page": "unknown", "component": "unknown", "value": "unknown" } + }} + last_click_button: '{{ button_pages_buttons | selectattr("page", "defined") | selectattr("page", "eq", nspanel_event.page) | selectattr("component", "defined") | selectattr("component", "eq", nspanel_event.component) | list }}' + - condition: '{{ last_click_button | count >= 0 }}' + - if: '{{ not wait.completed }}' then: # Long press - - service: "{{ nextion.commands.set_settings_entity }}" + - service: '{{ nextion.commands.set_settings_entity }}' data: - entity: "{{ last_click_button[0] }}" + entity: '{{ last_click_button[0] }}' continue_on_error: true else: # Short press - variables: - last_click_button: "{{ last_click_button[0] }}" - entity_domain: "{{ (last_click_button.entity.split('.')[0] | default('unknown')) if last_click_button.entity is string and last_click_button.entity | length > 0 and last_click_button.entity.split('.') | count > 0 else 'unknown' }}" - - condition: "{{ entity_domain not in ['unknown', 'person', 'binary_sensor', 'sensor'] }}" - - if: "{{ entity_domain == 'climate' }}" + last_click_button: '{{ last_click_button[0] }}' + entity_domain: '{{ (last_click_button.entity.split(".")[0] | default("unknown")) if last_click_button.entity is string and last_click_button.entity | length > 0 and last_click_button.entity.split(".") | count > 0 else "unknown" }}' + - condition: '{{ entity_domain not in ["unknown", "person", "binary_sensor", "sensor"] }}' + - if: '{{ entity_domain == "climate" }}' then: - - service: "{{ nextion.commands.set_settings_entity }}" + - service: '{{ nextion.commands.set_settings_entity }}' data: - entity: "{{ last_click_button }}" + entity: '{{ last_click_button }}' continue_on_error: true else: - - if: "{{ last_click_button.confirm }}" + - if: '{{ last_click_button.confirm }}' then: - variables: btn_entity_name: >- - {%- if state_attr(last_click_button.entity, 'friendly_name') != None -%} {{ state_attr(last_click_button.entity, 'friendly_name') }} - {%- elif state_attr(last_click_button.entity, 'name') != None -%} {{ state_attr(last_click_button.entity, 'name') }} - {%- else -%} 'unknown' + {%- if state_attr(last_click_button.entity, "friendly_name") != None -%} {{ state_attr(last_click_button.entity, "friendly_name") }} + {%- elif state_attr(last_click_button.entity, "name") != None -%} {{ state_attr(last_click_button.entity, "name") }} + {%- else -%} "unknown" {%- endif -%} #### turn on switch confirmation_message - service: switch.turn_on data: - entity_id: "{{ confirmation_message }}" + entity_id: '{{ confirmation_message }}' continue_on_error: true - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.notification }}" + cmd: 'page {{ nextion.pages.notification }}' continue_on_error: true - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: notification.notifi_text01 - message: "{{ btn_entity_name }}" + message: '{{ btn_entity_name }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: notification.notifi_label - message: "{{ mui[language].please_confirm }}" + message: '{{ mui[language].please_confirm }}' continue_on_error: true - wait_template: > {% set notification_answer = states(nspanelevent) %} @@ -5554,146 +5574,151 @@ action: seconds: 10 continue_on_timeout: true - variables: - notification_answer: '{{ states(nspanelevent) if nspanelevent is string and states(nspanelevent) not in ["unavailable", "unknown", None] else { "page": "unknown", "component": "unknown", "value": "unknown" } }}' + notification_answer: > + {{ + states(nspanelevent) + if nspanelevent is string and states(nspanelevent) not in ["unavailable", "unknown", None] + else { "page": "unknown", "component": "unknown", "value": "unknown" } + }} - choose: - conditions: '{{ notification_answer.component == "accept" }}' sequence: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nspanel_event.page }}" + cmd: 'page {{ nspanel_event.page }}' continue_on_error: true - service: switch.turn_off data: - entity_id: "{{ confirmation_message }}" + entity_id: '{{ confirmation_message }}' continue_on_error: true - &service-button_changed service: >- - {% if entity_domain in ['light', 'switch', 'cover', 'input_boolean', 'automation', 'fan'] %} + {% if entity_domain in ["light", "switch", "cover", "input_boolean", "automation", "fan"] %} {{ entity_domain }}.toggle - {% elif entity_domain in ['button', 'input_button'] %} + {% elif entity_domain in ["button", "input_button"] %} {{ entity_domain }}.press - {% elif entity_domain in ['scene', 'script'] %} + {% elif entity_domain in ["scene", "script"] %} {{ entity_domain }}.turn_on {% else %} homeassistant.update_entity {% endif %} data: - entity_id: "{{ last_click_button.entity }}" + entity_id: '{{ last_click_button.entity }}' continue_on_error: true - - conditions: "{{ notification_answer.component == 'clear' }}" + - conditions: '{{ notification_answer.component == "clear" }}' sequence: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nspanel_event.page }}" + cmd: 'page {{ nspanel_event.page }}' continue_on_error: true - service: switch.turn_off data: - entity_id: "{{ confirmation_message }}" + entity_id: '{{ confirmation_message }}' continue_on_error: true - conditions: '{{ notification_answer.component == "homepage" }}' sequence: - service: switch.turn_off data: - entity_id: "{{ confirmation_message }}" + entity_id: '{{ confirmation_message }}' continue_on_error: true default: - service: switch.turn_off data: - entity_id: "{{ confirmation_message }}" + entity_id: '{{ confirmation_message }}' continue_on_error: true - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.home }}" + cmd: 'page {{ nextion.pages.home }}' continue_on_error: true else: - *service-button_changed - alias: Jump to climate page conditions: - - "{{ nspanel_event.page == nextion.pages.home }} " + - '{{ nspanel_event.page == nextion.pages.home }} ' - '{{ nspanel_event.component == "climate" }}' - '{{ nspanel_event.value == "release" }}' - - "{{ climate | length > 0 }} " + - '{{ climate | length > 0 }} ' sequence: - - service: "{{ nextion.commands.set_settings_entity }}" + - service: '{{ nextion.commands.set_settings_entity }}' data: - entity: "{{ dict(nspanel_event.items(), entity=climate, name=state_attr(climate, 'friendly_name')) }}" + entity: '{{ dict(nspanel_event.items(), entity=climate, name=state_attr(climate, "friendly_name")) }}' continue_on_error: true - alias: Jump to weather page conditions: - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ nspanel_event.page == nextion.pages.home }}' - '{{ nspanel_event.component == "weather" }}' sequence: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.weatherpages[0] }}" + cmd: 'page {{ nextion.pages.weatherpages[0] }}' continue_on_error: true - alias: Jump to QR code page conditions: - - "{{ qrcode_enabled == true }}" - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ qrcode_enabled == true }}' + - '{{ nspanel_event.page == nextion.pages.home }}' - '{{ nspanel_event.component == "button05" }}' sequence: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.qrcode }}" + cmd: 'page {{ nextion.pages.qrcode }}' continue_on_error: true - alias: Jump to entity page conditions: - - "{{ entitypages_enabled == true }}" - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ entitypages_enabled == true }}' + - '{{ nspanel_event.page == nextion.pages.home }}' - '{{ nspanel_event.component == "button06" }}' sequence: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.entitypages[0] }}" + cmd: 'page {{ nextion.pages.entitypages[0] }}' continue_on_error: true - alias: Jump to notification page conditions: - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ nspanel_event.page == nextion.pages.home }}' - '{{ nspanel_event.component == "button04" }}' - - "{{ notification_text is string and states(notification_text) | length > 0 }}" + - '{{ notification_text is string and states(notification_text) | length > 0 }}' sequence: - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.notification }}" + cmd: 'page {{ nextion.pages.notification }}' continue_on_error: true - alias: Show button - Notification clear conditions: - - "{{ nspanel_event.page == nextion.pages.notification }}" + - '{{ nspanel_event.page == nextion.pages.notification }}' - '{{ nspanel_event.component == "clear" }}' - - "{{ confirmation_message is string and states(confirmation_message) | default('unavailable') != 'on' }}" + - '{{ confirmation_message is string and states(confirmation_message) | default("unavailable") != "on" }}' sequence: - service: switch.turn_off data: - entity_id: "{{ notification_unread }}" + entity_id: '{{ notification_unread }}' continue_on_error: true - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.home }}" + cmd: 'page {{ nextion.pages.home }}' continue_on_error: true - alias: Show button - Notification accept conditions: - - "{{ nspanel_event.page == nextion.pages.notification }}" + - '{{ nspanel_event.page == nextion.pages.notification }}' - '{{ nspanel_event.component == "accept" }}' - - "{{ confirmation_message is string and states(confirmation_message) | default('unavailable') != 'on' }}" + - '{{ confirmation_message is string and states(confirmation_message) | default("unavailable") != "on" }}' sequence: - service: switch.turn_off data: - entity_id: "{{ notification_unread }}" + entity_id: '{{ notification_unread }}' continue_on_error: true - - service: "{{ nextion.commands.notification_clear }}" + - service: '{{ nextion.commands.notification_clear }}' data: {} continue_on_error: true - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "page {{ nextion.pages.home }}" + cmd: 'page {{ nextion.pages.home }}' continue_on_error: true @@ -5705,19 +5730,19 @@ action: sequence: - choose: ## PAGE HOME ## - - conditions: "{{ nspanel_event.page == nextion.pages.home }}" + - conditions: '{{ nspanel_event.page == nextion.pages.home }}' sequence: *refresh_page_home ## PAGE BUTTON PAGES 01 - 04 ## - - conditions: "{{ nspanel_event.page in nextion.pages.buttonpages }}" + - conditions: '{{ nspanel_event.page in nextion.pages.buttonpages }}' sequence: *refresh_page_buttonpage ## ENTITY PAGES ## - - conditions: "{{ nspanel_event.page in nextion.pages.entitypages }}" + - conditions: '{{ nspanel_event.page in nextion.pages.entitypages }}' sequence: *refresh-entity_pages ##### UPDATE BUTTONS AND PAGES - button page / lightsettings page / coversettings page ##### - - alias: "Update buttons & pages" + - alias: 'Update buttons & pages' conditions: - condition: trigger id: @@ -5753,7 +5778,7 @@ action: - current_state_entity30 - current_state_entity31 - current_state_entity32 - - "{{ trigger.to_state.state not in ['unavailable', 'unknown'] }}" + - '{{ trigger.to_state.state not in ["unavailable", "unknown"] }}' sequence: - alias: choose current page choose: @@ -5762,25 +5787,25 @@ action: sequence: - *variables-page_buttons - repeat: - for_each: "{{ button_pages_buttons | selectattr('page', 'defined') | selectattr('page', 'eq', nspanel_event.page) | selectattr('component', 'defined') | selectattr('component', 'eq', nspanel_event.component) | selectattr('entity', 'defined') | selectattr('entity', 'eq', trigger.entity_id) | list }}" + for_each: '{{ button_pages_buttons | selectattr("page", "defined") | selectattr("page", "eq", nspanel_event.page) | selectattr("component", "defined") | selectattr("component", "eq", nspanel_event.component) | selectattr("entity", "defined") | selectattr("entity", "eq", trigger.entity_id) | list }}' sequence: *display-button_page_button - alias: page climate conditions: '{{ nspanel_event.page == nextion.pages.climate and trigger.entity_id is match "climate." }}' sequence: - *variables-settings_entity - - if: "{{ trigger.entity_id == settings_entity_dict.entity }}" + - if: '{{ trigger.entity_id == settings_entity_dict.entity }}' then: - variables: - hvac_mode: "{{ states(settings_entity_dict.entity) | default('unavailable') if settings_entity_dict.entity is string else 'unavailable' }}" - heating_state: "{{ mui[language].climate.states.off if hvac_mode == 'off' else mui[language].climate.states.on }}" - heating_bt_pic: "{{ nextion.pics.heating.button.off if hvac_mode == 'off' else nextion.pics.heating.button.on }}" - - service: "{{ nextion.commands.text_printf }}" + hvac_mode: '{{ states(settings_entity_dict.entity) | default("unavailable") if settings_entity_dict.entity is string else "unavailable" }}' + heating_state: '{{ mui[language].climate.states.off if hvac_mode == "off" else mui[language].climate.states.on }}' + heating_bt_pic: '{{ nextion.pics.heating.button.off if hvac_mode == "off" else nextion.pics.heating.button.on }}' + - service: '{{ nextion.commands.text_printf }}' data: component: heating_state - message: "{{ heating_state }}" + message: '{{ heating_state }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: cmd: heating_bt_pic.pic={{ heating_bt_pic }} continue_on_error: true @@ -5796,11 +5821,11 @@ action: - home_value01_state - home_value02_state - home_value03_state - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ nspanel_event.page == nextion.pages.home }}' sequence: - *variables-home_page_values - repeat: - for_each: "{{ home_page_values | selectattr('entity', 'defined') | selectattr('entity', 'eq', trigger.entity_id) | list }}" + for_each: '{{ home_page_values | selectattr("entity", "defined") | selectattr("entity", "eq", trigger.entity_id) | list }}' sequence: - *display-home_page_value @@ -5819,11 +5844,11 @@ action: - chip05_state - chip06_state - chip07_state - - "{{ nspanel_event.page == nextion.pages.home and trigger.event.data.new_state.state not in ['unavailable', 'unknown'] }}" + - '{{ nspanel_event.page == nextion.pages.home and trigger.event.data.new_state.state not in ["unavailable", "unknown"] }}' sequence: - *variables-home_page_status_bar - repeat: - for_each: "{{ home_page_status_bar | selectattr('entity', 'defined') | selectattr('entity', 'eq', trigger.event.data.entity_id) | list }}" + for_each: '{{ home_page_status_bar | selectattr("entity", "defined") | selectattr("entity", "eq", trigger.event.data.entity_id) | list }}' sequence: - *display-home_page_status_bar @@ -5835,34 +5860,34 @@ action: - notification_text_state - notification_unread_state - condition: template - value_template: "{{ nspanel_event.page == nextion.pages.home and trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}" + value_template: '{{ nspanel_event.page == nextion.pages.home and trigger.event.data.new_state.state not in ["unavailable", "unknown", None] }}' sequence: - - alias: "Set notifiy pic" + - alias: 'Set notifiy pic' variables: - notification_text_state: "{{ states(notification_text) | default('unavailable') if notification_text is string else 'unavailable' }}" - notification_text_available: "{{ notification_text_state not in ['unavailable', 'unknown', None] }}" - notification_unread_state: "{{ states(notification_unread) | default('unavailable') if notification_unread is string else 'unavailable' }}" - set_button04_icon: "{{ nextion.icons.all[page_home.buttons[3].icon.split(':')[1]] | default(page_home.buttons[3].icon if page_home.buttons[3].icon is string else '\U0000E2D5') if notification_unread_state in ['on', 'off'] and notification_text_available else nextion.icons.blank }}" + notification_text_state: '{{ states(notification_text) | default("unavailable") if notification_text is string else "unavailable" }}' + notification_text_available: '{{ notification_text_state not in ["unavailable", "unknown", None] }}' + notification_unread_state: '{{ states(notification_unread) | default("unavailable") if notification_unread is string else "unavailable" }}' + set_button04_icon: '{{ nextion.icons.all[page_home.buttons[3].icon.split(":")[1]] | default(page_home.buttons[3].icon if page_home.buttons[3].icon is string else "\U0000E2D5") if notification_unread_state in ["on", "off"] and notification_text_available else nextion.icons.blank }}' set_button04_icon_font: > {{ (page_home.buttons[3].color_rgb[notification_unread_state] if is_number(page_home.buttons[3].color_rgb[notification_unread_state]) else ((page_home.buttons[3].color_rgb[notification_unread_state][0] //(2**3)) *(2**11))+((page_home.buttons[3].color_rgb[notification_unread_state][1] //(2**2)) *(2**5))+(page_home.buttons[3].color_rgb[notification_unread_state][2] //(2**3))) - if notification_unread_state in ['on', 'off'] and notification_text_available + if notification_unread_state in ["on", "off"] and notification_text_available else nextion.colors.grey_light }} ##### SET ICON Font - Notify ##### - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.button04_icon - message: "{{ set_button04_icon }}" + message: '{{ set_button04_icon }}' continue_on_error: true ##### SET ICON Font Color - Notify ##### - *delay-default - - service: "{{ nextion.commands.font_color }}" + - service: '{{ nextion.commands.font_color }}' data: component: home.button04_icon - message: "{{ set_button04_icon_font }}" + message: '{{ set_button04_icon_font }}' continue_on_error: true ##### BUTTON - press ##### @@ -5874,40 +5899,40 @@ action: - right_button_press sequence: - variables: - button_context: "{{ page_home.hardware.buttons.left if trigger.id == 'left_button_press' else page_home.hardware.buttons.right }}" - - wait_template: "{{ is_state(left_button if trigger.id == 'left_button_press' else right_button, 'off') }}" + button_context: '{{ page_home.hardware.buttons.left if trigger.id == "left_button_press" else page_home.hardware.buttons.right }}' + - wait_template: '{{ is_state(left_button if trigger.id == "left_button_press" else right_button, "off") }}' timeout: !input hold_delay continue_on_timeout: true - - if: "{{ not wait.completed }}" + - if: '{{ not wait.completed }}' then: # Hold - choose: - - conditions: "{{ button_context.hold_select == 'Default' and button_context.entity | length > 0 }}" + - conditions: '{{ button_context.hold_select == "Default" and button_context.entity | length > 0 }}' sequence: - - service: "{{ nextion.commands.set_settings_entity }}" + - service: '{{ nextion.commands.set_settings_entity }}' data: - entity: "{{ button_context }}" + entity: '{{ button_context }}' continue_on_error: true - - conditions: "{{ button_context.hold_select == 'Custom Action' and trigger.id == 'left_button_press' }}" + - conditions: '{{ button_context.hold_select == "Custom Action" and trigger.id == "left_button_press" }}' sequence: !input left_button_hold_custom_action - - conditions: "{{ button_context.hold_select == 'Custom Action' and trigger.id == 'right_button_press' }}" + - conditions: '{{ button_context.hold_select == "Custom Action" and trigger.id == "right_button_press" }}' sequence: !input right_button_hold_custom_action else: # Single Click - condition: template - value_template: "{{ button_context.entity | length > 0 }}" + value_template: '{{ button_context.entity | length > 0 }}' - variables: - button_domain: "{{ (button_context.entity.split('.')[0] | default('unknown')) if button_context.entity | length > 0 else 'unknown' }}" + button_domain: '{{ (button_context.entity.split(".")[0] | default("unknown")) if button_context.entity | length > 0 else "unknown" }}' - service: > - {% if button_domain in ['light', 'switch', 'cover', 'input_boolean', 'automation', 'fan'] %} + {% if button_domain in ["light", "switch", "cover", "input_boolean", "automation", "fan"] %} {{ button_domain }}.toggle - {% elif button_domain in ['button', 'input_button'] %} + {% elif button_domain in ["button", "input_button"] %} {{ button_domain }}.press - {% elif button_domain in ['scene', 'script'] %} + {% elif button_domain in ["scene", "script"] %} {{ button_domain }}.turn_on {% else %} homeassistant.update_entity {% endif %} data: - entity_id: "{{ button_context.entity }}" + entity_id: '{{ button_context.entity }}' continue_on_error: true ##### BUTTON - state ##### @@ -5917,23 +5942,23 @@ action: id: - left_button_state - right_button_state - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ nspanel_event.page == nextion.pages.home }}' sequence: - variables: # Hardware Button PIC - current_hardware_button_state: "{{ nextion.pics.hardware.button[trigger.to_state.state] }}" + current_hardware_button_state: '{{ nextion.pics.hardware.button[trigger.to_state.state] }}' ##### SET hardware Button PIC on Home Page #### - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: - cmd: "home.{{ 'left' if trigger.id == 'left_button_state' else 'right'}}_bt_pic.pic={{ current_hardware_button_state }}" + cmd: 'home.{{ "left" if trigger.id == "left_button_state" else "right"}}_bt_pic.pic={{ current_hardware_button_state }}' continue_on_error: true ##### DATE AND TIME ##### - - alias: "Date & Time" + - alias: 'Date & Time' conditions: - condition: trigger id: time_state - - "{{ nspanel_event.page == nextion.pages.home }}" + - '{{ nspanel_event.page == nextion.pages.home }}' sequence: - *refresh-page_home-date_time @@ -5942,7 +5967,7 @@ action: conditions: - condition: trigger id: outdoortemp_state - - "{{ nspanel_event.page == nextion.pages.home and is_number(trigger.event.data.new_state.state) }}" + - '{{ nspanel_event.page == nextion.pages.home and is_number(trigger.event.data.new_state.state) }}' sequence: - *refresh-page_home-outdoor_temp @@ -5953,7 +5978,7 @@ action: id: - indoortemp_state - nspaneltemp_state - - "{{ nspanel_event.page == nextion.pages.home and is_number(trigger.event.data.new_state.state) }}" + - '{{ nspanel_event.page == nextion.pages.home and is_number(trigger.event.data.new_state.state) }}' sequence: - *refresh-page_home-indoor_temp @@ -5962,7 +5987,7 @@ action: conditions: - condition: trigger id: weather_state_change - - "{{ nspanel_event.page == nextion.pages.home and trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}" + - '{{ nspanel_event.page == nextion.pages.home and trigger.event.data.new_state.state not in ["unavailable", "unknown", None] }}' sequence: - *refresh-page_home-outdoor_temp - *delay-default @@ -5973,55 +5998,55 @@ action: conditions: - condition: trigger id: climate_state - - "{{ trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}" + - '{{ trigger.event.data.new_state.state not in ["unavailable", "unknown", None] }}' # - condition: template - # value_template: "{{ nspanel_event.page == nextion.pages.climate }}" + # value_template: '{{ nspanel_event.page == nextion.pages.climate }}' # - condition: template - # value_template: "{{ climate_optimistic == false }}" + # value_template: '{{ climate_optimistic == false }}' sequence: - variables: heating_state: > {{ mui[language].climate.states.off - if trigger.event.data.new_state.state == 'off' + if trigger.event.data.new_state.state == "off" else mui[language].climate.states.on }} heating_bt_pic: > {{ nextion.pics.heating.button.off - if trigger.event.data.new_state.state == 'off' + if trigger.event.data.new_state.state == "off" else nextion.pics.heating.button.on }} - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: current_temp - message: "{{ trigger.event.data.new_state.attributes.current_temperature | round(1)}}{{ temperature_units }}" + message: '{{ trigger.event.data.new_state.attributes.current_temperature | round(1)}}{{ temperature_units }}' continue_on_error: true - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: heating_state - message: "{{heating_state}}" + message: '{{heating_state}}' continue_on_error: true - - service: "{{ nextion.commands.printf }}" + - service: '{{ nextion.commands.printf }}' data: cmd: heating_bt_pic.pic={{ heating_bt_pic }} continue_on_error: true - - if: "{{ trigger.event.data.new_state.state != 'off' }}" #### TODO AND->OR (not) not optimistic-mode + - if: '{{ trigger.event.data.new_state.state != "off" }}' #### TODO AND->OR (not) not optimistic-mode then: - - service: "{{ nextion.commands.thermostat_cycle }}" + - service: '{{ nextion.commands.thermostat_cycle }}' data: - value: "{{trigger.event.data.new_state.attributes.temperature | round(1)}}" + value: '{{trigger.event.data.new_state.attributes.temperature | round(1)}}' continue_on_error: true else: - - service: "{{ nextion.commands.thermostat_cycle }}" + - service: '{{ nextion.commands.thermostat_cycle }}' data: - value: "0" + value: '0' continue_on_error: true - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: target_temp - message: " " + message: ' ' continue_on_error: true ##### Sync Hotwater Charge button-symbol ##### -> kann wenn climate page fertig @@ -6029,11 +6054,11 @@ action: conditions: - condition: trigger id: hotwatercharge_state - - "{{ nspanel_event.page == nextion.pages.climate }}" + - '{{ nspanel_event.page == nextion.pages.climate }}' sequence: - variables: - hotw_bt_pic: "{{ nextion.pics.hvac.button[trigger.event.data.new_state.state] }}" - - service: "{{ nextion.commands.printf }}" + hotw_bt_pic: '{{ nextion.pics.hvac.button[trigger.event.data.new_state.state] }}' + - service: '{{ nextion.commands.printf }}' data: cmd: hotw_bt_pic.pic={{ hotw_bt_pic }} continue_on_error: true @@ -6043,22 +6068,22 @@ action: conditions: - condition: trigger id: hotwatertemp_state - - "{{ nspanel_event.page == nextion.pages.climate and trigger.event.data.new_state.state not in ['unavailable', 'unknown', None] }}" + - '{{ nspanel_event.page == nextion.pages.climate and trigger.event.data.new_state.state not in ["unavailable", "unknown", None] }}' sequence: - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: home.hotwater_temp - message: "{{ trigger.event.data.new_state.state | round(1) }}{{ temperature_units }}" + message: '{{ trigger.event.data.new_state.state | round(1) }}{{ temperature_units }}' continue_on_error: true - *delay-default - - service: "{{ nextion.commands.text_printf }}" + - service: '{{ nextion.commands.text_printf }}' data: component: climate.hotwater_temp - message: "{{ trigger.event.data.new_state.state | round(1) }}{{ temperature_units }}" + message: '{{ trigger.event.data.new_state.state | round(1) }}{{ temperature_units }}' continue_on_error: true # - delay: - # milliseconds: "{{ delay_value }}" - # - service: "{{ nextion.commands.printf }}" + # milliseconds: '{{ delay_value }}' + # - service: '{{ nextion.commands.printf }}' # data: # cmd: home.hotwater_pic.pic={{ hotwater_pic_on }} @@ -6070,7 +6095,7 @@ action: sequence: - delay: seconds: 2 - - service: "{{ nextion.commands.tft_upload }}" + - service: '{{ nextion.commands.tft_upload }}' data: {} continue_on_error: true