From b05d4ebf27a5e122dc14f6732ee378be4023c6e3 Mon Sep 17 00:00:00 2001 From: ccostan Date: Mon, 15 Jun 2020 17:52:36 -0400 Subject: [PATCH] This is a pretty good start for reusable code. #777 --- config/packages/twitter.yaml | 32 ++------------------- config/script/tweet.yaml | 3 +- config/script/tweet_youtube.yaml | 3 +- config/templates/speech/briefing.yaml | 2 +- config/templates/speech/youtube_picker.yaml | 11 +++++++ 5 files changed, 18 insertions(+), 33 deletions(-) create mode 100755 config/templates/speech/youtube_picker.yaml diff --git a/config/packages/twitter.yaml b/config/packages/twitter.yaml index 9ce58289..6d1ad784 100755 --- a/config/packages/twitter.yaml +++ b/config/packages/twitter.yaml @@ -3,14 +3,6 @@ # @CCOSTAN # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig #------------------------------------------- -# homeassistant: -# customize_glob: -# "input_select.log_*": -# icon: mdi:bug -# -# - -#Random number - https://www.random.org/integers/?num=1&min=1&max=10&col=1&base=10&format=plain&rnd=new notify: - name: BearStoneHA @@ -253,17 +245,7 @@ automation: - delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}' - service: script.tweet_youtube_engine_setup data_template: - pick: >- - {% set pick = [ - "ThrowBack", "S01E01", "S01E02","S01E03", "S01E04","S01E05", "S01E06","S01E07", "S01E08","S01E09", "S01E10", - "S01E11", "S01E12","S01E13", "S01E14","S01E15", "S01E16","S01E17", "S01E18","S01E19", "S01E20", "S01E21", - "S02E01", "S02E02","S02E03", "S02E04","S02E05", "S02E06","S02E07", "S02E08","S02E09", "S02E10", - "S02E11", "S02E12","S02E13", "S02E14","S02E15", "S02E16","S02E17", "S02E18","S02E19", "S02E20", - "S02E22", "S02E25", "S02E26", "S02E27", "S02E28", "S02E29", "S02E30", "S02E31", "S02E32", "S02E33", "S02E34", - "S02E35", "S02E36", "S02E37", "S02E38", "S02E39", "S02E40","S02E41", "Bearnews1", "Bearnews2", "Bearnews3", "Bearnews4", - "S03E01", "Bearnews5", "Bearnews6", "Bearnews7", "S03E02", "S03E03", "Logger", "SolarPalmLight" - ] %} - {{ pick|random }} + pick: !include ../templates/speech/youtube_picker.yaml - alias: 'Random YouTube Videos CCostan' @@ -283,14 +265,4 @@ automation: - service: script.tweet_youtube_engine_setup data_template: who: 'ccostan' - pick: >- - {% set pick = [ - "ThrowBack", "S01E01", "S01E02","S01E03", "S01E04","S01E05", "S01E06","S01E07", "S01E08","S01E09", "S01E10", - "S01E11", "S01E12","S01E13", "S01E14","S01E15", "S01E16","S01E17", "S01E18","S01E19", "S01E20", "S01E21", - "S02E01", "S02E02","S02E03", "S02E04","S02E05", "S02E06","S02E07", "S02E08","S02E09", "S02E10", - "S02E11", "S02E12","S02E13", "S02E14","S02E15", "S02E16","S02E17", "S02E18","S02E19", "S02E20", - "S02E22", "S02E25", "S02E26", "S02E27", "S02E28", "S02E29", "S02E30", "S02E31", "S02E32", "S02E33", "S02E34", - "S02E35", "S02E36", "S02E37", "S02E38", "S02E39", "S02E40","S02E41", "Bearnews1", "Bearnews2", "Bearnews3", "Bearnews4", - "S03E01", "Bearnews5", "Bearnews6", "Bearnews7", "S03E02", "S03E03", "Logger", "SolarPalmLight" - ] %} - {{ pick|random }} + pick: !include ../templates/speech/youtube_picker.yaml diff --git a/config/script/tweet.yaml b/config/script/tweet.yaml index 66b35e10..1fda7fa5 100755 --- a/config/script/tweet.yaml +++ b/config/script/tweet.yaml @@ -46,7 +46,8 @@ tweet_engine_setup: "Adding a Mixer and the AMP to this Text to Speech solution changed the Smart Home! (https://www.vcloudinfo.com/2017/07/giving-voice-to-smart-home.html)", "Some of my favorite #Docker Containers that I am using - (https://www.vcloudinfo.com/2018/06/rolling-out-some-new-docker-containers.html)", "10 year safety check. If you have not done it yet, you need to! (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html)", - "How to use template conditions in Home Assistant. (https://www.vcloudinfo.com/2019/06/how-to-use-template-conditions-in-home-assistant.html)" + "How to use template conditions in Home Assistant. (https://www.vcloudinfo.com/2019/06/how-to-use-template-conditions-in-home-assistant.html)", + "Why No Comments? Find out why. (https://www.vcloudinfo.com/2019/09/why-no-more-comments.html)" ], "robot": [ diff --git a/config/script/tweet_youtube.yaml b/config/script/tweet_youtube.yaml index f63e9e9e..5fff0873 100755 --- a/config/script/tweet_youtube.yaml +++ b/config/script/tweet_youtube.yaml @@ -29,7 +29,8 @@ tweet_youtube_engine_setup: "My Full Smart Home diagram and #IOT icon set that you can download to build your own! - (https://www.vcloudinfo.com/2018/07/the-bear-stone-home-assistant-icon.html)," "Be sure to like us on Facebook to get all posts and Video notifications (https://www.facebook.com/vcloudinfo/)", "You can see how ALL of this is done by browsing my GitHub Repository (https://github.com/CCOSTAN/Home-AssistantConfig#logo)", - "10 year safety check. If you have not done it yet, you need to! (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html)" + "10 year safety check. If you have not done it yet, you need to! (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html)", + "Why No Comments? Find out why... (https://www.vcloudinfo.com/2019/09/why-no-more-comments.html)" ], "S01E01": [ "Tesla Solar Panels vs #Hurricane IRMA! (https://www.vcloudinfo.com/2018/09/re-installing-tesla-solar-panels-again.html)" diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index 619cdd8d..50a026bf 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -1,4 +1,4 @@ - >- +>- {%- macro dark_outside() -%} {{ [ 'It is pretty dark outside. I will turn on the outside lights now.', diff --git a/config/templates/speech/youtube_picker.yaml b/config/templates/speech/youtube_picker.yaml new file mode 100755 index 00000000..5aac5ad4 --- /dev/null +++ b/config/templates/speech/youtube_picker.yaml @@ -0,0 +1,11 @@ +>- + {% set pick = [ + "ThrowBack", "S01E01", "S01E02","S01E03", "S01E04","S01E05", "S01E06","S01E07", "S01E08","S01E09", "S01E10", + "S01E11", "S01E12","S01E13", "S01E14","S01E15", "S01E16","S01E17", "S01E18","S01E19", "S01E20", "S01E21", + "S02E01", "S02E02","S02E03", "S02E04","S02E05", "S02E06","S02E07", "S02E08","S02E09", "S02E10", + "S02E11", "S02E12","S02E13", "S02E14","S02E15", "S02E16","S02E17", "S02E18","S02E19", "S02E20", + "S02E22", "S02E25", "S02E26", "S02E27", "S02E28", "S02E29", "S02E30", "S02E31", "S02E32", "S02E33", "S02E34", + "S02E35", "S02E36", "S02E37", "S02E38", "S02E39", "S02E40","S02E41", "Bearnews1", "Bearnews2", "Bearnews3", "Bearnews4", + "S03E01", "Bearnews5", "Bearnews6", "Bearnews7", "S03E02", "S03E03", "Logger", "SolarPalmLight" + ] %} + {{ pick|random }}