Move Dark Sky weather automations into their own package

This commit is contained in:
Correl Roush 2018-05-17 13:53:37 -04:00
parent 78f67b4cc3
commit d23d460531
4 changed files with 61 additions and 54 deletions

View File

@ -28,20 +28,6 @@
from: not_home
platform: state
to: home
- action:
- data: {}
service: script.weather_report
alias: Morning weather
condition:
- after: '6:00'
before: '12:00'
condition: time
id: '1521686674842'
trigger:
- entity_id: light.living_room
from: 'off'
platform: state
to: 'on'
- action:
- delay: '00:00:05'
- service: script.sonos_tts

View File

@ -81,10 +81,6 @@ device_tracker:
- 192.168.1.172
track_new_devices: false
weather:
- platform: darksky
api_key: !secret darksky_api_key
notify:
- name: notifymyandroid
platform: nma

61
packages/darksky.yaml Normal file
View File

@ -0,0 +1,61 @@
sensor:
- platform: darksky
api_key: !secret darksky_api_key
monitored_conditions:
- temperature
- summary
- hourly_summary
- daily_summary
automation:
- alias: Morning weather
action:
- data: {}
service: script.weather_report
condition:
- after: '6:00'
before: '12:00'
condition: time
id: '1521686674842'
trigger:
- entity_id: light.living_room
from: 'off'
platform: state
to: 'on'
script:
weather_report:
alias: Weather report
sequence:
- service: script.sonos_tts
data_template:
message: >-
{% if now().hour > 17 %}
Good evening!
{% elif now().hour > 12 %}
Good afternoon!
{% else %}
Good morning!
{% endif %}
{% if is_state('device_tracker.homeassistant_pixel', 'home') %}
Hi Correl!
{% endif %}
{% if is_state('device_tracker.stephaniesiphone', 'home') %}
Hi Stephanie!
{% endif %}
{% if is_state('device_tracker.PhilsGalaxyS7Edge', 'home') %}
Hi Phil!
{% endif %}
Today's forecast is
{{ states.sensor.dark_sky_daily_summary.state }}
Right now, the weather is
{{ states.sensor.dark_sky_summary.state}} at
{{ states.sensor.dark_sky_temperature.state }}
degrees,
{{ states.sensor.dark_sky_hourly_summary.state }}
{{ [ 'I hope you''re ready for an interesting day!',
'Get ready, today should be a fun one!',
'Get out there and kick some butt!',
] | random }}

View File

@ -29,39 +29,3 @@ sonos_tts:
- service: media_player.sonos_restore
data_template:
entity_id: "{{ sonos_entity|default('media_player.den') }}"
weather_report:
alias: Weather report
sequence:
- service: script.sonos_tts
data_template:
message: >-
{% if now().hour > 17 %}
Good evening!
{% elif now().hour > 12 %}
Good afternoon!
{% else %}
Good morning!
{% endif %}
{% if is_state('device_tracker.homeassistant_pixel', 'home') %}
Hi Correl!
{% endif %}
{% if is_state('device_tracker.stephaniesiphone', 'home') %}
Hi Stephanie!
{% endif %}
{% if is_state('device_tracker.PhilsGalaxyS7Edge', 'home') %}
Hi Phil!
{% endif %}
Today's forecast is
{{ states.weather.dark_sky.attributes.daily_forecast_summary }}.
Right now, the weather is
{{ states.weather.dark_sky.state}} at
{{ states.weather.dark_sky.attributes.temperature }}
degrees,
{{ states.weather.dark_sky.attributes.hourly_forecast_summary }}.
{{ [ 'I hope you''re ready for an interesting day!',
'Get ready, today should be a fun one!',
'Get out there and kick some butt!',
] | random }}