Performance improvement: Temperature min/max

Performance improvement: Temperature min/max
This commit is contained in:
Blackymas
2023-04-05 22:54:30 +02:00
committed by GitHub

View File

@@ -4896,29 +4896,19 @@ action:
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) }}"
- *delay-default
##### Display temperature (min) when available
- if: "{{ is_number(temp_min) }}"
then:
##### SET TEMP MIN ####
- service: "{{ nextion.commands.text_printf }}"
data:
component: "{{ page_name }}.temp_min" ### Temperature MIN ###
message: "{{temp_min | round(0)}}{{ weather_units.temperature }}"
- *delay-default
##### Slash #####
- service: "{{ nextion.commands.text_printf }}"
data:
component: "{{ page_name }}.slash"
message: '/'
- *delay-default
##### Display temperature (max)) when available
- if: "{{ is_number(temp_max) }}"
##### Display temperature min/max when available
- variables:
temperature_string: >
{{ (temp_min | round(0) ~ weather_units.temperature) if is_number(temp_min) }}
{{ '/' if is_number(temp_min) and is_number(temp_max) }}
{{ (('+' if temp_min | float(1) <= 0 and temp_max | float(-1) > 0) ~ temp_max | round(0) ~ weather_units.temperature) if is_number(temp_max) }}
- 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 }}"
data:
component: "{{ page_name }}.temp_max" ### Temperature MAX ###
message: "{{ (temp_max | round(0) ~ weather_units.temperature) if is_number(temp_max) else '?' }}"
component: "{{ page_name }}.temperature" ### Temperature MIN/MAX ###
message: "{{ temperature_string }}"
- *delay-default
##### fields 1 to 5 (Parameters) #####