From a3d03fa1580199358c35da1378175e466f7d0af5 Mon Sep 17 00:00:00 2001 From: ccostan Date: Sun, 6 Oct 2019 14:00:44 -0400 Subject: [PATCH] Added in Code for Countdown sensors #288 --- config/packages/holiday.yaml | 31 +++++++++++++++++++++++++++ config/templates/speech/briefing.yaml | 2 +- config/travis_secrets.yaml | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) mode change 100644 => 100755 config/templates/speech/briefing.yaml diff --git a/config/packages/holiday.yaml b/config/packages/holiday.yaml index 0e6c325c..1decf16f 100755 --- a/config/packages/holiday.yaml +++ b/config/packages/holiday.yaml @@ -59,6 +59,37 @@ sensor: False {% endfor -%} +################################################################################ +# Countdown Sesor using WolfRam Alpha Natural language queries +################################################################################ + + - platform: rest + name: Halloween Countdown + resource: !secret wolframalpha_halloween_api + value_template: "{{ (value|replace(' days', '')) | int }}" + unit_of_measurement: Days + scan_interval: 43200 + + - platform: rest + name: Christams Countdown + resource: !secret wolframalpha_xmas_api + value_template: "{{ (value|replace(' days', '')) | int }}" + unit_of_measurement: Days + scan_interval: 43200 + + - platform: rest + name: Easter Countdown + resource: !secret wolframalpha_easter_api + value_template: "{{ (value|replace(' days', '')) | int }}" + unit_of_measurement: Days + scan_interval: 43200 + + - platform: rest + name: Mother's Day Countdown + resource: !secret wolframalpha_mothersday_api + value_template: "{{ (value|replace(' days', '')) | int }}" + unit_of_measurement: Days + scan_interval: 43200 ############################################################################### # Automation that notifies of a Holiday "state" change ############################################################################### diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml old mode 100644 new mode 100755 index 1ab84a7e..89729274 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -237,4 +237,4 @@ {% endif %} {# call a Random fact about the house or inspiration quote #} - {{ ([iss, iss, moon, uv, moon, uv, moon, uv, holiday, holiday, outside_weather, outside_weather, inspirational_quote]|random)() }} + {{ ([iss, moon, uv, holiday, outside_weather, outside_weather, inspirational_quote]|random)() }} diff --git a/config/travis_secrets.yaml b/config/travis_secrets.yaml index 9fdb8c4f..9b6bea85 100755 --- a/config/travis_secrets.yaml +++ b/config/travis_secrets.yaml @@ -73,3 +73,7 @@ cloud_user_pool: 'SuperSecretPlace' cloud_relayer: 'SuperSecretWebThingy' vantage_api: LONGAPIKEYFORFREE minecraft: private_server.com +wolframalpha_halloween_api: https://api.wolframalpha.com/v2/result?appid=JIUY8U-4V8KY45VT1&i=How%20many%20days%20until%20halloween +wolframalpha_xmas_api: https://api.wolframalpha.com/v2/result?appid=JIUY8U-4V8KY45VT1&i=How%20many%20days%20until%20christmas +wolframalpha_easter_api: https://api.wolframalpha.com/v2/result?appid=JIUY8U-4V8KY45VT1&i=How%20many%20days%20until%20easter +wolframalpha_mothersday_api: https://api.wolframalpha.com/v2/result?appid=JIUY8U-4V8KY45VT1&i=How%20many%20days%20until%20mothers%20day