diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 03b6e46..6cfe3e8 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -44,11 +44,15 @@ The goal was to create a version that allows everyone to use the NSpanel fully l ##### MAIN NAME ##### nspanel_name: - name: ESPhome Node Name - description: '* *"SYSTEM" - here you have to enter exactly the same **"device_name"** you entered in the Esphome file*' - default: [nspanel_name] + name: (REQUIRED) NSPanel device + description: '* *"SYSTEM" - Please select the ESPHome device reated to the NSPanel to be controlled by this automation*' + default: [] selector: - text: {} + device: + filter: + - integration: esphome + model: esp32dev + multiple: false ##### SYSTEM SETTINGS ##### language: @@ -239,7 +243,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l - sensor home_value01_icon: name: Sensor 01 - ICON (Optional) - description: '* *Page "HOME" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "HOME" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector home_value01_icon_color: @@ -262,7 +266,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l - sensor home_value02_icon: name: Sensor 02 - ICON (Optional) - description: '* *Page "HOME" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "HOME" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector home_value02_icon_color: @@ -285,7 +289,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l - sensor home_value03_icon: name: Sensor 03 - ICON (Optional) - description: '* *Page "HOME" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "HOME" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector home_value03_icon_color: @@ -1638,7 +1642,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity01_icon: name: Entity 01 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity02: @@ -1655,7 +1659,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity02_icon: name: Entity 02 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity03: @@ -1672,7 +1676,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity03_icon: name: Entity 03 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity04: @@ -1689,7 +1693,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity04_icon: name: Entity 04 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity05: @@ -1706,7 +1710,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity05_icon: name: Entity 05 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity06: @@ -1723,7 +1727,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity06_icon: name: Entity 06 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity07: @@ -1740,7 +1744,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity07_icon: name: Entity 07 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity08: @@ -1757,7 +1761,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity08_icon: name: Entity 08 - ICON (Optional) - description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE01" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector ##### Entity page 02 - Entities ##### @@ -1785,7 +1789,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity09_icon: name: Entity 09 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity10: @@ -1802,7 +1806,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity10_icon: name: Entity 10 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity11: @@ -1819,7 +1823,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity11_icon: name: Entity 11 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity12: @@ -1836,7 +1840,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity12_icon: name: Entity 12 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity13: @@ -1853,7 +1857,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity13_icon: name: Entity 13 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity14: @@ -1870,7 +1874,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity14_icon: name: Entity 14 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity15: @@ -1887,7 +1891,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity15_icon: name: Entity 15 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity16: @@ -1904,7 +1908,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity16_icon: name: Entity 16 - ICON (Optional) - description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE02" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector ##### Entity page 03 - Entities ##### @@ -1932,7 +1936,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity17_icon: name: Entity 17 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity18: @@ -1949,7 +1953,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity18_icon: name: Entity 18 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity19: @@ -1966,7 +1970,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity19_icon: name: Entity 19 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity20: @@ -1983,7 +1987,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity20_icon: name: Entity 20 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity21: @@ -2000,7 +2004,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity21_icon: name: Entity 21 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity22: @@ -2017,7 +2021,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity22_icon: name: Entity 22 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity23: @@ -2034,7 +2038,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity23_icon: name: Entity 23 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity24: @@ -2051,7 +2055,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity24_icon: name: Entity 24 - ICON (Optional) - description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE03" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector ##### Entity page 04 - Entities ##### @@ -2079,7 +2083,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity25_icon: name: Entity 25 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity26: @@ -2096,7 +2100,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity26_icon: name: Entity 26 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity27: @@ -2113,7 +2117,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity27_icon: name: Entity 27 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity28: @@ -2130,7 +2134,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity28_icon: name: Entity 28 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity29: @@ -2147,7 +2151,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity29_icon: name: Entity 29 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity30: @@ -2164,7 +2168,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity30_icon: name: Entity 30 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity31: @@ -2181,7 +2185,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity31_icon: name: Entity 31 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector entities_entity32: @@ -2198,7 +2202,7 @@ The goal was to create a version that allows everyone to use the NSpanel fully l text: {} entities_entity32_icon: name: Entity 32 - ICON (Optional) - description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, no icon is shown)*' + description: '* *Page "ENTITYPAGE04" - Icon which should be displayed (if not set, it would be used an icon from attributes, if available, or no icon is shown)*' default: [] selector: *icon-selector @@ -2322,16 +2326,20 @@ trace: trigger_variables: nspanel_name_temp: !input "nspanel_name" - nspanel_name: "{{ nspanel_name_temp | replace('-','_') | replace(' ','_') | replace('___','_') | replace('__','_') }}" + 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('__','_') }} + {% endif %} last_click: "sensor.{{ nspanel_name }}_last_click" last_click_lightsettings: "sensor.{{ nspanel_name }}_last_click_lightsettings" last_click_coversettings: "sensor.{{ nspanel_name }}_last_click_coversettings" last_click_climatesettings: "sensor.{{ nspanel_name }}_last_click_climatesettings" left_button: "binary_sensor.{{ nspanel_name }}_left_button" right_button: "binary_sensor.{{ nspanel_name }}_right_button" - weather_forcast_button: "binary_sensor.{{ nspanel_name }}_weather_forcast" - nextion_inited_trigger: "switch.{{ nspanel_name }}_nextion_inited" - # current_page: "sensor.{{ nspanel_name }}_current_page" + #weather_forcast_button: "binary_sensor.{{ nspanel_name }}_weather_forcast" + nextion_inited: "switch.{{ nspanel_name }}_nextion_inited" + #current_page: "sensor.{{ nspanel_name }}_current_page" current_page: "sensor.{{ nspanel_name }}_currentpage" hotwatercharge: !input "hotwatercharge" display_target_temperature: "sensor.{{ nspanel_name }}_display_target_temperature" @@ -3124,7 +3132,11 @@ variables: no_name: No name ##### WEATHER #### - weather_entity: !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 }} + {% endif %} temperature_units: '°' ##### Home page ##### @@ -3230,7 +3242,7 @@ trigger: ##### Reboot - Trigger "nspanel_boot_init" ##### - platform: template - value_template: "{{ is_state(nextion_inited_trigger, 'on') | default(false) if nextion_inited_trigger 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 @@ -3687,7 +3699,7 @@ trigger: ##### CLOSE - Trigger ##### ############################################################# -condition: "{{ is_state(nextion_inited_trigger, 'on') | default(false) if nextion_inited_trigger is string else false }}" +condition: "{{ is_state(nextion_inited, 'on') | default(false) if nextion_inited is string else false }}" ############################################################# ##### START - Action #####