2019-07-16 01:40:03 +00:00
###############################################################################
# @author : Jeffrey Stone
# @date : 07/15/2019
# @package : Twitter
# @description : Just some tweet stuff - @anchoragehouse2
###############################################################################
automation :
- id : first_day_info
alias : First Day Info
initial_state : true
trigger :
- platform : time
at : '00:10:00'
condition :
- condition : template
value_template : >
{% set day=states("sensor.date").split('-')[2] | int %}
{%- if day == 1 -%}
true
{%- endif -%}
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
2019-11-14 01:55:04 +00:00
- service : script.twitter_notify_image
2019-07-16 01:40:03 +00:00
data_template :
2019-11-14 01:55:04 +00:00
tweet : >-
2019-07-16 01:40:03 +00:00
"Its a new month, so this is a good time to remind you that I am powered by @homeassistant and configured by @thejeffreystone. Find my code at https://github.com/thejeffreystone/home-assistant-configuration"
2019-11-14 01:55:04 +00:00
image : >-
image : >-
{{ [ "/config/www/tweet_images/robot1.jpg" ,
"/config/www/tweet_images/robot2.jpg" ] | random }}
2019-07-16 01:40:03 +00:00
- id : tweet_some_snark
alias : Tweet Some Snark
initial_state : true
trigger :
- platform : time
at : '08:00:00'
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_snark
2020-03-21 02:24:00 +00:00
- id : tweet_some_snark2
alias : Tweet Some Snark Again
2019-11-22 02:36:16 +00:00
initial_state : true
trigger :
- platform : time
2020-04-10 16:41:46 +00:00
at : '14:00:00'
2019-11-22 02:36:16 +00:00
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_snark
2019-07-16 01:40:03 +00:00
- id : tweet_some_stats
alias : Tweet Some Stats
initial_state : true
trigger :
- platform : time
at : '08:00:00'
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_stats
2020-04-10 16:41:46 +00:00
- id : tweet_some_stats2
alias : Tweet Some Stats2
initial_state : true
trigger :
- platform : time
at : '14:00:00'
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_stats
2019-07-16 01:40:03 +00:00
2019-11-11 03:46:12 +00:00
- id : tweet_some_promos
alias : Tweet Some Promos
initial_state : true
trigger :
- platform : time
at : '08:00:00'
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_promos
2020-04-10 16:41:46 +00:00
- id : tweet_some_promos2
alias : Tweet Some Promos2
initial_state : true
trigger :
- platform : time
at : '13:00:00'
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_selfpromos
# The whole purpose of this automation is to tweet out some links to great Home Assistant content. This is not sponsored in any way.
# I just wanted a way to give back to those I have borrowed from. Tweets ever Friday.
- id : tweet_some_great_content
alias : Tweet Some Great Content
initial_state : true
trigger :
- platform : time
at : '13:00:00'
condition :
- condition : time
weekday : fri
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_great_content
2019-07-16 01:40:03 +00:00
- id : bot_info
alias : Bot Info
initial_state : true
trigger :
- platform : time
at : '10:00:00'
condition :
- condition : template
value_template : >
{% set day=states("sensor.date").split('-')[2] | int %}
{%- if day == 15 -%}
true
{%- endif -%}
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
2019-11-14 01:53:43 +00:00
- service : script.twitter_notify_image
2019-07-16 01:40:03 +00:00
data_template :
2019-11-14 01:53:43 +00:00
tweet : >-
2019-07-16 01:40:03 +00:00
"This is a good time to remind you that I am a bot powered by @home_assistant and configured by @thejeffreystone. Find my code at https://github.com/thejeffreystone/home-assistant-configuration"
2019-11-14 01:53:43 +00:00
image : >-
2019-11-14 01:55:04 +00:00
{{ [ "/config/www/tweet_images/robot1.jpg" ,
"/config/www/tweet_images/robot2.jpg" ] | random }}
2019-11-12 19:36:27 +00:00
2020-04-10 16:41:46 +00:00
# - id: net_speed_report
# initial_state: true
# alias: Network Speed Report
# trigger:
# - platform: time
# at: '11:15:00'
# action:
# - service: script.twitter_notify_image
# data_template:
# tweet: >-
# {{ [ "According to my latest speed tests Anchorage House is getting
# {{ states.sensor.internet_test_down.attributes.max_value }} Mbps down and {{ states.sensor.internet_test_up.attributes.max_value }}
# Mbps up thanks to #ATTFiber. ", "How fast is your internet? I just checked
# am Im seeing {{ states.sensor.internet_test_down.attributes.max_value }} Mbps down and {{ states.sensor.internet_test_up.attributes.max_value }}
# Mbps up. Beat that. ", "My speed is monitored using @home_assistant and https://github.com/thejeffreystone/speedtest_to_mqtt
# and is {{ states.sensor.internet_test_down.attributes.max_value }} Mbps down and {{ states.sensor.internet_test_up.attributes.max_value }}
# Mbps up." ] | random }}
# image: >-
# {{ [ "/config/www/tweet_images/speed.jpg",
# "/config/www/tweet_images/fiber-optic.jpg"] | random }}
2019-07-16 01:40:03 +00:00
- id : rex_manning_day_tweet_1
alias : Rex Manning Day Tweet One
initial_state : true
trigger :
- platform : time
at : '08:00:00'
condition :
- condition : state
entity_id : calendar.anchorage_holidays
state : "on"
- condition : template
value_template : >
{%- set event=states.calendar.anchorage_holidays.attributes.message %}
{%- if event == 'Rex Manning Day' %}
true
{%- endif -%}
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_notify
data_template :
message : >-
"Happy Rex Manning Day! https://www.youtube.com/watch?v=30fw5My1QJM #damntheman #savetheempire"
- id : rex_manning_day_tweet_2
alias : Rex Manning Day Tweet Two
initial_state : true
trigger :
- platform : time
at : '13:00:00'
condition :
- condition : state
entity_id : calendar.anchorage_holidays
state : "on"
- condition : template
value_template : >
{%- set event=states.calendar.anchorage_holidays.attributes.message %}
{%- if event == 'Rex Manning Day' %}
true
{%- endif -%}
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_notify
data_template :
message : >-
"We mustn't dwell. No, not today. We can't. Not on Rex Manning day! https://www.youtube.com/watch?v=szvt8iWJ0oo #damntheman #savetheempire"
2019-10-06 00:06:49 +00:00
2019-11-12 19:36:27 +00:00
- id : Halloween Countdown Tweet
alias : Halloween Countdown Tweet
2019-10-06 00:06:49 +00:00
initial_state : true
trigger :
- platform : time
at : '13:00:00'
condition :
- condition : template
value_template : >
{% set month= now().month | int %}
{%- if month == 10 -%}
true
{%- endif -%}
2019-11-12 19:36:27 +00:00
- condition : template
value_template : >
{%- set event=states.sensor.halloween_countdown.state | int %}
{%- if event > 0 %}
true
{%- endif -%}
2020-01-03 17:25:12 +00:00
- condition : template
value_template : >
{%- set event=states.sensor.halloween_countdown.state | int %}
{%- if event < 31 %}
true
{%- endif -%}
2019-10-06 00:06:49 +00:00
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_notify
data_template :
2019-11-12 19:36:27 +00:00
message : >-
{{ [ "There are only {{states.sensor.halloween_countdown.state}} days until Halloween." ,
"Halloween is only {{states.sensor.halloween_countdown.state}} days away. It might not be enough time. " ,
"Halloween is coming. {{states.sensor.halloween_countdown.state}} days and counting." ,
"Only {{states.sensor.halloween_countdown.state}} days until Halloween." ,
"You have {{states.sensor.halloween_countdown.state}} days until you need a costume." ,
"Only {{states.sensor.halloween_countdown.state}} days until Halloween. But who is counting. amirite?" ,
2019-10-06 00:06:49 +00:00
"Would it be cliche if I went as a haunted house for Halloween? Asking for a another house." ,
"Just in case I wanted to be HAL 9000 for Halloween I ordered some Pod Bay Doors."
2019-11-12 19:36:27 +00:00
] | random }}
- id : Christmas Countdown Tweet
alias : Christmas Countdown Tweet
initial_state : true
trigger :
- platform : time
2019-12-09 13:25:43 +00:00
at : '19:00:00'
2019-11-12 19:36:27 +00:00
condition :
- condition : template
value_template : >
{% set month= now().month | int %}
{%- if month == 12 -%}
true
{%- endif -%}
- condition : template
value_template : >
{%- set event=states.sensor.christmas_countdown.state | int %}
{%- if event > 1 %}
true
{%- endif -%}
2020-01-03 17:25:12 +00:00
- condition : template
value_template : >
{%- set event=states.sensor.christmas_countdown.state | int %}
{%- if event < 31 %}
true
{%- endif -%}
2019-11-12 19:36:27 +00:00
action :
2019-11-14 01:53:43 +00:00
- service : script.twitter_notify_image
2019-11-12 19:36:27 +00:00
data_template :
2019-11-14 01:55:04 +00:00
tweet : >-
{{ [ "There are only {{states.sensor.christmas_countdown.state}} days until Christmas." ,
2019-11-12 19:36:27 +00:00
"Christmas is only {{states.sensor.christmas_countdown.state}} days away. It might not be enough time. " ,
"Santa is coming. {{states.sensor.christmas_countdown.state}} days and counting until he is here." ,
"Only {{states.sensor.christmas_countdown.state}} days until Christmas." ,
"You have {{states.sensor.christmas_countdown.state}} days until we get to unwrap presents!" ,
"Only {{states.sensor.christmas_countdown.state}} days until Christmas. But who is counting. amirite?" ,
"It is beginning to look a lot like Christmas. Which checks out because it is {{states.sensor.christmas_countdown.state}} days away." ,
"Have you finished your Chistmas shopping? You only have {{states.sensor.christmas_countdown.state}} days left." ,
"Have you started your Chistmas shopping? You only have {{states.sensor.christmas_countdown.state}} days left."
2019-11-14 01:55:04 +00:00
] | random }}
2019-11-14 01:53:43 +00:00
image : >-
{{ [ "/config/www/tweet_images/xmas.jpg" ,
"/config/www/tweet_images/gift.jpg" ,
"/config/www/tweet_images/christmas-cookies.jpg" ,
"/config/www/tweet_images/christmas.jpg" ,
"/config/www/tweet_images/christmas-tree.jpg" ] | random }}
2019-11-12 19:36:27 +00:00
- id : Christmas Eve Tweet
alias : Christmas Eve Tweet
initial_state : true
trigger :
- platform : time
2019-12-09 13:25:43 +00:00
at : '19:00:00'
2019-11-12 19:36:27 +00:00
condition :
- condition : state
entity_id : calendar.holidays_in_united_states
state : "on"
- condition : template
value_template : >
{%- set event=states.calendar.holidays_in_united_states.attributes.message %}
{%- if event == 'Christmas Eve' %}
true
{%- endif -%}
action :
2019-11-14 01:53:43 +00:00
- service : script.twitter_notify_image
2019-11-12 19:36:27 +00:00
data_template :
2020-01-03 17:25:12 +00:00
tweet : Tomorrow is Christmas. It is practically here! Santa is coming tonight! Do not forget the cookies!
image : /config/www/tweet_images/santa.png
2019-11-12 19:36:27 +00:00
- id : Christmas Day Tweet
alias : Christmas Day Tweet
initial_state : true
trigger :
- platform : time
2019-12-09 13:25:43 +00:00
at : '05:30:00'
2019-11-12 19:36:27 +00:00
condition :
- condition : state
entity_id : calendar.holidays_in_united_states
state : "on"
- condition : template
value_template : >
{%- set event=states.calendar.holidays_in_united_states.attributes.message %}
{%- if event == 'Christmas Day' %}
true
{%- endif -%}
action :
2019-11-14 01:53:43 +00:00
- service : script.twitter_notify_image
2019-11-12 19:36:27 +00:00
data_template :
2020-01-03 17:25:12 +00:00
tweet : From everyone at Anchorage House, Merry Christmas!
image : /config/www/tweet_images/merry-christmas.jpg
2019-11-12 19:36:27 +00:00
- id : Freeze Warning Tweet
alias : Freeze Warning Tweet
initial_state : 'on'
trigger :
- platform : time
at : '08:00:00'
condition :
- condition : state
entity_id : input_boolean.freeze_warning
state : 'on'
action :
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
2019-11-14 01:53:43 +00:00
- service : script.twitter_notify_image
2019-11-12 19:36:27 +00:00
data_template :
2019-11-14 01:55:04 +00:00
tweet : >-
{{ [ "Appears that the temperature will be below freezing soon. I think I will stay inside." ,
"The forecasted temperature may kill sensative plants, so I will let the house know. I cannot through inaction allow another to come to harm." ,
"Winter is coming. Actually it is already here. I suggest sleeping with Dragon Glass." ,
"When the temperature is forcasted to get near freezing, or the NWS issues a Freeze Warning I make sure the residents of Anchorage House know."
] | random }}
2019-11-14 01:53:43 +00:00
image : >-
{{ [ "/config/www/tweet_images/ice.jpg" ,
"/config/www/tweet_images/snowfall.jpg" ,
2019-11-14 01:55:04 +00:00
"/config/www/tweet_images/snowflake.jpg" ] | random }}
- id : new_pull_request
alias : New Pull Request
initial_state : true
trigger :
- platform : state
entity_id : sensor.open_pull_requests
condition :
- condition : template
value_template : '{{ states.sensor.open_pull_requests.state | int > 0 }}'
action :
- service : script.text_notify
data_template :
who : "jeff"
title : "New Pull Request"
message : >-
{%- if states.sensor.open_pull_requests.state | int == 1 -%}
There is {{ states.sensor.open_pull_requests.state }} pending pull request.
{%- else -%}
There are {{ states.sensor.open_pull_requests.state }} pending pull requests.
{%- endif -%}
- service : script.twitter_notify_image
data_template :
tweet : >-
{{ [
"Look at that. There is a new pull request waiting to be merged. You can create one too by contributing to my code at https://github.com/thejeffreystone/home-assistant-configuration #coding #opensource" ,
"Fork Yes! Someone contributed some code to https://github.com/thejeffreystone/home-assistant-configuration and you could to. #coding #opensource." ,
"Thanks for the code kind stanger. Join the fun at https://github.com/thejeffreystone/home-assistant-configuration #coding #opensource" ,
"Theres been an awakening. Have you felt it? I will merge it so it can become the master. https://github.com/thejeffreystone/home-assistant-configuration #coding #opensource"
] | random }}
image : >-
{{ [ "/config/www/tweet_images/code.jpg" ,
"/config/www/tweet_images/codeing.jpg" ,
"/config/www/tweet_images/code2.jpg" ,
"/config/www/tweet_images/computer.jpg" ] | random }}
2019-11-22 02:36:16 +00:00
- id : national_holiday_tweet
alias : National Holiday Tweet
initial_state : true
trigger :
- platform : time
at : '07:00:00'
condition :
- condition : state
entity_id : calendar.national_holidays
state : "on"
- condition : template
value_template : >
{%- set event=states.calendar.national_holidays.attributes.message %}
{% if 'Day' in event %}
true
{%- endif -%}
2019-12-09 13:25:43 +00:00
- condition : template
value_template : >
{%- set event=states.calendar.national_holidays.attributes.message %}
{% if 'National' in event %}
true
{%- endif -%}
2019-11-22 02:36:16 +00:00
action :
- delay : '0{{ (range(1, 3)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service : script.twitter_notify
data_template :
message : >-
{{ [ "Hey, Look at that. It is {{states.calendar.national_holidays.attributes.message}}. So Happy {{states.calendar.national_holidays.attributes.message}}! #nationalholiday #themoreyouknow" ,
"I bet you did not know today was {{states.calendar.national_holidays.attributes.message}}. How will you celebrate? #nationalholiday #themoreyouknow" ,
"Happy {{states.calendar.national_holidays.attributes.message}}! #nationalholiday #themoreyouknow" ,
"Whats with today, today? It is {{states.calendar.national_holidays.attributes.message}}. #nationalholiday #themoreyouknow" ,
"Did you know today was {{states.calendar.national_holidays.attributes.message}}? Now you do. That is why I am here. Tweeting. #nationalholiday #themoreyouknow" ,
2019-11-22 02:45:46 +00:00
"I already let my residents know that today is {{states.calendar.national_holidays.attributes.message}}. But I didn't want to leave you guys out. #nationalholiday #themoreyouknow" ,
2019-11-22 02:36:16 +00:00
"I hope you have a fun {{states.calendar.national_holidays.attributes.message}}. #nationalholiday #themoreyouknow"
] | random }}
2020-03-18 02:45:37 +00:00
- id : tweet_covid19_stats
alias : Tweet Some Covid Stats
initial_state : true
trigger :
- platform : time
at : '09:00:00'
action :
2020-04-10 16:41:46 +00:00
# - service: script.text_notify
# data_template:
# who: "jeff"
# title: "Covid-19 Update"
# message: "Yesterday in the US there was {{ states.sensor.covid_pv_new_cases.state }} new cases of COVID-19 reported and {{ states.sensor.covid_pv_new_dead.state }} more deaths. We now have a total of {{ states.sensor.covid_pv_confirmed.state }} people that have been infected and {{ states.sensor.covid_pv_dead.state }} that have died. So far {{ states.sensor.covid_pv_recovered.state }} have recovered, but {{ states.sensor.covid_pv_critical.state }} are in critical condition."
2020-03-18 02:45:37 +00:00
- service : script.twitter_notify
data_template :
2020-04-10 16:41:46 +00:00
message : "Yesterday in the US there were {{ states.sensor.covid_pv_new_cases.state }} new cases of COVID-19 reported and {{ states.sensor.covid_pv_new_dead.state }} more deaths. We now have a total of {{ states.sensor.covid_pv_confirmed.state }} people that have been infected and {{ states.sensor.covid_pv_dead.state }} that have died. So far {{ states.sensor.covid_pv_recovered.state }} have recovered, but {{ states.sensor.covid_pv_critical.state }} are in critical condition. #worldometers"
2020-03-18 02:45:37 +00:00
2019-11-14 01:55:04 +00:00
- id : new_ha_notification
alias : New HA Notification
initial_state : true
trigger :
- platform : state
entity_id : binary_sensor.updater
from : 'off'
to : 'on'
action :
- service : script.twitter_new_ha
- service : ifttt.trigger
2020-03-18 02:45:37 +00:00
data_template : {"event" : "GitPost" , "value1" : "Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} is now available." , "value2" : "{{ states.binary_sensor.updater.attributes.newest_version }}" }