mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
119 lines
5.1 KiB
YAML
119 lines
5.1 KiB
YAML
# TODO
|
|
# Update to account for new get_weather_forcats BS a
|
|
|
|
template:
|
|
# - binary_sensor:
|
|
# - name: Precipitation Likely Soon
|
|
# unique_id: templatebinarysensor.precipitation_likely_soon
|
|
# icon: mdi:weather-rainy
|
|
# availability: "{{ states('sensor.openweathermap_hourly_forecast_precipitation_probability') not in ['unknown', 'unavailable'] }}"
|
|
# state: "{{ states('sensor.openweathermap_hourly_forecast_precipitation_probability')|float(default=0) >= 50.0 }}"
|
|
|
|
# - name: Precipitation Likely
|
|
# unique_id: templatebinarysensor.precipitation_likely
|
|
# icon: mdi:weather-rainy
|
|
# availability: "{{ states('sensor.openweathermap_daily_forecast_precipitation_probability') not in ['unknown', 'unavailable'] }}"
|
|
# state: "{{ states('sensor.openweathermap_daily_forecast_precipitation_probability')|float(default=0) >= 50.0 }}"
|
|
|
|
- trigger:
|
|
- platform: time_pattern
|
|
hours: /1
|
|
|
|
- platform: event
|
|
event_type: event_template_reloaded
|
|
id: "reload"
|
|
|
|
- platform: homeassistant
|
|
event: start
|
|
|
|
action:
|
|
- action: weather.get_forecasts
|
|
data:
|
|
type: daily
|
|
target:
|
|
entity_id: weather.home
|
|
response_variable: daily
|
|
|
|
- action: weather.get_forecasts
|
|
data:
|
|
type: hourly
|
|
target:
|
|
entity_id: weather.home
|
|
response_variable: hourly
|
|
|
|
binary_sensor:
|
|
- name: "Impending Rain"
|
|
unique_id: templatebinarysensor.impending_rain
|
|
availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
icon: mdi:weather-rainy
|
|
# This looks too far into the future. Cutting it down a bit
|
|
state: >-
|
|
{%- set totalprecipitation = 0 | float -%}
|
|
{%- set upcoming_precipitation = 0 | float -%}
|
|
{%- set ns = namespace() -%}
|
|
{%- set ns.totalprecipitation = 0 -%}
|
|
{%- for daypart in range(0, 8) -%}
|
|
{%- set precipitation = hourly['weather.home'].forecast[daypart].precipitation -%}
|
|
{%- set wind_speed = hourly['weather.home'].forecast[daypart].wind_speed -%}
|
|
{% if wind_speed > states('input_number.wind_speed_blowing_rain') |float(default=0) %}
|
|
{%- set upcoming_precipitation = precipitation -%}
|
|
{%- endif -%}
|
|
{%- set ns.totalprecipitation = ns.totalprecipitation + upcoming_precipitation -%}
|
|
{%- endfor %}
|
|
{{ ns.totalprecipitation / 100 | float | round(0) > 0.99 }}
|
|
|
|
sensor:
|
|
- name: "Sprinkler: Total Expected Precipitation"
|
|
unique_id: "custom_sensor.sprinkler_total_expected_precipitation"
|
|
icon: mdi:weather-pouring
|
|
unit_of_measurement: mm
|
|
availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
state: >
|
|
{%- set totalprecipitation = 0 | float -%}
|
|
{%- set upcoming_precipitation = 0 | float -%}
|
|
{%- set ns = namespace() -%}
|
|
{%- set ns.totalprecipitation = 0 -%}
|
|
{%- for daypart in range(0, 5) -%}
|
|
{%- set precipitation = daily['weather.home'].forecast[daypart].precipitation * 25.4 -%}
|
|
{%- set upcoming_precipitation = precipitation -%}
|
|
{%- set ns.totalprecipitation = ns.totalprecipitation + upcoming_precipitation -%}
|
|
{%- endfor %}
|
|
{{ ns.totalprecipitation | float | round(0) }}
|
|
|
|
- name: "Today's Low Temperature"
|
|
unique_id: templatesensor.templow_today
|
|
unit_of_measurement: °F
|
|
availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
state: "{{ daily['weather.home'].forecast[0].templow }}"
|
|
|
|
- name: "Today's High Temperature"
|
|
unique_id: templatesensor.temphigh_today
|
|
unit_of_measurement: °F
|
|
availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
state: "{{ daily['weather.home'].forecast[0].temperature}}"
|
|
|
|
# - name: "Today's Chance of Precipitation"
|
|
# unique_id: templatesensor.precip_chance_today
|
|
# icon: mdi:cloud-percent
|
|
# unit_of_measurement: '%'
|
|
# availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
# state: "{{ daily['weather.home'].forecast[0].precipitation_probability}}"
|
|
|
|
- name: "Tomorrow's Low Temperature"
|
|
unique_id: templatesensor.templow_tomorrow
|
|
unit_of_measurement: °F
|
|
availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
state: "{{ daily['weather.home'].forecast[1].templow}}"
|
|
|
|
- name: "Tomorrow's High Temperature"
|
|
unique_id: templatesensor.temphigh_tomorrow
|
|
unit_of_measurement: °F
|
|
availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
state: "{{ daily['weather.home'].forecast[1].temperature}}"
|
|
# - name: "Tomorrow's Chance of Precipitation"
|
|
# unique_id: templatesensor.precip_chance_tomorrow
|
|
# icon: mdi:cloud-percent
|
|
# unit_of_measurement: '%'
|
|
# availability: "{{ states('weather.home') not in ['unknown', 'unavailable'] }}"
|
|
# state: "{{ daily['weather.home'].forecast[1].precipitation_probability}}"
|