Great updated config by @dale3h!
This commit is contained in:
parent
4ec0c81c01
commit
55859dec9b
|
@ -1,5 +1,5 @@
|
|||
######################################################################################################
|
||||
###Script to send notifications to Twitter as @BearStoneHA.
|
||||
## Script to send notifications to Twitter as @BearStoneHA.
|
||||
## Publish on Facebook as well - https://www.facebook.com/BearStoneHA/
|
||||
## Enhancements by @dale3h
|
||||
######################################################################################################
|
||||
|
@ -9,165 +9,117 @@ tweet_engine_setup:
|
|||
- service: script.tweet_engine_image
|
||||
data_template:
|
||||
tweet: >-
|
||||
{%- macro minecraft() -%}
|
||||
{{ [
|
||||
"There are {{states.sensor.bear_stone.state}} #Minecraft users online at the momemt. #KidStat"
|
||||
]|random }}
|
||||
{%- macro tweet(topic) -%}
|
||||
{% set tweets = {
|
||||
"minecraft": [
|
||||
"There are {{ states('sensor.bear_stone') }} #Minecraft users online at the momemt. #KidStat"
|
||||
],
|
||||
|
||||
"solar": [
|
||||
"I am keeping track of the current #Tesla stock price. It is {{ states('sensor.tesla')|round }} dollars. #Solar",
|
||||
"The #ChevyBolt has been charging for about {{ states.sensor.bolt_charging_time.attributes.value|replace('m', '') }} minutes in the last 7 days."
|
||||
],
|
||||
|
||||
"robot": [
|
||||
"Beep. Bop. Beep. Boop. I am a #roBOT run by @CCostan",
|
||||
"The #ChevyBolt has been charging for about {{ states.sensor.bolt_charging_time.attributes.value|replace('m', '') }} minutes in the last 7 days.",
|
||||
"I have spoken for about {{ states.sensor.speech_time.attributes.value|replace('m', '') }} minutes in the last 24 hours.",
|
||||
"When you add it all up, I have spoken for about {{ states.sensor.speech_time.attributes.value|replace('m', '') }} minutes in the last 24 hours!",
|
||||
"The #Docker Host has been running for {{ states('sensor.since_last_boot_templated') }} (http://www.vmwareinfo.com/2018/02/journey-to-docker.html)",
|
||||
"The #Docker Host for Home Assistant is using {{ states('sensor.disk_use_percent_') }}% 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') }} 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') }} (https://github.com/CCOSTAN/Home-AssistantConfig)",
|
||||
"Home Assistant has been running for {{ states('sensor.ha_uptime') }}. (https://github.com/CCOSTAN/Home-AssistantConfig)"
|
||||
],
|
||||
|
||||
"door": [
|
||||
"The number of Doorbell presses yesterday was {{ states('sensor.doorbell_presses') }}",
|
||||
"{{ states('sensor.doorbell_presses') }} people came to the door today and pressed the bell.",
|
||||
"{{ states('sensor.doorbell_presses') }} doorbell presses occurred in the last 24 hours."
|
||||
],
|
||||
|
||||
"weather": [
|
||||
"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') }} percent. Outside is {{ states('sensor.dark_sky_humidity') }} #Nest (http://amzn.to/2BWNk5N)",
|
||||
"Outside is {{ states('sensor.dark_sky_temperature') }}. I keep the average temperature at {{ states('sensor.downstairs_thermostat_temperature') }}. #Weather (http://amzn.to/2BWNk5N)",
|
||||
"I know that it will be {{ states('sensor.dark_sky_minutely_summary') }} 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') }} and the Moon is {{ states('sensor.moon') }}. #Space",
|
||||
"Average Cloud Coverage: {{ states('sensor.dark_sky_cloud_coverage') }}%, Average Temp: {{ states('sensor.dark_sky_temperature') }}°F #Solar (http://www.vmwareinfo.com/2018/01/going-green-to-save-some-green-in-2018.html)"
|
||||
],
|
||||
|
||||
"internet": [
|
||||
"So far, I have prevented {{ states('sensor.pihole_ads_blocked_today') }} 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') }} DNS requests today! #PiZero",
|
||||
"Average internet stats are Download: {{ states('sensor.speedtest_download') }} Mbit/s & Upload {{ states('sensor.speedtest_upload') }} Mbit/s.",
|
||||
"My @getspectrum internet download speed is about {{ states('sensor.speedtest_download') }} Mbit/s and I am a #cordcutter. @TabloTV",
|
||||
"Yesterday we watched about {{ states.sensor.tv_time.attributes.value|replace('m', '') }} minutes of television. @YouTube & @TabloTV on the @Roku"
|
||||
],
|
||||
|
||||
"stocks": [
|
||||
"I am keeping track of the current #Tesla stock price. It is {{ states('sensor.tesla')|round }} dollars. #Solar",
|
||||
"I am keeping track of the current #Bitcoin prices. It is {{ states('sensor.bitcoin')|round }} dollars. #BTC"
|
||||
],
|
||||
|
||||
"night": [
|
||||
"Todays Sleep Number is {{ states('sensor.sleepnumber_carlo_stacey_sleepnumber') }}. Wifi connected Bed FTW! #SleepStat (http://amzn.to/2D10BcQ)",
|
||||
"Our Sleep Number is {{ states('sensor.sleepnumber_carlo_carlo_sleepnumber') }}. Wifi connected Bed! #SleepStat (http://amzn.to/2D10BcQ)"
|
||||
],
|
||||
|
||||
"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)"
|
||||
]
|
||||
} %}
|
||||
|
||||
{{ tweets[topic]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro solar() -%}
|
||||
{{ [
|
||||
"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() -%}
|
||||
{{ [
|
||||
"Beep. Bop. Beep. Boop. I am a #roBOT run by @CCostan",
|
||||
"The #ChevyBolt has been charging for about {{states.sensor.bolt_charging_time.attributes.value}}inutes in the last 7 days.",
|
||||
"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() -%}
|
||||
{{ [
|
||||
"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() -%}
|
||||
{{ [
|
||||
"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() -%}
|
||||
{{ [
|
||||
"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() -%}
|
||||
{{ [
|
||||
"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() -%}
|
||||
{{ [
|
||||
"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() -%}
|
||||
{{ [
|
||||
"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 -%}
|
||||
|
||||
{%- set tweet_macros = {
|
||||
"minecraft": minecraft,
|
||||
"solar": solar,
|
||||
"robot": robot,
|
||||
"door": door,
|
||||
"weather": weather,
|
||||
"internet": internet,
|
||||
"stocks": stocks,
|
||||
"night": night,
|
||||
"tv": tv,
|
||||
} -%}
|
||||
|
||||
{{ tweet_macros[pick]() }}
|
||||
{{ tweet(pick) }}
|
||||
|
||||
image: >-
|
||||
{%- macro minecraft_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- macro image(topic) -%}
|
||||
{% set images = {
|
||||
"minecraft": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"solar": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"robot": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"door": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"weather": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"internet": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"stocks": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"night": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
],
|
||||
|
||||
"tv": [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]
|
||||
} %}
|
||||
|
||||
{{ images[topic]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro solar_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro robot_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro door_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro weather_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro internet_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro stocks_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro night_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro TV_image() -%}
|
||||
{{ [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png"
|
||||
]|random }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- set image_macros = {
|
||||
"minecraft": minecraft_image,
|
||||
"solar": solar_image,
|
||||
"robot": robot_image,
|
||||
"door": door_image,
|
||||
"weather": weather_image,
|
||||
"internet": internet_image,
|
||||
"stocks": stocks_image,
|
||||
"night": night_image,
|
||||
"tv": tv_image,
|
||||
} -%}
|
||||
|
||||
{{ image_macros[pick]() }}
|
||||
{{ image(pick) }}
|
||||
|
||||
tweet_engine_image:
|
||||
sequence:
|
||||
|
|
Loading…
Reference in New Issue