home-assistant-configuration/config/packages/twitter.yaml

285 lines
11 KiB
YAML
Executable File

###############################################################################
# @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'
- service: script.twitter_github
data_template:
message: >-
"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"
#- id: tweet_new_ha_version
# alias: Tweet New HA Version
# trigger:
# - platform: state
# entity_id: binary_sensor.updater
# from: 'off'
# to: 'on'
# action:
# - service: script.twitter_new_ha
- 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
- 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
- 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
- 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'
- service: script.twitter_bot_info
data_template:
message: >-
"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"
- id: net_speed_report
initial_state: true
alias: Network Speed Report
trigger:
- platform: time
at: '11:15:00'
action:
- service: script.twitter_speedtest
data_template:
message: '{{ [ "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 }}'
- 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"
- id: Halloween Countdown Tweet
alias: Halloween Countdown Tweet
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 -%}
- condition: template
value_template: >
{%- set event=states.sensor.halloween_countdown.state | int %}
{%- if event > 0 %}
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: >-
{{ [ "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?",
"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."
] | random }}
- id: Christmas Countdown Tweet
alias: Christmas Countdown Tweet
initial_state: true
trigger:
- platform: time
at: '13: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 -%}
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: '{{ [ "There are only {{states.sensor.christmas_countdown.state}} days until Christmas.",
"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."
] | random }}'
- id: Christmas Eve Tweet
alias: Christmas Eve Tweet
initial_state: true
trigger:
- platform: time
at: '13: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:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_xmas_eve
data_template:
message: >-
'Tomorrow is Christmas. It is practically here! Santa is coming tonight! Don't forget the cookies!'
- id: Christmas Day Tweet
alias: Christmas Day Tweet
initial_state: true
trigger:
- platform: time
at: '04: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:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_xmas_day
data_template:
message: >-
'From everyone at Anchorage House, Merry Christmas!'
- 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'
- service: script.twitter_freezing
data_template:
message: '{{ [ "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 }}'