Updated with some new Tweet Logic and easier names - #720 - YouTube Sensors as well.

This commit is contained in:
ccostan 2020-06-27 13:24:25 -04:00
parent 199b79d6ec
commit 691ee15e9d
10 changed files with 73 additions and 57 deletions

View File

@ -49,7 +49,7 @@
- service: script.emergency - service: script.emergency
- service: script.tweet_engine - service: script.tweet_engine_no_image
data_template: data_template:
tweet: > tweet: >
{% set windspeed = states.sensor.dark_sky_wind_speed.state | round %} {% set windspeed = states.sensor.dark_sky_wind_speed.state | round %}

View File

@ -15,7 +15,7 @@
data_template: data_template:
NewDevice: "There has been a new device detected on the network. Be sure to appropriately catagorize {{trigger.event.data.host_name}} within Circle." NewDevice: "There has been a new device detected on the network. Be sure to appropriately catagorize {{trigger.event.data.host_name}} within Circle."
- service: script.tweet_engine - service: script.tweet_engine_no_image
data_template: data_template:
tweet: > tweet: >
{{ [ {{ [

View File

@ -28,7 +28,7 @@
- service: ifttt.trigger - service: ifttt.trigger
data_template: {"event":"GitPost", "value1":"Wink Update is available. - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}", "value2":"{{ states.binary_sensor.carlowink.attributes }}"} data_template: {"event":"GitPost", "value1":"Wink Update is available. - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}", "value2":"{{ states.binary_sensor.carlowink.attributes }}"}
- service: script.tweet_engine - service: script.tweet_engine_no_image
data_template: data_template:
tweet: > tweet: >
{{ [ {{ [

View File

@ -20,7 +20,7 @@
who: 'carlo' who: 'carlo'
apns_id: 'ip-change' apns_id: 'ip-change'
- service: script.tweet_engine - service: script.tweet_engine_no_image
data_template: data_template:
tweet: > tweet: >
{{ [ {{ [

View File

@ -35,7 +35,7 @@ automation:
value1: "{{ trigger.to_state.attributes.friendly_name }} is at {{ trigger.to_state.state }} " value1: "{{ trigger.to_state.attributes.friendly_name }} is at {{ trigger.to_state.state }} "
who: 'carlo' who: 'carlo'
apns_id: 'information' apns_id: 'information'
- service: script.tweet_engine - service: script.tweet_engine_no_image
data: data:
tweet: 'Looks like my {{ trigger.to_state.attributes.friendly_name }} is LOW. @CCostan - Get me some more (https://amzn.to/2AnpFwD)' tweet: 'Looks like my {{ trigger.to_state.attributes.friendly_name }} is LOW. @CCostan - Get me some more (https://amzn.to/2AnpFwD)'

View File

@ -45,7 +45,7 @@ automation:
data_template: data_template:
value1: "An emergency has been detected on {{ trigger.to_state.attributes.friendly_name }} Please investigate IMMEDIATELY." value1: "An emergency has been detected on {{ trigger.to_state.attributes.friendly_name }} Please investigate IMMEDIATELY."
- service: script.tweet_engine - service: script.tweet_engine_no_image
data_template: data_template:
tweet: "An emergency has been detected on {{ trigger.to_state.attributes.friendly_name }} @CCostan (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html)" tweet: "An emergency has been detected on {{ trigger.to_state.attributes.friendly_name }} @CCostan (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html)"
@ -79,6 +79,6 @@ automation:
who: "parents" who: "parents"
apns_id: 'Nest-Protect' apns_id: 'Nest-Protect'
- service: script.tweet_engine - service: script.tweet_engine_no_image
data: data:
tweet: "Oh NO! {{ trigger.to_state.attributes.friendly_name }} is now in {{ (trigger.to_state.state)|replace('_', ' ') }} mode. @Nest. (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html) #Safety" tweet: "Oh NO! {{ trigger.to_state.attributes.friendly_name }} is now in {{ (trigger.to_state.state)|replace('_', ' ') }} mode. @Nest. (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html) #Safety"

View File

@ -56,7 +56,7 @@ automation:
value1: 'Go Outside! There is a Rocket Launch very soon!' value1: 'Go Outside! There is a Rocket Launch very soon!'
apns_id: 'information' apns_id: 'information'
- service: script.tweet_engine - service: script.tweet_engine_no_image
data_template: data_template:
tweet: 'There is a Rocket launch happening right now! I can see it if I look closely. @BrianCribbs #SpaceX #Space' tweet: 'There is a Rocket launch happening right now! I can see it if I look closely. @BrianCribbs #SpaceX #Space'

View File

@ -251,7 +251,7 @@ automation:
{%- endif -%} {%- endif -%}
action: action:
- delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}' - delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}'
- service: script.tweet_engine_setup - service: script.tweet_engine_random
data_template: data_template:
pick: >- pick: >-
{% set pick = [ {% set pick = [

View File

@ -23,10 +23,20 @@ automation:
entity_id: sensor.vcloudinfo entity_id: sensor.vcloudinfo
action: action:
- service: script.tweet_engine_image - service: script.tweet_engine_no_image
data_template: data_template:
tweet: > tweet: >
{{ [ {{ [
"New Video! {{ states('sensor.vcloudinfo_info') }} - {{ state_attr('sensor.vcloudinfo','url') }} " "New Video! {{ states('sensor.vcloudinfo_info') }} - {{ state_attr('sensor.vcloudinfo','url') }} "
] | random }} ] | random }}
image: "{{state_attr('sensor.vcloudinfo','entity_picture')}}" who: 'ccostan'
- delay: '00:10:00'
- service: script.tweet_engine_no_image
data_template:
tweet: >
{{ [
"New Video! {{ states('sensor.vcloudinfo_info') }} - {{ state_attr('sensor.vcloudinfo','url') }} "
] | random }}
who: 'BearStoneHA'

View File

@ -1,12 +1,56 @@
###################################################################################################### #-------------------------------------------
## Script to send notifications to Twitter as @BearStoneHA. # Visit The Main Blog for More Home Assistant Goodness - https://www.vCloudInfo.com
## Publish on Facebook as well - https://www.facebook.com/vcloudinfo/ # Follow me on the socials - @CCOSTAN
## If you do end up using this package, please consider using one or two of the canned tweets that calls back to my main repo # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
## so others can bring thier homes online as well. I have an active search for #Randomstats that helps me find new HA homes using my package online. # Script to send notifications to Twitter as @BearStoneHA.
## Enhancements by @dale3h # Publish on Facebook as well - https://www.facebook.com/vcloudinfo/
###################################################################################################### # If you do end up using this package, please consider using one or two of the canned tweets that calls back to my main repo
# so others can bring thier homes online as well. I have an active search for #Randomstats that helps me find new HA homes using my package online.
#-------------------------------------------
tweet_engine_setup: tweet_engine_image:
sequence:
- service: mqtt.publish
data_template:
topic: 'ifttt/message'
payload: >-
{{ tweet }}
retain: true
- service_template: >
{% if who == 'ccostan' %}
notify.ccostan
{% else %}
notify.bearstoneha
{% endif %}
data_template:
message: >-
{{ tweet }} #IOT #SmartHome
data:
media: >-
{{ image }}
tweet_engine_no_image:
sequence:
- service: mqtt.publish
data_template:
topic: 'ifttt/message'
payload: >-
{{ tweet }}
retain: true
- service_template: >
{% if who == 'ccostan' %}
notify.ccostan
{% else %}
notify.bearstoneha
{% endif %}
data_template:
message: >-
{{ tweet }} #IOT #SmartHome
tweet_engine_random:
sequence: sequence:
- service: script.tweet_engine_image - service: script.tweet_engine_image
data_template: data_template:
@ -239,44 +283,6 @@ tweet_engine_setup:
{{ image(pick) }} {{ image(pick) }}
{%- endif -%} {%- endif -%}
tweet_engine_image:
sequence:
- service: mqtt.publish
data_template:
topic: 'ifttt/message'
payload: >-
{{ tweet }}
retain: true
- service_template: >
{% if who == 'ccostan' %}
notify.ccostan
{% else %}
notify.bearstoneha
{% endif %}
data_template:
message: >-
{{ tweet }} #IOT #SmartHome
data:
media: >-
{{ image }}
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 # - service: ifttt.trigger
# data_template: {"event":"facebook_tweet", "value1":"{{ tweet }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"} # data_template: {"event":"facebook_tweet", "value1":"{{ tweet }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"}