This commit is contained in:
Edward Firmo
2023-12-18 15:28:42 +01:00
parent 286e98ecef
commit 83c641deef

View File

@@ -6172,12 +6172,12 @@ variables:
rgbw: "[<ColorMode.RGBW: 'rgbw'>]"
rgbww: "[<ColorMode.RGBWW: 'rgbww'>]"
white: "[<ColorMode.WHITE: ''>]"
# yamllint disable rule:truthy rule:line-length
states:
# yamllint disable rule:truthy rule:line-length
"on": ["on", "open", "opening", "true", "True", true, True, "playing", "heat", "cold", "dry", "armed_home", "armed_away", "armed_vacation", "armed_custom_bypass", "triggered", "pending", "arming", 1]
"off": ["off", "closed", "closing", "false", "False", false, False, "standby", "paused", "idle", "disarmed", "disarming", 0]
unknown: ["unknown", "unavailable", None, none, ""]
# yamllint enable rule:truthy rule:line-length
# yamllint enable rule:truthy rule:line-length
#############################################################
##### CLOSE - Variables #####
@@ -7336,7 +7336,9 @@ action:
- &refresh-page_home-weather_pic
service: '{{ nextion.command.printf }}'
data:
cmd: home.weather.pic={{ nextion.pic.weather[states(weather_entity) | default("unavailable") if weather_entity is string and has_value(weather_entity) else "unavailable"] | default(None) }}
cmd: home.weather.pic={{ nextion.pic.weather[states(weather_entity) | default("unavailable")
if weather_entity is string and has_value(weather_entity)
else "unavailable"] | default(None) }}
continue_on_error: true
- &refresh-page_home-outdoor_temp
@@ -7417,7 +7419,7 @@ action:
)
}}
icon:
icon: !input 'home_indoor_temp_icon' # E50E
icon: !input 'home_indoor_temp_icon'
color_rgb: !input 'home_indoor_temp_icon_color'
label:
color_rgb: !input 'home_indoor_temp_label_color'
@@ -7474,7 +7476,6 @@ action:
##### SET Left Hardware Button PIC on Home Page ####
- if: '{{ left_button_state not in ["unavailable", "unknown", "", None] }}'
then:
# Hardware Button PIC
- *delay-default
- service: '{{ nextion.command.printf }}'
data:
@@ -7484,7 +7485,6 @@ action:
##### SET Right Hardware Button PIC on Home Page #####
- if: '{{ right_button_state not in ["unavailable", "unknown", "", None] }}'
then:
# Hardware Button PIC
- *delay-default
- service: '{{ nextion.command.printf }}'
data:
@@ -8089,7 +8089,9 @@ action:
if repeat.item.icon.split(":") | count > 0
else repeat.item.icon
}}
{% elif state_attr(repeat.item.entity, "icon") | default("") not in ["unavailable", "unknown", "", None] and all_icons[state_attr(repeat.item.entity, "icon").split(":")[1]] != null %}
{% elif
state_attr(repeat.item.entity, "icon") | default("") not in ["unavailable", "unknown", "", None] and
all_icons[state_attr(repeat.item.entity, "icon").split(":")[1]] != null %}
{{ all_icons[state_attr(repeat.item.entity, "icon").split(":")[1]] | default(all_icons.unknown) }}
{% elif repeat.item.entity and repeat.item.entity.split(".") | count > 1 %}
{{ nextion.icon.domain[repeat.item.entity.split(".")[0] if repeat.item.entity else "unknown"] }}
@@ -8118,11 +8120,18 @@ action:
{{ (state_attr(repeat.item.entity, "brightness") | int * 100 /255) | round(0) }}%
{% elif item_domain == "fan" and current_entity_state == "on" and state_attr(repeat.item.entity, "percentage") != None %}
{{ state_attr(repeat.item.entity, "percentage") | round(0, default=0) }}%
{% elif item_domain == "cover" and current_entity_state in ["open", "opening", "closing"] and state_attr(repeat.item.entity, "current_position") != None %}
{% 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 state_attr(repeat.item.entity, 'current_temperature') != None %}
{% set current_temperature = state_attr(repeat.item.entity, 'current_temperature') | float %}
{{ current_temperature | round(0) if current_temperature >= 100 or temperature_units in ["F", "f", "°F", "°f", "K", "k"] else current_temperature | round(1) }}{{ temperature_units }}
{{
current_temperature | round(0)
if current_temperature >= 100 or temperature_units in ["F", "f", "°F", "°f", "K", "k"]
else current_temperature | round(1)
}}{{ temperature_units}}
{% else %} 0
{% endif %}
- *delay-default
@@ -8449,8 +8458,18 @@ action:
is_volume_muted: '{{ media_player.is_volume_muted if media_player.is_volume_muted is boolean else false }}'
friendly_name: '{{ media_player.friendly_name if media_player.friendly_name is string else "" }}'
volume_level: '{{ media_player.volume_level }}'
media_title: '{{ media_player.media_title if media_player.media_title is string and media_player.media_title not in [null, None, "unknown", "unavailable"] else "" }}'
media_artist: '{{ media_player.media_artist if media_player.media_artist is string and media_player.media_artist not in [null, None, "unknown", "unavailable"] else "" }}'
media_title: >
{{
media_player.media_title
if media_player.media_title is string and media_player.media_title not in [null, None, "unknown", "unavailable"]
else ""
}}
media_artist: >
{{
media_player.media_artist
if media_player.media_artist is string and media_player.media_artist not in [null, None, "unknown", "unavailable"]
else ""
}}
media_duration: '{{ media_player.media_duration }}'
media_position: '{{ media_player.media_position }}'
media_position_delta: >
@@ -8966,15 +8985,37 @@ action:
{% else %} Other
{% endif %}
weather_units:
humidity: '{{ state_attr(weather_entity, "humidity_unit") | default("%") if weather_entity is string and state_attr(weather_entity, "humidity_unit") else "%" }}'
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 "%" }}'
humidity: >
{{
state_attr(weather_entity, "humidity_unit") | default("%")
if weather_entity is string and state_attr(weather_entity, "humidity_unit")
else "%"
}}
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 "%" }}'
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 }}'