From 199b79d6ec3f02d39daab131e082e3e759137f2e Mon Sep 17 00:00:00 2001 From: ccostan Date: Sat, 27 Jun 2020 13:05:13 -0400 Subject: [PATCH] Closes #720 - Add in YouTube Sensors --- config/packages/youtube.yaml | 32 ++++++++++++++++++++++++++++++++ config/script/tweet.yaml | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100755 config/packages/youtube.yaml diff --git a/config/packages/youtube.yaml b/config/packages/youtube.yaml new file mode 100755 index 00000000..3f519f4b --- /dev/null +++ b/config/packages/youtube.yaml @@ -0,0 +1,32 @@ +#------------------------------------------- +# Visit The Main Blog for More Home Assistant Goodness - https://www.vCloudInfo.com +# Follow me on the socials - @CCOSTAN +# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig +# YouTube Related Packages from @Pinkywafer +# https://github.com/pinkywafer/Home-Assistant_Config/blob/master/packages/youtube/vcloudinfo.yaml +# More information found here in these issues +# https://github.com/CCOSTAN/Home-AssistantConfig/issues/720 +#------------------------------------------- + +sensor: + - platform: youtube + channel_id: UC301G8JJFzY0BZ_0lshpKpQ + + - platform: socialblade + name: vCloudinfo_info + channel_id: UC301G8JJFzY0BZ_0lshpKpQ + +automation: + - alias: YouTube Notification - vCloudInfo + trigger: + - platform: state + entity_id: sensor.vcloudinfo + + action: + - service: script.tweet_engine_image + data_template: + tweet: > + {{ [ + "New Video! {{ states('sensor.vcloudinfo_info') }} - {{ state_attr('sensor.vcloudinfo','url') }} " + ] | random }} + image: "{{state_attr('sensor.vcloudinfo','entity_picture')}}" diff --git a/config/script/tweet.yaml b/config/script/tweet.yaml index 1fda7fa5..9ffd9bec 100755 --- a/config/script/tweet.yaml +++ b/config/script/tweet.yaml @@ -18,7 +18,7 @@ tweet_engine_setup: "Your house can be a #smarthome too. All you need is #home_assistant, some time and some config files. I suggest starting with our GitHub repo (https://github.com/CCOSTAN/Home-AssistantConfig#logo)", "Be sure to like us on Facebook to get all post 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)", - "If you are not subscribed to our YouTube channel, you are missing out on the goodies! (https://youtube.com/vCloudInfo)", + "If you are not subscribed to our YouTube channel like {{ states('sensor.vcloudinfo_info') }} others, you are missing out on the goodies! (https://youtube.com/vCloudInfo)", "Join our GitHub repo (https://github.com/CCOSTAN/Home-AssistantConfig#logo) with {{ states.sensor.github_stats.attributes.stargazers_count}} other users. Browse the {{ states.sensor.github_stats.attributes.open_issues }} #Todo items.", "Check out my Cameo on @feinbergpaul inspiring video. (https://www.youtube.com/watch?v=5rsdwJZ0SLY&feature=youtu.be&t=85) #GoCreate #nosmallcreator ", "Quick YouTube cameo on #HomeKit #Geeks channel. Check it out! (https://youtu.be/3tutxHO0J78?t=872) " @@ -125,7 +125,7 @@ tweet_engine_setup: "joke": [ "Visit the Repo (https://github.com/CCOSTAN/Home-AssistantConfig#logo) ", "Like and follow for more of these #HomeAutomation gems! ", - "Visit https://YouTube.com/vCloudInfo " + "Join {{ states('sensor.vcloudinfo_info') }} other subscribers and visit https://YouTube.com/vCloudInfo " ] } %}