mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-06-14 03:48:53 +00:00
Enhance UV index reporting by adding weather-related tips and improving sensor data display
This commit is contained in:
parent
571b964dd3
commit
c5ab958dbf
@ -162,12 +162,25 @@
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro uv() -%}
|
||||
{% if states.sensor.pirateweather_uv_index.state|int(9999)>= 6 and states.sensor.pirateweather_uv_index.state|int(9999)<= 7.9 %}
|
||||
Today's UV index is {{ states.sensor.pirateweather_uv_index.state }}. You should wear sunscreen if going outside.
|
||||
{% elif states.sensor.pirateweather_uv_index.state|int(9999)>= 8 and states.sensor.pirateweather_uv_index.state|int(9999)<=10.9 %}
|
||||
Today's UV index is {{ states.sensor.pirateweather_uv_index.state }}. This is VERY HIGH. Be sure wear sunscreen and re-apply.
|
||||
{% elif states.sensor.pirateweather_uv_index.state|int(9999)>= 11 %}
|
||||
Today's UV index is {{ states.sensor.pirateweather_uv_index.state }}. This is EXTREME. You should be very cautious going outside.
|
||||
{% if states.sensor.pirateweather_uv_index.state|int(9999)>= 6 %}
|
||||
Today's UV index is {{ states.sensor.pirateweather_uv_index.state }}.
|
||||
{%- for entity in states.sensor if 'pirateweather' in entity.entity_id %}
|
||||
{%- set state = entity.state %}
|
||||
{%- set unit = entity.attributes.unit_of_measurement if 'unit_of_measurement' in entity.attributes else '' %}
|
||||
{%- set friendly_name = ' '.join(entity.attributes.friendly_name.split(' ')[1:]) %}
|
||||
{%- if state not in ['0', '0.0', 'none'] and 'UV Index' not in friendly_name %}
|
||||
{%- if 'Temperature' in friendly_name -%}
|
||||
{{ friendly_name }}: {{ state }} {{ unit }}
|
||||
{%- elif 'Minutely' in friendly_name -%}
|
||||
{{ friendly_name }}: {{ state }} {{ unit }}
|
||||
{%- elif 'Cloud Coverage' in friendly_name and state | float > 75 -%}
|
||||
{{ friendly_name }}: {{ state }} {{ unit }}
|
||||
{%- elif 'Humidity' in friendly_name and (state | float < 50 or state | float > 85) -%}
|
||||
{{ friendly_name }}: {{ state }} {{ unit }}
|
||||
{%- endif -%}
|
||||
{%- endif %}
|
||||
{% endfor -%}
|
||||
[Give helpful tip based on the current UV index and weather conditions]
|
||||
{% endif %}
|
||||
{%- endmacro -%}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user