Files
Home-Assistant-Configs/packages/custom_weather.yaml

1608 lines
66 KiB
YAML

weather:
- platform: template
name: "Iron Nerd Weather Station"
condition_template: >
{% set stations = [
states.weather.home,
states.weather.kdfi_daynight,
states.weather.iron_nerd_studios,
states.weather.openweathermap
] %}
{% set result = stations | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) }}
temperature_template: >
{% set temps = [
states.sensor.home_tempest_temperature,
states.sensor.home_temperature,
states.sensor.kdfi_temperature,
states.sensor.pirateweather_temperature,
states.sensor.openweathermap_temperature
] %}
{% set sensor = temps | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
temperature_unit: °F
dew_point_template: >
{% set dewpoints = [
states.sensor.home_tempest_dew_point,
states.sensor.home_dew_point,
states.sensor.kdfi_dew_point,
states.sensor.pirateweather_dew_point,
states.sensor.openweathermap_dew_point
] %}
{% set sensor = dewpoints | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
apparent_temperature_template: >
{% set apparent_temps = [
states.sensor.home_tempest_feels_like,
states.sensor.home_temperature_feels_like,
states.sensor.pirateweather_apparent_temperature,
states.sensor.stratton_ave_apparent_temperature
] %}
{% set sensor = apparent_temps | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
humidity_template: >
{% set humidity = [
states.sensor.home_tempest_humidity,
states.sensor.home_relative_humidity,
states.sensor.kdfi_relative_humidity,
states.sensor.pirateweather_humidity,
states.sensor.openweathermap_humidity
] %}
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
forecast_daily_template: >
{% set forecasts = [
states.sensor.weather_com_daily_weather_forecast.attributes,
states.weather.kdfi_daynight.attributes,
states.sensor.pirateweather_daily_weather_forecast.attributes,
states.sensor.openweathermap_daily_weather_forecast.attributes,
states.weather.weatherapi_stratton_ave.attributes
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
forecast_hourly_template: >
{% set forecasts = [
states.sensor.weather_com_hourly_weather_forecast,
states.sensor.pirateweather_hourly_weather_forecast.attributes
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
pressure_template: >
{% set pressures = [
states.sensor.home_pressure,
states.sensor.kdfi_barometric_pressure
] %}
{% set result = pressures | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
pressure_unit: inHg
wind_speed_template: >
{% set windspeeds = [
states.sensor.home_wind_speed,
states.sensor.pirateweather_wind_speed,
states.sensor.kdfi_wind_speed,
states.sensor.openweathermap_wind_speed
] %}
{% set result = windspeeds | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
wind_speed_unit: mph
wind_bearing_template: >
{% set windbearings = [
states.sensor.home_wind_direction_degrees,
states.sensor.pirateweather_wind_bearing,
states.sensor.openweathermap_wind_bearing
] %}
{% set result = windbearings | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
visibility_template: >
{% set vis = [
states.sensor.kdfi_visibility,
states.sensor.pirateweather_visibility,
states.sensor.openweathermap_visibility
] %}
{% set result = vis | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
visibility_unit: mi
attribution_template: "Daily weather data from Iron Nerd's custom weather station template"
ozone_template: >
{% set ozones = [
states.sensor.pirateweather_ozone
] %}
{% set result = ozones | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
precipitation_unit: in
- platform: template
name: "Iron Nerd Weather Station - Hourly"
condition_template: >
{% set stations = [
states.weather.home,
states.weather.tomorrow_io_stratton_ave_hourly,
states.weather.iron_nerd_studios,
states.weather.kdfi_daynight,
states.weather.openweathermap
] %}
{% set result = stations | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) }}
temperature_template: >
{% set temps = [
states.sensor.home_tempest_temperature,
states.sensor.home_temperature,
states.sensor.kdfi_temperature,
states.sensor.pirateweather_temperature,
states.sensor.openweathermap_temperature
] %}
{% set sensor = temps | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
temperature_unit: °F
dew_point_template: >
{% set dewpoints = [
states.sensor.home_tempest_dew_point,
states.sensor.home_dew_point,
states.sensor.kdfi_dew_point,
states.sensor.pirateweather_dew_point,
states.sensor.openweathermap_dew_point
] %}
{% set sensor = dewpoints | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
apparent_temperature_template: >
{% set apparent_temps = [
states.sensor.home_tempest_feels_like,
states.sensor.home_temperature_feels_like,
states.sensor.pirateweather_apparent_temperature,
states.sensor.stratton_ave_apparent_temperature
] %}
{% set sensor = apparent_temps | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
humidity_template: >
{% set humidity = [
states.sensor.home_tempest_humidity,
states.sensor.home_relative_humidity,
states.sensor.kdfi_relative_humidity,
states.sensor.pirateweather_humidity,
states.sensor.openweathermap_humidity
] %}
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
forecast_hourly_template: >
{% set forecasts = [
states.sensor.weather_com_hourly_weather_forecast,
states.weather.tomorrow_io_stratton_ave_hourly.attributes,
states.sensor.pirateweather_hourly_weather_forecast.attributes
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
pressure_template: >
{% set pressures = [
states.sensor.home_pressure,
states.sensor.kdfi_barometric_pressure
] %}
{% set result = pressures | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
pressure_unit: inHg
wind_speed_template: >
{% set windspeeds = [
states.sensor.home_wind_speed,
states.sensor.pirateweather_wind_speed,
states.sensor.kdfi_wind_speed,
states.sensor.openweathermap_wind_speed
] %}
{% set result = windspeeds | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
wind_speed_unit: mph
wind_bearing_template: >
{% set windbearings = [
states.sensor.home_wind_direction_degrees,
states.sensor.pirateweather_wind_bearing,
states.sensor.openweathermap_wind_bearing
] %}
{% set result = windbearings | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
visibility_template: >
{% set vis = [
states.sensor.kdfi_visibility,
states.sensor.pirateweather_visibility,
states.sensor.openweathermap_visibility
] %}
{% set result = vis | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
visibility_unit: mi
attribution_template: "Hourly weather data from Iron Nerd's custom weather station template"
ozone_template: >
{% set ozones = [
states.sensor.pirateweather_ozone
] %}
{% set result = ozones | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
precipitation_unit: in
- platform: template
name: "Ashland Weather Station"
condition_template: >
{% set stations = [
states.weather.ashland,
states.weather.kasx,
states.weather.pirateweather_ashland
] %}
{% set result = stations | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) }}
temperature_template: >
{% set temps = [
states.sensor.ashland_temperature,
states.sensor.kasx_temperature,
states.sensor.pirateweather_ashland_temperature
] %}
{% set sensor = temps | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(sensor) | float }}
temperature_unit: °F
humidity_template: >
{% set humidity = [
states.sensor.ashland_relative_humidity,
states.sensor.kasx_relative_humidity,
states.sensor.pirateweather_ashland_humidity
] %}
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
forecast_daily_template: >
{% set forecasts = [
states.sensor.weather_com_ashland_daily_weather_forecast.attributes,
states.weather.kasx.attributes,
states.sensor.pirateweather_ashland_daily_weather_forecast.attributes
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
forecast_hourly_template: >
{% set forecasts = [
states.sensor.weather_com_ashland_hourly_weather_forecast,
states.sensor.pirateweather_ashland_hourly_weather_forecast.attributes
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
pressure_template: >
{% set pressures = [
states.sensor.ashland_pressure,
states.sensor.kasx_barometric_pressure
] %}
{% set result = pressures | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
pressure_unit: inHg
wind_speed_template: >
{% set windspeeds = [
states.sensor.ashland_wind_speed,
states.sensor.pirateweather_ashland_wind_speed,
states.sensor.kasx_wind_speed
] %}
{% set result = windspeeds | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
wind_speed_unit: mph
wind_bearing_template: >
{% set windbearings = [
states.sensor.ashland_wind_direction_degrees,
states.sensor.pirateweather_ashland_wind_bearing
] %}
{% set result = windbearings | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
visibility_template: >
{% set vis = [
states.sensor.kasx_visibility,
states.sensor.pirateweather_ashland_visibility
] %}
{% set result = vis | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
visibility_unit: mi
attribution_template: "Daily weather data from Iron Nerd's custom weather station template"
ozone_template: >
{% set ozones = [
states.sensor.pirateweather_ashland_ozone
] %}
{% set result = ozones | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
precipitation_unit: in
# binary_sensor:
# - platform: bayesian
# unique_id: 3e9640d9-57a0-4495-8731-e64b34774065
# name: Raining Bayesian
# prior: 0.17
# probability_threshold: 0.6
# observations:
# - entity_id: "sensor.pirateweather_precip"
# prob_given_true: 0.13
# prob_given_false: 0.005
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.openweathermap_precipitation_kind"
# prob_given_true: 0.75
# prob_given_false: 0.005
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.tomorrow_io_stratton_ave_precipitation_type"
# prob_given_true: 0.99
# prob_given_false: 0.2
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.stratton_ave_precipitation"
# prob_given_true: 0.99
# prob_given_false: 0.2
# platform: "numeric_state"
# above: 0
sensor:
- platform: weatheralerts
state: OH
zone: 4
county: 39
# - platform: statistics
# unique_id: b5996cb4-b715-4fc9-b3d8-98fc12c2b7dd
# name: Outside Temp Average
# entity_id: sensor.pirateweather_temperature
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: 6192c95a-8fd1-4ba0-87de-d06fdc071d6b
# name: Apparent Temp Average
# entity_id: sensor.stratton_ave_apparent_temperature
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: 7b9c269c-40b7-4255-a051-2d1b7a6af017
# name: Wind Speed Average
# entity_id: sensor.pirateweather_wind_speed
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: b43d053f-aafb-4237-a742-a2ca841498fa
# name: Visibility Stats Average
# entity_id: sensor.kdfi_visibility
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: b1206da2-fa00-4f7d-9af4-f2cf6794bd24
# name: Humidity Stats Average
# entity_id: sensor.pirateweather_humidity
# state_characteristic: average_linear
# max_age:
# days: 7
template:
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.iron_nerd_studios
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.iron_nerd_studios
response_variable: daily
- variables:
today: "{{ daily['weather.iron_nerd_studios'].forecast[0] }}"
sensor:
- name: Pirateweather Daily Weather Forecast
unique_id: 1542a900-5269-4daa-b893-72c7e7d892ab
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ daily['weather.iron_nerd_studios'].forecast }}"
- name: Pirateweather High
unique_id: 0b28d11d-4bb3-4f61-8d0e-43e50ccef60d
state: "{{ today.temperature }}"
unit_of_measurement: °F
- name: Pirateweather Low
unique_id: ed62ca6a-ec1d-484c-84a6-ea70b5f38c75
state: "{{ today.templow }}"
unit_of_measurement: °F
- name: Pirateweather Rain Chance Today
unique_id: 4c138bd5-57ee-4136-9449-6f172ddb08fb
state: "{{ today.precipitation_probability }}"
unit_of_measurement: "%"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.iron_nerd_studios
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.iron_nerd_studios
response_variable: hourly
sensor:
- name: Pirateweather Hourly Weather Forecast
unique_id: edc7d867-78fa-4a6b-9b01-fa9d268a8fc0
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ hourly['weather.iron_nerd_studios'].forecast }}"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.home
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.home
response_variable: daily
- variables:
today: "{{ daily['weather.home'].forecast[0] }}"
sensor:
- name: Weather.com Daily Weather Forecast
unique_id: 6c53fb52-284f-4a12-bea3-ce56fcbbf954
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ daily['weather.home'].forecast }}"
- name: Weather.com High
unique_id: eb721062-ef9d-45b4-85d6-10a7a3101d8f
state: >
{% if is_number(today.temperature) %}
{{ today.temperature }}
{% else %}
{{ state_attr('weather.home','temperature') }}
{% endif %}
unit_of_measurement: °F
- name: Weather.com Low
unique_id: cc898dc4-e0ff-4bc1-a538-dea089f4bf07
state: "{{ today.templow }}"
unit_of_measurement: °F
- name: Weather.com Rain Chance Today
unique_id: df274a33-baf2-4c64-83f9-550c021e01ec
state: "{{ today.precipitation_probability }}"
unit_of_measurement: "%"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.home
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
sensor:
- name: Weather.com Hourly Weather Forecast
unique_id: 1b193fbb-331d-40eb-999c-73a45f68716d
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ hourly['weather.home'].forecast }}"
- trigger:
- platform: time_pattern
minutes: /5
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.openweathermap
response_variable: daily
- variables:
today: "{{ daily['weather.openweathermap'].forecast[0] }}"
sensor:
- name: OpenWeatherMap Daily Weather Forecast
unique_id: ebd3fac7-897f-4d41-ba1a-5eafae38f49e
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ daily['weather.openweathermap'].forecast }}"
- name: OpenWeatherMap High
unique_id: 14154c18-dec9-4b6f-b536-cb10c619d5fe
state: "{{ today.temperature }}"
unit_of_measurement: °F
- name: OpenWeatherMap Low
unique_id: 2e14e5f3-da1c-433a-8196-f1df0cb6e903
state: "{{ today.templow }}"
unit_of_measurement: °F
- name: OpenWeatherMap Rain Chance Today
unique_id: 5bece9ad-2e1e-45a9-a690-93f8ff1d8780
state: "{{ today.precipitation_probability }}"
unit_of_measurement: "%"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.pirateweather_ashland
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.pirateweather_ashland
response_variable: daily
- variables:
today: "{{ daily['weather.pirateweather_ashland'].forecast[0] }}"
sensor:
- name: Pirateweather Ashland Daily Weather Forecast
unique_id: 9b103d9e-0fa3-4b47-b95d-c0caa4621895
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ daily['weather.pirateweather_ashland'].forecast }}"
- name: Pirateweather Ashland High
unique_id: 21bf1e49-c3e3-4cec-8c89-add9e9efe9f3
state: "{{ today.temperature }}"
unit_of_measurement: °F
- name: Pirateweather Ashland Low
unique_id: fe06c076-807e-43a1-8413-c31ec389ec08
state: "{{ today.templow }}"
unit_of_measurement: °F
- name: Pirateweather Ashland Rain Chance Today
unique_id: 687b2246-ae49-47e0-95f3-f93dd159a43c
state: "{{ today.precipitation_probability }}"
unit_of_measurement: "%"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.pirateweather_ashland
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.pirateweather_ashland
response_variable: hourly
sensor:
- name: Pirateweather Ashland Hourly Weather Forecast
unique_id: bcc4ca8c-aee7-4238-a78d-c35dae8c2c2b
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ hourly['weather.pirateweather_ashland'].forecast }}"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.ashland
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.ashland
response_variable: daily
- variables:
today: "{{ daily['weather.ashland'].forecast[0] }}"
sensor:
- name: Weather.com Ashland Daily Weather Forecast
unique_id: f658e6ce-26a2-4c0d-9dc1-0bf26e95caf3
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ daily['weather.ashland'].forecast }}"
- name: Weather.com Ashland High
unique_id: b5cf81b7-9a24-47c5-a5ee-9f3367251c83
state: >
{% if is_number(today.temperature) %}
{{ today.temperature }}
{% else %}
{{ state_attr('weather.ashland','temperature') }}
{% endif %}
unit_of_measurement: °F
- name: Weather.com Ashland Low
unique_id: 196fb8a5-8ff5-47f1-ada5-dd1d3a69d596
state: "{{ today.templow }}"
unit_of_measurement: °F
- name: Weather.com Ashland Rain Chance Today
unique_id: 2e84209b-8d0a-425a-8c24-10ad8cf0c029
state: "{{ today.precipitation_probability }}"
unit_of_measurement: "%"
- trigger:
- platform: time_pattern
minutes: /15
- platform: state
entity_id: weather.ashland
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.ashland
response_variable: hourly
sensor:
- name: Weather.com Ashland Hourly Weather Forecast
unique_id: 463cbe89-997c-49cc-a644-9e05ffd804ff
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ hourly['weather.ashland'].forecast }}"
- binary_sensor:
- name: Heat Threshold
unique_id: 849a08bb-d4e6-40e9-ae42-50f7fb71b727
state: >
{% set temp = state_attr('weather.iron_nerd_weather_station','temperature') | int %}
{% set threshold = states('input_number.hot_day_threshold') | int %}
{{ temp >= threshold }}
device_class: heat
attributes:
current_temp: "{{ state_attr('weather.iron_nerd_weather_station','temperature') | int }}"
threshold: "{{ states('input_number.hot_day_threshold') | int }}"
- name: Heat Index Threshold
unique_id: aae2cd89-dde2-4557-923c-b476d1b49b88
state: >
{% set feelslike = states('sensor.stratton_ave_apparent_temperature') | int %}
{% set threshold = states('input_number.heat_index_threshold') | int %}
{{ feelslike >= threshold }}
device_class: heat
attributes:
current_temp: "{{ states('sensor.stratton_ave_apparent_temperature') | int }}"
threshold: "{{ states('input_number.heat_index_threshold') | int }}"
- name: Cold Threshold
unique_id: a7c97b91-6d42-433a-a96b-94e39c58d63f
state: >
{% set temp = state_attr('weather.iron_nerd_weather_station','temperature') | int %}
{% set threshold = states('input_number.cold_day_threshold') | int %}
{{ temp <= threshold }}
device_class: cold
attributes:
current_temp: "{{ state_attr('weather.iron_nerd_weather_station','temperature') | int }}"
threshold: "{{ states('input_number.cold_day_threshold') | int }}"
- name: Overnight Low Threshold
unique_id: 6869e6eb-c8a6-43c8-aa4d-4d50659811b8
state: >
{% set temp = state_attr('weather.iron_nerd_weather_station','temperature') | int %}
{% set threshold = states('input_number.overnight_low_threshold') | int%}
{{ temp <= threshold }}
device_class: cold
attributes:
current_temp: "{{ state_attr('weather.iron_nerd_weather_station','temperature') | int }}"
threshold: "{{ states('input_number.overnight_low_threshold') | int }}"
- name: Wind Chill Threshold
unique_id: c734b642-b85d-465c-b3c3-aadbe4a00dc1
state: >
{% set feelslike = states('sensor.stratton_ave_apparent_temperature') | int %}
{% set threshold = states('input_number.wind_chill_threshold') | int %}
{{ feelslike <= threshold }}
device_class: cold
attributes:
current_temp: "{{ state_attr('weather.iron_nerd_weather_station','temperature') | int }}"
threshold: "{{ states('input_number.wind_chill_threshold') | int }}"
- name: Heat Warning
unique_id: 02b8020a-4fa1-4489-abea-bfadf82ec7e5
state: >
{% set day = states('sensor.todays_high_temp') | int %}
{% set night = states('sensor.overnight_lowest_temperature') | int %}
{% set dayThreshold = states('input_number.extended_heat_threshold') | int %}
{% set nightThreshold = states('input_number.hot_overnight_threshold') | int %}
{% set hotDayThreshold = states('input_number.hot_day_threshold') | int %}
{{ (day >= dayThreshold and night >= nightThreshold) or day >= hotDayThreshold }}
device_class: heat
attributes:
trigger: >
{% set day = states('sensor.todays_high_temp') | int %}
{% set night = states('sensor.overnight_lowest_temperature') | int %}
{% set dayThreshold = states('input_number.extended_heat_threshold') | int %}
{% set nightThreshold = states('input_number.hot_overnight_threshold') | int %}
{% set hotDayThreshold = states('input_number.hot_day_threshold') | int %}
{% if day >= dayThreshold and night >= nightThreshold %}
Extended Threat
{% elif day >= hotDayThreshold %}
Hot Day
{% else %}
No Trigger
{% endif %}
danger: >
{% set day = states('sensor.todays_high_temp') | int %}
{% set night = states('sensor.overnight_lowest_temperature') | int %}
{% set dayThreshold = states('input_number.extended_heat_threshold') | int + 10 %}
{% set nightThreshold = states('input_number.hot_overnight_threshold') | int + 10 %}
{% set hotDayThreshold = states('input_number.hot_day_threshold') | int + 5 %}
{% if (day >= dayThreshold and night >= nightThreshold) or day >= hotDayThreshold %}
Extreme
{% else %}
Normal
{% endif %}
- name: "Lightning Warning"
unique_id: edaddfc4-f7f0-4d75-aada-a2c588afe029
state: "{{ states('sensor.blitzortung_lightning_counter') | int > 0 }}"
device_class: safety
attributes:
current_strikes: "{{ states('sensor.blitzortung_lightning_counter') | int }}"
icon: "{{ 'mdi:flash-alert' if states('sensor.blitzortung_lightning_counter') | int > 0 else 'mdi:flash-outline'}}"
- name: "Audible Weather Alerts Allowed"
unique_id: 03851823-32d5-44c1-af42-256fcd922069
state: >
{% if is_state('input_boolean.audible_notifications','on') %}
true
{% elif is_state('binary_sensor.basement_occupied','on') %}
true
{% elif states('sensor.people_sleeping_total') | int == 3 %}
false
{% elif is_state('input_boolean.kallen_overnight','on') and (states('sensor.people_sleeping_total') | int == 2) %}
false
{% elif is_state('input_boolean.vacation_mode','on') %}
false
{% else %}
true
{% endif %}
attributes:
location: >
{% if is_state('binary_sensor.basement_occupied','on') and is_state('input_boolean.master_bedroom_sleeping','on') %}
basement
{% elif is_state('binary_sensor.people_sleeping','off') %}
everywhere
{% else %}
common
{% endif %}
- name: Raining
unique_id: 232b43a4-4598-4315-ab76-42348c11e6ff
state: >
{{ states('sensor.total_rain_sensors') | int > 1 }}
icon: "{{ 'mdi:weather-rainy' if states('sensor.total_rain_sensors') | int > 1 else 'mdi:weather-cloudy' }}"
- sensor:
- name: Total Rain Sensors
unique_id: b7c2e709-8f5c-4263-aa1d-fa8280afcddb
unit_of_measurement: 'sensors'
state: >
{% set sensors = [
states.sensor.pirateweather_precip,
states.sensor.openweathermap_precipitation_kind,
states.sensor.tomorrow_io_stratton_ave_precipitation_type
] %}
{% set numeric_sensors = [
states.sensor.stratton_ave_precipitation
] %}
{% set c1 = sensors | selectattr('state','eq','rain') | list | count %}
{% set c2 = numeric_sensors | map(attribute='state') | map('float') | select('gt',0) | list | count %}
{{ (c1 + c2) | int }}
- name: Current Forecast
unique_id: c0faea33-2ac3-40f1-8558-584c3f5d6b16
icon: mdi:weather-sunny
state: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.condition }}
attributes:
high_temp: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.temperature }}
overnight_low: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.templow }}
wind_bearing: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.wind_bearing }}
wind_speed: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.wind_speed }}
precipitation: >-
{% if state_attr('weather.iron_nerd_weather_station','precipitation') %}
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{% else %}
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{% endif %}
{{ forecast.precipitation }}
friendly: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.condition | replace("partlycloudy","partly cloudy") }}
- name: Current Forecast Detail
unique_id: e5ae9864-70b5-402c-9d2f-c4d6a10085df
icon: mdi:weather-sunny
state: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{{ [
'Today in Defiance ',
'Later Today ',
'For the rest of the day '
] | random }}
expect a high of {{ states('sensor.todays_high_temp') }}
{%- if states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','off')%}
{{ [
'and sunny. ',
'with sun. ',
'with sunny conditions prevailing. '
] | random }}
{%- elif states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','on') %}
{{ [
'and clear. ',
'with clear skies. '
] | random }}
{%- elif states('sensor.current_forecast') == 'clear-night' %}
{{ [
'and clear. ',
'with clear skies. '
] | random }}
{%- elif states('sensor.current_forecast') == 'rainy' %}
{{ [
'with rain. ',
'with showers. ',
'and rainy. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'snowy' %}
{{ [
'with snow. ',
'with snow showers. '
] | random }}
{{ [
'Snowfall accumulations ',
'Total snowfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'snowy-rainy' %}
{{ [
'with mix preciptation possible. ',
'with snow and rain showers. '
] | random }}
Total accumulation near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'windy' %}
{{ [
'and windy. ',
'with lots of wind. '
] | random }}
{%- elif states('sensor.current_forecast') == 'fog' %}
{{ [
'and foggy. ',
'with some fog. '
] | random }}
{% elif states('sensor.current_forecast') == 'cloudy' %}
{{ [
'with clouds. ',
'with cloudy skies. '
] | random }}
{% elif states('sensor.current_forecast') == 'partlycloudy' %}
{{ [
'with some clouds. ',
'with partly cloudy skies. ',
'with scattered clouds '
] | random }}
{%- elif states('sensor.current_forecast') == 'hail' %}
{{ [
'with severe thunderstorms possible. ',
'with hail possible. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'lightning' %}
{{ [
'with thunderstorms possible. ',
'with the potential of thunderstorms. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{% endif -%}
{{ [
'Later tonight expect a low of ',
'Overnight expect a low of '
] | random }}
{{ states('sensor.overnight_lowest_temperature') }} degrees.
{%- endmacro -%}
{{- cleanup(getReport()) -}}
- name: Tomorrows Forecast
unique_id: a8ae26b0-ed26-4568-bb2b-f7c72707b009
icon: mdi:weather-sunny
state: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[1] %}
{{ forecast.condition }}
attributes:
high_temp: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[1] %}
{{ forecast.temperature }}
overnight_low: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[1] %}
{{ forecast.templow }}
wind_bearing: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[1] %}
{{ forecast.wind_bearing }}
wind_speed: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[1] %}
{{ forecast.wind_speed }}
precipitation: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[1] %}
{{ forecast.precipitation }}
- name: Tomorrow Forecast Detail
unique_id: 21374ed0-80d1-49ba-817d-3e93eb3865e4
icon: mdi:weather-sunny
state: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{{ [
'Tomorrow in Defiance ',
'For the next day ',
'Tomorrow '
] | random }}
expect a high of {{ state_attr('sensor.tomorrow_forecast','high_temp') }} degrees.
{%- if states('sensor.tomorrow_forecast') == 'sunny' %}
{{ [
'and sunny. ',
'with sun. ',
'with sunny conditions prevailing. '
] | random }}
{%- elif states('sensor.tomorrow_forecast') == 'rainy' %}
{{ [
'with rain. ',
'with showers. ',
'and rainy. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.tomorrow_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.tomorrow_forecast') == 'snowy' %}
{{ [
'with snow. ',
'with snow showers. '
] | random }}
{{ [
'Snowfall accumulations ',
'Total snowfall amounts '
] | random }}
near {{ state_attr('sensor.tomorrow_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.tomorrow_forecast') == 'snowy-rainy' %}
{{ [
'with mix preciptation possible. ',
'with snow and rain showers. '
] | random }}
Total accumulation near {{ state_attr('sensor.tomorrow_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.tomorrow_forecast') == 'windy' %}
{{ [
'and windy. ',
'with lots of wind. '
] | random }}
{%- elif states('sensor.current_forecast') == 'fog' %}
{{ [
'and foggy. ',
'with some fog. '
] | random }}
{% elif states('sensor.tomorrow_forecast') == 'cloudy' %}
{{ [
'with clouds. ',
'with cloudy skies. '
] | random }}
{% elif states('sensor.tomorrow_forecast') == 'partlycloudy' %}
{{ [
'with some clouds. ',
'with partly cloudy skies. ',
'with scattered clouds '
] | random }}
{%- elif states('sensor.tomorrow_forecast') == 'hail' %}
{{ [
'with severe thunderstorms possible. ',
'with hail possible. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'lightning' %}
{{ [
'with thunderstorms possible. ',
'with the potential of thunderstorms. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{% endif -%}
{{ [
' Tomorrow night expect a low of '
] | random }}
{{ state_attr('sensor.tomorrow_forecast','overnight_low') }} degrees.
{%- endmacro -%}
{{- cleanup(getReport()) -}}
- name: Current Conditions
unique_id: 70db7e57-08db-48b2-919b-03b5face37b9
icon: mdi:weather-sunny
state: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
The Weather in Defiance
{{ [
' is ',
' is currently '
] | random }}
{{state_attr('weather.iron_nerd_weather_station','temperature')|round}} degrees
{% if is_state('weather.iron_nerd_weather_station', 'rainy') %}
{{ [
'with rain. ',
'with showers. '
] | random }}
{% elif is_state('weather.iron_nerd_weather_station', 'cloudy') %}
{{ [
'with clouds. ',
'with cloudy skies. '
] | random }}
{% elif is_state('weather.iron_nerd_weather_station', 'partlycloudy') %}
{{ [
'with some clouds. ',
'with partly cloudy skies. ',
'with scatterd clouds '
] | random }}
{% elif is_state('weather.iron_nerd_weather_station', 'sunny') %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ [
'and sunny. ',
'with sun. '
] | random }}
{% else %}
{{ [
'and clear. ',
'with clear skies. '
] | random }}
{% endif %}
{% else %}
and {{ states.weather.iron_nerd_weather_station.state }}
{% endif %}
{%- endmacro -%}
{{- cleanup(getReport()) -}}
- name: Current Conditions Detail
unique_id: 2b3687d1-bdd5-4551-8c0a-05b1ff617543
icon: mdi:weather-sunny
state: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
The Weather in Defiance
{{ [
' is ',
' is currently '
] | random }}
{{state_attr('weather.iron_nerd_weather_station','temperature')|round}} degrees
{% if is_state('weather.iron_nerd_weather_station', 'rainy') %}
{{ [
'with rain. ',
'with showers. '
] | random }}
{% elif is_state('weather.iron_nerd_weather_station', 'cloudy') %}
{{ [
'with clouds. ',
'with cloudy skies. '
] | random }}
{% elif is_state('weather.iron_nerd_weather_station', 'partlycloudy') %}
{{ [
'with some clouds. ',
'with partly cloudy skies. ',
'with scattered clouds. '
] | random }}
{% elif is_state('weather.iron_nerd_weather_station', 'sunny') %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ [
'and sunny. ',
'with sun. '
] | random }}
{% else %}
{{ [
'and clear. ',
'with clear skies. '
] | random }}
{% endif %}
{% else %}
and {{ states.weather.iron_nerd_weather_station.state }}.
{% endif %}
{%- if is_state('binary_sensor.early_night_mode','off')%}
{{ [
'Later Today ',
'For the rest of the day '
] | random }}
expect a high of {{ states('sensor.todays_high_temp') }}
{%- if states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','off')%}
{{ [
'and sunny. ',
'with sun. ',
'with sunny conditions prevailing. '
] | random }}
{%- elif states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','on') %}
{{ [
'and clear. ',
'with clear skies. '
] | random }}
{%- elif states('sensor.current_forecast') == 'clear-night' %}
{{ [
'and clear. ',
'with clear skies. '
] | random }}
{%- elif states('sensor.current_forecast') == 'rainy' %}
{{ [
'with rain. ',
'with showers. ',
'and rainy. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches {{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'snowy' %}
{{ [
'with snow. ',
'with snow showers. '
] | random }}
{{ [
'Snowfall accumulations ',
'Total snowfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'snowy-rainy' %}
{{ [
'with mix preciptation possible. ',
'with snow and rain showers. '
] | random }}
Total accumulation near {{ state_attr('sensor.current_forecast','precipitation') }} inches {{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'windy' %}
{{ [
'and windy. ',
'with lots of wind. '
] | random }}
{%- elif states('sensor.current_forecast') == 'fog' %}
{{ [
'and foggy. ',
'with some fog. '
] | random }}
{% elif states('sensor.current_forecast') == 'cloudy' %}
{{ [
'with clouds. ',
'with cloudy skies. '
] | random }}
{% elif states('sensor.current_forecast') == 'partlycloudy' %}
{{ [
'with some clouds. ',
'with partly cloudy skies. ',
'with scattered clouds. '
] | random }}
{%- elif states('sensor.current_forecast') == 'hail' %}
{{ [
'with severe thunderstorms possible. ',
'with hail possible. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{%- elif states('sensor.current_forecast') == 'lightning' %}
{{ [
'with thunderstorms possible. ',
'with the potential of thunderstorms. '
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ 'possible. ' }}
{% endif -%}
{{ [
'Later tonight expect a low of ',
'Overnight expect a low of '
] | random }}
{{ states('sensor.overnight_lowest_temperature') }} degrees.
{%- else -%}
{{ [
'Tonight expect a low of ',
'Overnight expect a low of '
] | random }}
{{ states('sensor.overnight_lowest_temperature') }} degrees.
{% endif %}
{%- endmacro -%}
{{- cleanup(getReport()) -}}
- name: 'Outside Pressure'
unique_id: ac2944bb-e9d7-40a3-9707-ef477fd5f309
state: '{{ state_attr(''weather.iron_nerd_weather_station'',''pressure'') }}'
unit_of_measurement: ''
- name: "Today's High Temp"
unique_id: 532904af-940b-45cd-af8e-c69d1a9c4531
unit_of_measurement: '°F'
device_class: temperature
state: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{% if is_number(forecast.temperature) %}
{{ forecast.temperature }}
{% else %}
{{ state_attr('weather.iron_nerd_weather_station','temperature') }}
{% endif %}
- name: "Tomorrow's High Temp"
unique_id: b9dfc26a-d557-46b4-a6eb-a215c7bbe494
unit_of_measurement: '°F'
device_class: temperature
state: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[2] %}
{{ forecast.temperature }}
- name: "Tonight's Low Temp"
unique_id: 8ddc55b6-4728-4897-a32f-90be970f744b
unit_of_measurement: '°F'
device_class: temperature
state: >-
{% set forecast = state_attr('sensor.weather_com_daily_weather_forecast','forecast')[0] %}
{{ forecast.templow }}
- name: "Clothing Forecast"
unique_id: 8ed2684b-d0ad-402c-bc3c-340cb9b2437a
state: >-
{% if is_state('binary_sensor.overnight', 'off') %}
{% set temp = states('sensor.todays_high_temp')|int %}
{% else %}
{% set temp = state_attr('weather.iron_nerd_weather_station','temperature')|round %}
{% endif %}
{%- if states('sensor.todays_high_temp')|int > 63 %}
{%- if states('sensor.todays_high_temp')|int < 80 %}
Nice
{% elif states('sensor.todays_high_temp')|int > 90 %}
Hot
{% else %}
Toasty
{%- endif %}
{% elif states('sensor.todays_high_temp')|int < 64 %}
{%- if states('sensor.todays_high_temp')|int < 32 %}
Freezing
{% elif states('sensor.todays_high_temp')|int > 48 %}
Chilly
{% else %}
Cold
{%- endif %}
{% else %}
Unknown
{%- endif %}
- name: "Clothing Forecast Detail"
unique_id: 13065f50-5eef-4afd-830e-2a2c87f47496
state: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% if is_state('binary_sensor.morning','on') %}
Based on the forecasted high temperature,
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
You're gonna freeze your balls off out there. so I suggest wearing long pants and a heavy coat.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It's gonna be cold as balls today. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It's gonna be on the chilly side today. so I suggest wearing at least long pants.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is going to be
{{ [ 'pretty nice outside. ',
'a good day to be outside. ',
'a decent day outside for once. ',
'downright tolerable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') and is_state('sensor.current_forecast', 'sunny') %}
It is going to be
{{ [ 'on the warm side ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today, and very sunny. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Hot') and is_state('sensor.current_forecast', 'sunny') %}
It is going to be
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
] | random }}
today, and very sunny. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be
{{ [ 'on the warm side ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is going to be
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
'hotter than hell itself ',
] | random }}
today. So I suggest wearing shorts.
{% else %}
It is going to be {{ states('sensor.clothing_forecast') }} today so I suggest wearing shorts.
{% endif %}
{% if is_state('input_boolean.hot_day','on') %}
Warning, today will be a very sweaty day, so please remember to stay hydrated!
{% endif %}
{% if is_state('input_boolean.cold_day','on') %}
Warning, today will be excessively cold, please make sure all exposed skin is covered to avoid frostbite!
{% endif %}
{% else %}
Based on the current temperature,
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
You're gonna freeze your balls off out there. so I suggest wearing long pants and a heavy coat if you are going out.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It is cold as balls outside. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It is chilly right now. so I suggest wearing at least long pants
if you are going to venture outside.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is
{{ [ 'pretty nice outside. ',
'a good day to be outside. ',
'a decent day outside for once. ',
'downright tolerable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') and is_state('weather.iron_nerd_weather_station','sunny') %}
It is
{{ [ 'on the warm side ',
' rather warm ',
' almost too hot ',
' a little warm ',
] | random }}
and very sunny outside. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Hot') and is_state('weather.iron_nerd_weather_station','sunny') %}
It is
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
] | random }}
and very sunny outside. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is
{{ [ 'on the warm side ',
' rather warm ',
' almost too hot ',
' a little warm ',
] | random }}
outside. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
'hotter than hell itself ',
] | random }}
outside. So I suggest wearing shorts.
{% else %}
It is {{ states('sensor.clothing_forecast') }} right now so I suggest wearing shorts.
{% endif %}
{% if is_state('binary_sensor.heat_index_threshold','on') %}
Warning, the heat index is {{ states('sensor.stratton_ave_apparent_temperature') | float | round }} degrees right now, which is very high. So please make sure to stay hydrated!
{% endif %}
{% if is_state('binary_sensor.wind_chill_threshold','on') %}
Warning, it currently feels like {{ states('sensor.stratton_ave_apparent_temperature') | float | round }} degrees outside, so please make sure all exposed skin is covered to avoid frostbite!
{% endif %}
{% endif %}
{% if states('sensor.thermal_comfort_simmerindex') in ['extremely_warm','danger_of_heatstroke','extreme_danger_of_heatstroke','circulatory_collapse_imminent'] %}
"I cannot stress this enough, the current weather is dangerously hot! "
{% endif %}
{% if is_state('sensor.thermal_comfort_perception','somewhat_uncomfortable') %}
"The humidity is somewhat uncomfortable outside."
{% elif is_state('sensor.thermal_comfort_perception','quite_uncomfortable') %}
"The humidity is very uncomfortable outside. "
{% elif is_state('sensor.thermal_comfort_perception','extremely_uncomfortable') %}
"The humidity outside is extremely uncomfortable and oppresive. "
{% elif is_state('sensor.thermal_comfort_perception','severely_high') %}
"The humidity outside is severely high, and could even be deadly for asthma related illnesses. "
{% endif %}
{% if is_state('sensor.thermal_comfort_frostrisk','high') %}
"There is currently a high chance of frost outside. Plan accordingly! "
{% elif is_state('sensor.thermal_comfort_frostrisk','probable') %}
"The possibility of frost exists currently. Be prepared. "
{% endif %}
{%- endmacro -%}
{{- cleanup(getReport()) -}}
# current_inside_humidity:
# - name: "Current Inside Humidity"
# unit_of_measurement: '%'
# state: "{{ state_attr('climate.home','current_humidity') }}"
# lighting_stike_count:
# - name: "Lightning Strike Count"
# state: "{{ states('sensor.acurite_6045m_3078_strcnt') }}"
# yesterday_rainfall_in:
# - name: "Yesterday Rainfall"
# state: "{{ state_attr('sensor.daily_rainfall_in', 'last_period') }}"
# previous_rainfall:
# - name: "Past 48h Rainfall"
# state: "{{ states('sensor.daily_rainfall_in') | float + state_attr('sensor.daily_rainfall_in', 'last_period') | float }}"
- name: Weather Alert String
unique_id: 66b5f020-0b5e-48ed-92a2-740d2d708b30
state: >
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% set alerts = [
states('sensor.weatheralerts_alert_1_most_recent_active_alert'),
states('sensor.weatheralerts_alert_2_most_recent_active_alert'),
states('sensor.weatheralerts_alert_3_most_recent_active_alert'),
states('sensor.weatheralerts_alert_4_most_recent_active_alert'),
states('sensor.weatheralerts_alert_5_most_recent_active_alert'),
] %}
{% set main = alerts | reject('eq','unavailable') | select('ne','Flood Warning') | join(", ") | default('') %}
{% set flood = alerts | reject ('eq','unavailable') | select('eq','Flood Warning') | first | default('') %}
{% if flood not in [''] and main not in [''] %}
{{ main + ", " + flood }}
{% elif flood not in [''] and main in [''] %}
{{ flood }}
{% elif main not in [''] and flood in [''] %}
{{ main }}
{% else %}
'None'
{% endif %}
{%- endmacro -%}
{{- cleanup(getReport()) -}}
attributes:
active_alerts: "{{ states('sensor.weatheralerts_active_alerts') }}"
icon: >
{% if (states('sensor.weatheralerts_active_alerts') | int ) > 0 %}
mdi:alert
{% else %}
mdi:alert-remove
{% endif %}
- name: 'Weather Alerts Active - Corrected'
unique_id: e2f51da4-2271-4719-8edf-a28f76ac1e3f
state: >
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% set alerts = [
states('sensor.weatheralerts_alert_1_most_recent_active_alert'),
states('sensor.weatheralerts_alert_2_most_recent_active_alert'),
states('sensor.weatheralerts_alert_3_most_recent_active_alert'),
states('sensor.weatheralerts_alert_4_most_recent_active_alert'),
states('sensor.weatheralerts_alert_5_most_recent_active_alert'),
] %}
{% set main = alerts | reject('eq','unavailable') | select('ne','Flood Warning') | list | count | int %}
{% set flood = alerts | reject ('eq','unavailable') | select('eq','Flood Warning') | list | count | int %}
{% set flood1 = 1 if (flood > 0) else 0 %}
{{ (main + flood1) | int }}
{%- endmacro -%}
{{- cleanup(getReport()) -}}
icon: >
{% if (states('sensor.weatheralerts_active_alerts') | int ) > 0 %}
mdi:alert
{% else %}
mdi:alert-remove
{% endif %}
# Sensors to more accurately forecast the overnight temperatures
- name: 'Overnight Lowest Temperature'
unique_id: 70bdffbe-dc55-4913-af70-a37a6db2bcaa
unit_of_measurement: '°F'
state: >
{% set ns = namespace(temps=[]) %}
{% set x = state_attr('sensor.weather_com_hourly_weather_forecast','forecast') | count %}
{% set pd = state_attr('sensor.weather_com_hourly_weather_forecast','forecast') %}
{% for i in range(0,x) %}
{% set hr = as_timestamp(as_local(as_datetime(pd[i].datetime))) | timestamp_custom('%H') | int %}
{% if hr in range(21,24) or hr in range(0,8) %}
{% if as_local(as_datetime(pd[i].datetime)) == now().replace(hour=hr, minute=00, second=0, microsecond=0) + timedelta(days=0) or
as_local(as_datetime(pd[i].datetime)) == now().replace(hour=hr, minute=00, second=0, microsecond=0) + timedelta(days=1) %}
{% set ns.temps = ns.temps + [pd[i].temperature] %}
{% endif %}
{% endif %}
{% endfor %}
{{ ns.temps | min | int }}
icon: mdi:thermometer
input_boolean:
freeze_warning:
name: Freeze Warning
icon: mdi:snowflake-alert
weather_alert_texts:
name: Weather Alert Texts
icon: mdi:message-processing
tornado_alarm:
name: Tornado Alarm
icon: mdi:speaker-wireless
tstorm_alarm:
name: T-Storm Alarm
icon: mdi:speaker-wireless
raining:
name: Raining
severe_weather_mode:
name: Severe Weather Mode
icon: mdi:weather-tornado
# automation:
# - alias: 'record previous day rainfall'
# trigger:
# - platform: time
# at: '23:58:00'
# action:
# service: mqtt.publish
# data:
# topic: 'house/rain/yesterday_total'
# retain: true
# payload: "{{ states('sensor.todays_rainfall') }}"
# - id: 14421478-a33c-471a-ae01-b48827f6121a
# alias: Forecast Low Near Freezing
# trigger:
# - platform: numeric_state
# entity_id: sensor.overnight_lowest_temperature
# below: 35
# - platform: numeric_state
# entity_id: sensor.pirateweather_temperature
# below: 35
# condition:
# - condition: state
# entity_id: input_boolean.freeze_warning
# state: 'off'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.freeze_warning
# - id: 088285ec-6435-435c-a8ce-800851fb15e2
# alias: Forecast Low Above Freezing
# trigger:
# - platform: numeric_state
# entity_id: sensor.overnight_lowest_temperature
# above: 33
# condition:
# - condition: state
# entity_id: input_boolean.freeze_warning
# state: 'on'
# - condition: numeric_state
# entity_id: sensor.overnight_lowest_temperature
# above: 35
# action:
# - service: input_boolean.turn_off
# entity_id: input_boolean.freeze_warning
script:
# refresh_weather_alert_sensors:
# sequence:
# - service: homeassistant.update_entity
# entity_id: sensor.tornado_warning
# - service: homeassistant.update_entity
# entity_id: sensor.tornado_watch
# - service: homeassistant.update_entity
# entity_id: sensor.tstorm_warning
# - service: homeassistant.update_entity
# entity_id: sensor.tstorm_watch
# - service: homeassistant.update_entity
# entity_id: sensor.flood_warning
# - service: homeassistant.update_entity
# entity_id: sensor.flood_watch
weather_briefing:
alias: 'Weather Briefing'
sequence:
- service: script.speech_engine
data:
who: "{{ who }}"
message: !include ../templates/speech/weather_briefing_full.yaml