Home-AssistantConfig/config/script/tweet.yaml

149 lines
7.7 KiB
YAML
Raw Normal View History

2018-01-02 00:00:45 +00:00
######################################################################################################
###Script to send notifications to Twitter as @BearStoneHA.
## Publish on Facebook as well - https://www.facebook.com/BearStoneHA/
2018-01-02 00:00:45 +00:00
## Enhancements by @dale3h
######################################################################################################
2018-03-16 19:23:09 +00:00
tweet_engine_setup:
sequence:
- service: script.tweet_engine
data_template:
tweet: >-
{%- macro minecraft() -%}
{{ [
"There are {{states.sensor.bear_stone.state}} #Minecraft users online at the momemt. #KidStat"
]|random }}
{%- endmacro -%}
{%- macro tv() -%}
{{ [
"The {{states.media_player.living_room_ultra.attributes.friendly_name}} #Roku is playing #{{states.media_player.living_room_ultra.attributes.app_name}}.",
"The {{states.media_player.upstairs_living_room.attributes.friendly_name}} #Roku is playing #{{states.media_player.upstairs_living_room.attributes.app_name}}. (http://amzn.to/2lYZEup)"
]|random }}
{%- endmacro -%}
{% call(pick) %}
# image: >-
# {%- macro minecraft_image() -%}
# {{ [
# "There are {{states.sensor.bear_stone.state}} #Minecraft users online at the momemt. #KidStat"
# ]|random }}
# {%- endmacro -%}
#
# {%- macro solar_image() -%}
# {{ [
# "I am keeping track of the current #Tesla stock price. It is {{ states.sensor.tesla.state | round }} dollars. #Solar",
# "The #ChevyBolt has been charging for about {{states.sensor.bolt_charging_time.attributes.value}}inutes in the last 7 days."
# ]|random }}
# {%- endmacro -%}
#
# {%- macro robot_image() -%}
# {{ [
# "Beep. Bop. Beep. Boop. I am a #roBOT run by @CCostan",
# "I have spoken for about {{states.sensor.speech_time.attributes.value}}inutes in the last 24 hours.",
# "When you add it all up, I have spoken for about {{states.sensor.speech_time.attributes.value}}inutes in the last 24 hours!",
# "The #Docker Host has been running for {{states.sensor.since_last_boot_templated.state}} (http://www.vmwareinfo.com/2018/02/journey-to-docker.html)",
# "The #Docker Host for Home Assistant is using {{states.sensor.disk_use_percent_.state}}% of the hard drive currently. (http://www.vmwareinfo.com/2018/02/journey-to-docker.html)",
# "My Home Assistant Database is currently using {{states.sensor.database_sensor.state}} MBs. To get this #Stat for your HA, visit (https://github.com/robmarkcole/HASS-filesize-sensor)",
# "I am running Home Assistant version {{states.sensor.ha_installed_version.state}} (https://github.com/CCOSTAN/Home-AssistantConfig)",
# "Home Assistant has been running for {{states.sensor.ha_uptime.state}}. (https://github.com/CCOSTAN/Home-AssistantConfig)"
# ]|random }}
# {%- endmacro -%}
#
# {%- macro door_image() -%}
# {{ [
# "The number of Doorbell presses yesterday was {{states.sensor.doorbell_presses.state}}",
# "{{states.sensor.doorbell_presses.state}} people came to the door today and pressed the bell.",
# "{{states.sensor.doorbell_presses.state}} doorbell presses occurred in the last 24 hours."
# ]|random }}
# {%- endmacro -%}
#
# {%- macro weather_image() -%}
# {{ [
# "The #Landscaping lights where on for about {{states.sensor.landscaping_light_time.attributes.value}} yesterday.",
# "I keep the average humidity of the house at {{states.sensor.downstairs_thermostat_humidity.state}} percent. Outside is {{states.sensor.dark_sky_humidity.state}} #Nest (http://amzn.to/2BWNk5N)",
# "Outside is {{states.sensor.dark_sky_temperature.state}}. I keep the average temperature at {{states.sensor.downstairs_thermostat_temperature.state}}. #Weather (http://amzn.to/2BWNk5N)",
# "I know that it will be {{states.sensor.dark_sky_minutely_summary.state}} So I will adjust the Heating/Cooling, irrigation and lighting accordingly. #Nest #Rachio #Hue",
# "The current UV index is {{states.sensor.dark_sky_uv_index.state}} and the Moon is {{states.sensor.moon.state}}. #Space",
# "Average Cloud Coverage: {{states.sensor.dark_sky_cloud_coverage.state}}%, Average Temp: {{states.sensor.dark_sky_temperature.state}}°F #Solar (http://www.vmwareinfo.com/2018/01/going-green-to-save-some-green-in-2018.html)"
# ]|random }}
# {%- endmacro -%}
#
# {%- macro internet_image() -%}
# {{ [
# "So far, I have prevented {{states.sensor.pihole_ads_blocked_today.state}} ads from hitting the network via Pi-hole! http://www.pi-hole.net",
# "Pi-hole (http://www.pi-hole.net) has serviced {{states.sensor.pihole_dns_queries_today.state}} DNS requests today! #PiZero",
# "Average internet stats are Download: {{states.sensor.speedtest_download.state}} Mbit/s & Upload {{states.sensor.speedtest_upload.state}} Mbit/s.",
# "My @getspectrum internet download speed is about {{states.sensor.speedtest_download.state}} Mbit/s and I am a #cordcutter. @TabloTV",
# "Yesterday we watched about {{states.sensor.tv_time.attributes.value}}inutes of television. @YouTube & @TabloTV on the @Roku"
# ]|random }}
# {%- endmacro -%}
#
# {%- macro stocks_image() -%}
# {{ [
# "I am keeping track of the current #Tesla stock price. It is {{ states.sensor.tesla.state | round }} dollars. #Solar",
# "I am keeping track of the current #Bitcoin prices. It is {{ states.sensor.bitcoin.state | round }} dollars. #BTC"
# ]|random }}
# {%- endmacro -%}
#
# {%- macro night_image() -%}
# {{ [
# "Todays Sleep Number is {{states.sensor.sleepnumber_carlo_stacey_sleepnumber.state}}. Wifi connected Bed FTW! #SleepStat (http://amzn.to/2D10BcQ)",
# "Our Sleep Number is {{states.sensor.sleepnumber_carlo_carlo_sleepnumber.state}}. Wifi connected Bed! #SleepStat (http://amzn.to/2D10BcQ)"
# ]|random }}
# {%- endmacro -%}
#
# {%- macro TV_image() -%}
# {{ [
# "The {{states.media_player.living_room_ultra.attributes.friendly_name}} #Roku is playing #{{states.media_player.living_room_ultra.attributes.app_name}}.",
# "The {{states.media_player.upstairs_living_room.attributes.friendly_name}} #Roku is playing #{{states.media_player.upstairs_living_room.attributes.app_name}}. (http://amzn.to/2lYZEup)"
# ]|random }}
# {%- endmacro -%}
tweet_engine_image:
2018-01-02 00:00:45 +00:00
sequence:
- service: mqtt.publish
2018-01-02 00:00:45 +00:00
data_template:
topic: 'ifttt/message'
2018-01-12 18:33:07 +00:00
payload: >-
2018-03-13 20:47:25 +00:00
{{ tweet }}
retain: true
2018-01-11 20:39:24 +00:00
2018-01-12 18:33:07 +00:00
- service: notify.BearStoneHA
data_template:
message: >-
{{ tweet }} #IOT #SmartHome
2018-03-13 20:47:25 +00:00
data:
2018-03-13 20:40:46 +00:00
media: >-
{{image}}
2018-01-12 18:33:07 +00:00
tweet_engine:
sequence:
- service: mqtt.publish
data_template:
topic: 'ifttt/message'
payload: >-
{{ tweet }}
retain: true
- service: notify.BearStoneHA
data_template:
message: >-
{{ tweet }} #IOT #SmartHome
# - service: ifttt.trigger
# data_template: {"event":"facebook_tweet", "value1":"{{ tweet }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"}
2018-01-12 18:33:07 +00:00
# - service: ifttt.trigger
# data_template:
# event: >-
# facebook_tweet
# value1: >
# {{states.sensor.ifttt_formatted_message.state}} #IOT #SmartHome