2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
# @author : Mahasri Kalavala
|
|
|
|
# @date : 04/15/2017
|
|
|
|
# @package : Weather
|
|
|
|
# @description : Nothing But The Weather Stuff!
|
|
|
|
###############################################################################
|
|
|
|
homeassistant:
|
|
|
|
customize:
|
|
|
|
sun.sun:
|
2019-08-19 00:21:05 +00:00
|
|
|
friendly_name: Sun
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
sensor.cold_flu:
|
|
|
|
friendly_name: Cold and Flu
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
sensor.cold_flu_risk:
|
|
|
|
friendly_name: Cold and Flu Risk
|
|
|
|
homebridge_hidden: true
|
|
|
|
sensor.pollen:
|
|
|
|
friendly_name: Pollen
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
sensor.pollen_level:
|
|
|
|
friendly_name: Pollen Level
|
|
|
|
homebridge_hidden: true
|
|
|
|
sensor.air_quality:
|
2019-08-19 00:21:05 +00:00
|
|
|
friendly_name: Air Quality
|
2019-04-17 22:46:06 +00:00
|
|
|
homebridge_hidden: true
|
|
|
|
|
|
|
|
input_boolean.rain_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.snow_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.sleet_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.nice_breeze_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.moderate_wind_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.heavy_wind_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.super_heavy_wind_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
input_boolean.hurricane_wind_alert:
|
|
|
|
hidden: true
|
|
|
|
homebridge_hidden: true
|
|
|
|
sensor.wind_direction:
|
|
|
|
icon: mdi:weather-windy-variant
|
|
|
|
homebridge_hidden: true
|
|
|
|
sensor.wind_direction_tts:
|
|
|
|
icon: mdi:weather-windy-variant
|
|
|
|
homebridge_hidden: true
|
|
|
|
|
|
|
|
input_boolean:
|
|
|
|
nice_breeze_alert:
|
|
|
|
name: Nice Breeze Alert
|
|
|
|
initial: off
|
|
|
|
moderate_wind_alert:
|
|
|
|
name: Moderate Wind Alert
|
|
|
|
initial: off
|
|
|
|
heavy_wind_alert:
|
|
|
|
name: heavy Wind Alert
|
|
|
|
initial: off
|
|
|
|
super_heavy_wind_alert:
|
|
|
|
name: Super Heavy Wind Alert
|
|
|
|
initial: off
|
|
|
|
hurricane_wind_alert:
|
|
|
|
name: Hurricane Winds Alert
|
|
|
|
initial: off
|
|
|
|
rain_alert:
|
|
|
|
name: Rain Alert
|
|
|
|
initial: off
|
|
|
|
snow_alert:
|
|
|
|
name: Snow Alert
|
|
|
|
initial: off
|
|
|
|
sleet_alert:
|
|
|
|
name: Sleet Alert
|
|
|
|
initial: off
|
|
|
|
|
|
|
|
#
|
|
|
|
# Good Weather To Fly Drone?
|
2019-08-19 00:21:05 +00:00
|
|
|
# Criteria:
|
|
|
|
# - Wind Speed must be less than 12 mph
|
2019-04-17 22:46:06 +00:00
|
|
|
# - No Rain, or Snow
|
|
|
|
# - No Thunderstorms, lightning
|
|
|
|
# - Visiblity must be more than 2 miles
|
|
|
|
# - Temperature must be above 32 degrees Fahrenheit - (avoid risk of batteries being dead in extreme cold temperature)
|
|
|
|
# - Cloud coverage must be above than 30% (I prefer good amount of sunlight or clear sky) - may have to tweak during winters :)
|
|
|
|
#
|
|
|
|
|
|
|
|
binary_sensor:
|
|
|
|
- platform: template
|
|
|
|
sensors:
|
|
|
|
good_weather_to_fly_drones:
|
|
|
|
friendly_name: Good Weather To Fly Drone?
|
|
|
|
value_template: >-
|
2022-12-03 16:28:12 +00:00
|
|
|
{% if states.sensor.dark_sky_wind_speed.state | round(0) | int > 12 or
|
|
|
|
states.sensor.dark_sky_precip.state |lower == "rain" or
|
2019-04-17 22:46:06 +00:00
|
|
|
states.sensor.dark_sky_precip.state |lower == "snow" or
|
2022-12-03 16:28:12 +00:00
|
|
|
states.sensor.dark_sky_visibility.state | round(0) | int < 2 or
|
|
|
|
states.sensor.dark_sky_temperature.state | round(0) | int < 32 or
|
2019-04-17 22:46:06 +00:00
|
|
|
states.sensor.dark_sky_cloud_coverage.state | round(0) | int > 30 %}
|
|
|
|
false
|
|
|
|
{% else %}
|
|
|
|
true
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
weather:
|
|
|
|
- platform: darksky
|
|
|
|
api_key: !secret darksky_api_key
|
2022-11-30 00:50:52 +00:00
|
|
|
mode: daily
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
sensor:
|
|
|
|
- platform: darksky
|
|
|
|
api_key: !secret darksky_api_key
|
|
|
|
monitored_conditions:
|
|
|
|
- summary
|
|
|
|
- icon
|
|
|
|
- nearest_storm_distance
|
|
|
|
- nearest_storm_bearing
|
|
|
|
- precip_type
|
|
|
|
- precip_intensity
|
|
|
|
- precip_probability
|
|
|
|
- temperature
|
|
|
|
- apparent_temperature
|
|
|
|
- dew_point
|
|
|
|
- wind_speed
|
|
|
|
- wind_bearing
|
|
|
|
- cloud_cover
|
|
|
|
- humidity
|
|
|
|
- pressure
|
|
|
|
- visibility
|
|
|
|
- ozone
|
|
|
|
- minutely_summary
|
|
|
|
- hourly_summary
|
|
|
|
- daily_summary
|
|
|
|
- precip_intensity_max
|
|
|
|
|
|
|
|
- platform: rest
|
|
|
|
name: pollen
|
|
|
|
resource: !secret weather_pollen_url
|
|
|
|
value_template: "{{value_json.Location.periods[1].Index}}"
|
|
|
|
scan_interval: 21600
|
|
|
|
headers:
|
2021-08-31 02:07:33 +00:00
|
|
|
Referer: !secret weather_pollen_url
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
- platform: rest
|
|
|
|
name: cold_flu
|
|
|
|
resource: !secret weather_cold_flu_url
|
|
|
|
value_template: "{{value_json.Location.periods[0].Index}}"
|
|
|
|
scan_interval: 21600
|
|
|
|
headers:
|
2021-08-31 02:07:33 +00:00
|
|
|
Referer: !secret weather_pollen_url
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
###############################################################################
|
2019-08-19 00:21:05 +00:00
|
|
|
# _ _ _
|
|
|
|
# /\ | | | | (_)
|
|
|
|
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
2019-04-17 22:46:06 +00:00
|
|
|
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
|
|
|
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
|
|
|
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
2019-08-19 00:21:05 +00:00
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
automation:
|
2019-04-17 22:46:06 +00:00
|
|
|
# Script to alert when enjoyable weather is outside
|
2019-08-19 00:21:05 +00:00
|
|
|
# For me, enjoyable is:
|
2019-04-17 22:46:06 +00:00
|
|
|
# 1. Must be above 70 Degrees F
|
|
|
|
# 2. Alert me only during day time
|
|
|
|
#
|
|
|
|
# Only want to be notified every 15 minutes or so. Do not want to be bombarded with updates every minute wind speed changes
|
|
|
|
- alias: Remind me to enjoy warm and windy weather
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: sensor.dark_sky_wind_speed
|
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: '{{ states.input_boolean.enjoyable_weather_reminders.state == "on" }}'
|
|
|
|
- condition: state
|
|
|
|
entity_id: sun.sun
|
2019-08-19 00:21:05 +00:00
|
|
|
state: "above_horizon"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
2019-08-19 00:21:05 +00:00
|
|
|
value_template: "{% if states.sensor.dark_sky_apparent_temperature.state | round > 70 %} true {% else %} false {% endif %}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
2019-08-19 00:21:05 +00:00
|
|
|
value_template: "{% if states.sensor.dark_sky_wind_speed.state | round < 8 %} false {% else %} true {% endif %}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2022-12-03 16:28:12 +00:00
|
|
|
- service: script.notify_family
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
message: >
|
|
|
|
{% set windspeed = states.sensor.dark_sky_wind_speed.state | round %}
|
|
|
|
{% if ( windspeed > 7 and ( windspeed <= 15 ) and (states.input_boolean.nice_breeze_alert.state == 'off')) %}
|
|
|
|
{{ states.sensor.dark_sky_apparent_temperature.state | round }} degrees, and {{windspeed}} mph winds. You should go out and enjoy weather!
|
|
|
|
{% elif ( windspeed > 15 ) and ( windspeed <= 25 ) and (states.input_boolean.moderate_wind_alert.state == 'off') %}
|
|
|
|
{{ states.sensor.dark_sky_apparent_temperature.state | round }} degrees, and {{windspeed}} mph winds. You should go out and enjoy weather!
|
|
|
|
{% elif ( windspeed > 25 ) and ( windspeed <= 40 ) and (states.input_boolean.heavy_wind_alert.state == 'off') %}
|
|
|
|
HEAVY WINDS!!! Current Wind Speed is : {{windspeed}} mph! Be VERY careful outdoors!
|
|
|
|
{% elif ( windspeed > 40 ) and ( windspeed <= 60 ) and (states.input_boolean.super_heavy_wind_alert.state == 'off') %}
|
|
|
|
Warning! Wind speed is {{windspeed}} MPH. FIND SHELTER IMMEDIATELY!
|
|
|
|
{% elif ( windspeed > 60 ) and (states.input_boolean.hurricane_wind_alert.state == 'off') %}
|
|
|
|
HURRICANE WINDS. FIND SHELTER, AND STAY INDOORS!
|
|
|
|
{% endif %}
|
2022-12-03 16:28:12 +00:00
|
|
|
notify_options:
|
|
|
|
- telegram
|
|
|
|
- tv
|
|
|
|
- led
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: input_boolean.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2021-01-10 20:03:52 +00:00
|
|
|
entity_id: >-
|
|
|
|
{%- set windspeed = states.sensor.dark_sky_wind_speed.state | round -%}
|
|
|
|
{%- if ( windspeed > 7 and ( windspeed <= 15 ) ) -%}
|
|
|
|
input_boolean.nice_breeze_alert
|
|
|
|
{%- elif ( windspeed > 15 ) and ( windspeed <= 25 ) %}
|
|
|
|
input_boolean.moderate_wind_alert
|
|
|
|
{%- elif ( windspeed > 25 ) and ( windspeed <= 40 ) %}
|
|
|
|
input_boolean.heavy_wind_alert
|
|
|
|
{%- elif ( windspeed > 40 ) and ( windspeed <= 60 ) %}
|
|
|
|
input_boolean.super_heavy_wind_alert
|
|
|
|
{%- elif ( windspeed > 60 ) %}
|
|
|
|
input_boolean.hurricane_wind_alert
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
- alias: Set Wind Speed Input Booleans
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: sensor.dark_sky_wind_speed
|
|
|
|
action:
|
|
|
|
- service: input_boolean.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2021-01-10 20:03:52 +00:00
|
|
|
entity_id: >-
|
|
|
|
{%- set windspeed = states.sensor.dark_sky_wind_speed.state | round -%}
|
2019-04-17 22:46:06 +00:00
|
|
|
{%- if ( windspeed > 7 and ( windspeed <= 15 ) ) -%}
|
|
|
|
input_boolean.nice_breeze_alert
|
|
|
|
{%- elif ( windspeed > 15 ) and ( windspeed <= 25 ) %}
|
|
|
|
input_boolean.moderate_wind_alert
|
|
|
|
{%- elif ( windspeed > 25 ) and ( windspeed <= 40 ) %}
|
|
|
|
input_boolean.heavy_wind_alert
|
|
|
|
{%- elif ( windspeed > 40 ) and ( windspeed <= 60 ) %}
|
|
|
|
input_boolean.super_heavy_wind_alert
|
|
|
|
{%- elif ( windspeed > 60 ) %}
|
|
|
|
input_boolean.hurricane_wind_alert
|
2021-01-10 23:15:03 +00:00
|
|
|
{% else %}
|
|
|
|
input_boolean.dummy
|
2019-04-17 22:46:06 +00:00
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
# #Turn off those wind speed alert booleans automatically after 15 minutes.
|
|
|
|
- alias: Weather Input Boolean Updates
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
2019-08-19 00:21:05 +00:00
|
|
|
- input_boolean.nice_breeze_alert
|
|
|
|
- input_boolean.moderate_wind_alert
|
|
|
|
- input_boolean.heavy_wind_alert
|
|
|
|
- input_boolean.super_heavy_wind_alert
|
|
|
|
- input_boolean.hurricane_wind_alert
|
|
|
|
- input_boolean.rain_alert
|
|
|
|
- input_boolean.snow_alert
|
|
|
|
- input_boolean.sleet_alert
|
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
for:
|
|
|
|
minutes: 15
|
|
|
|
action:
|
|
|
|
- service: input_boolean.turn_off
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
entity_id: "{{ trigger.entity_id }}"
|
|
|
|
|
|
|
|
- alias: Alert Super Heavy Winds
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: sensor.dark_sky_wind_speed
|
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: >
|
|
|
|
{%- if states.sensor.dark_sky_wind_speed.last_changed -%}
|
|
|
|
{{ (as_timestamp(now()) - as_timestamp(states.sensor.dark_sky_wind_speed.last_changed)) > 120 }}
|
|
|
|
{%- else -%}
|
|
|
|
true
|
|
|
|
{%- endif -%}
|
|
|
|
action:
|
2022-12-03 16:28:12 +00:00
|
|
|
- service: script.notify_family
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
message: >
|
|
|
|
{% set windspeed = states.sensor.dark_sky_wind_speed.state | round %}
|
|
|
|
{% if ( windspeed > 40 ) and ( windspeed <= 60 ) and (states.input_boolean.super_heavy_wind_alert.state == 'off') %}
|
2022-12-03 16:28:12 +00:00
|
|
|
Warning! Wind speed is {{windspeed}} MPH. FIND SHELTER IMMEDIATELY!
|
2019-04-17 22:46:06 +00:00
|
|
|
{% elif ( windspeed > 60 ) and ( windspeed <= 100 ) and (states.input_boolean.hurricane_wind_alert.state == 'off') %}
|
|
|
|
HURRICANE WINDS. FIND SHELTER, AND STAY INDOORS! DO NOT GO OUT AND RISK YOUR LIFE!
|
|
|
|
{% endif %}
|
2022-12-03 16:28:12 +00:00
|
|
|
notify_options:
|
|
|
|
- telegram
|
|
|
|
- tv
|
|
|
|
- led
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
- alias: Rain Alerts
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: sensor.dark_sky_precip
|
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: '{{ trigger.to_state.state | lower == "rain" }}'
|
|
|
|
- condition: state
|
|
|
|
entity_id: sun.sun
|
2019-08-19 00:21:05 +00:00
|
|
|
state: "above_horizon"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: '{% if trigger.to_state.state == "unknown" or trigger.to_state.state == "" %} false {% else %} true {% endif %}'
|
|
|
|
- condition: template
|
2019-08-19 00:21:05 +00:00
|
|
|
value_template: "{{ states.sensor.dark_sky_precip_probability.state | int == 1 }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2022-12-03 16:28:12 +00:00
|
|
|
- service: script.notify_family
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
message: "{{ trigger.to_state.state | title }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float }} inches per hour"
|
2022-12-03 16:28:12 +00:00
|
|
|
notify_options:
|
|
|
|
- telegram
|
|
|
|
- tv
|
|
|
|
- led
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: input_boolean.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
entity_id: >
|
|
|
|
{% set curState = trigger.to_state.state | lower %}
|
|
|
|
{%- if curState == "rain" -%}
|
|
|
|
input_boolean.rain_alert
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
- alias: Snow And Sleet Alerts
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: sensor.dark_sky_precip
|
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: '{{ states.sensor.season.state | lower == "winter" }}'
|
|
|
|
- condition: state
|
|
|
|
entity_id: sun.sun
|
2019-08-19 00:21:05 +00:00
|
|
|
state: "above_horizon"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: '{% if trigger.to_state.state == "unknown" or trigger.to_state.state == "" %} false {% else %} true {% endif %}'
|
|
|
|
- condition: template
|
2019-08-19 00:21:05 +00:00
|
|
|
value_template: "{{ states.sensor.dark_sky_precip_probability.state | int == 1 }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2022-12-03 16:28:12 +00:00
|
|
|
- service: script.notify_family
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
message: "{{ trigger.to_state.state | title }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float }} inches per hour"
|
2022-12-03 16:28:12 +00:00
|
|
|
notify_options:
|
|
|
|
- telegram
|
|
|
|
- voice
|
|
|
|
- tv
|
|
|
|
- led
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: input_boolean.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2019-04-17 22:46:06 +00:00
|
|
|
entity_id: >
|
|
|
|
{% set curState = trigger.to_state.state | lower %}
|
|
|
|
{%- if curState == "snow" %}
|
|
|
|
input_boolean.snow_alert
|
|
|
|
{%- elif curState == "sleet" %}
|
|
|
|
input_boolean.sleet_alert
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
# Weather sensors - TBD, too lazy to create them
|
|
|
|
#
|
|
|
|
# {{ states.sun.sun.state }}
|
|
|
|
# {{ states.sun.sun.attributes.azimuth }}
|
|
|
|
# {{ states.sun.sun.attributes.elevation }}
|
|
|
|
# Next Dusk: {{ as_timestamp(strptime(states.sun.sun.attributes.next_dusk, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
|
|
|
# Next Midnight: {{ as_timestamp(strptime(states.sun.sun.attributes.next_midnight, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
|
|
|
# Next Dawn: {{ as_timestamp(strptime(states.sun.sun.attributes.next_dawn, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
|
|
|
# Next Rising: {{ as_timestamp(strptime(states.sun.sun.attributes.next_rising, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
|
|
|
# Next Setting: {{ as_timestamp(strptime(states.sun.sun.attributes.next_setting, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|