2018-01-02 00:00:45 +00:00
#-------------------------------------------
2019-07-17 00:10:43 +00:00
# This is the configuration account for @BearStoneHA - My Homes automated twitter account.
2018-01-02 00:00:45 +00:00
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
#-------------------------------------------
# homeassistant:
# customize_glob:
# "input_select.log_*":
# icon: mdi:bug
2018-01-07 01:09:59 +00:00
#
2020-06-07 17:29:02 +00:00
#
2018-01-02 00:00:45 +00:00
#Random number - https://www.random.org/integers/?num=1&min=1&max=10&col=1&base=10&format=plain&rnd=new
notify :
- name : BearStoneHA
platform : twitter
consumer_key : !secret twitter_consumer_key
consumer_secret : !secret twitter_consumer_secret
access_token : !secret twitter_access_token
access_token_secret : !secret twitter_access_token_secret
2018-05-11 21:09:54 +00:00
- name : ccostan
2018-05-11 20:39:54 +00:00
platform : twitter
consumer_key : !secret twitter_consumer_key2
consumer_secret : !secret twitter_consumer_secret2
access_token : !secret twitter_access_token2
access_token_secret : !secret twitter_access_token_secret2
2018-05-11 21:09:54 +00:00
2018-01-02 00:00:45 +00:00
### Building out some Historical stats for tweeting. #####################
sensor :
2018-11-26 18:47:27 +00:00
- platform : command_line
command : 'curl https://api.github.com/repos/ccostan/home-assistantconfig'
name : GitHub Stats
scan_interval : 20000
value_template : '{{ value_json.name }}'
json_attributes :
- open_issues
# - subscribers_count
# - forks
- stargazers_count
2018-01-02 00:00:45 +00:00
2020-05-23 19:10:13 +00:00
- platform : command_line
name : Lines of Code
command : "find /config -name '*.yaml' | xargs cat | wc -l"
scan_interval : 20000
2018-03-25 15:58:56 +00:00
2018-01-02 00:00:45 +00:00
- platform : history_stats
name : Doorbell Presses
2019-08-14 00:01:55 +00:00
entity_id : binary_sensor.skybell_front_door_button
2018-01-02 00:00:45 +00:00
state : 'on'
type : count
end : '{{ now() }}'
duration :
hours : 24
2018-01-22 19:58:22 +00:00
- platform : history_stats
name : Speech time
entity_id : media_player.livingroomCC
state : 'playing'
type : time
end : '{{ now() }}'
duration :
hours : 24
2018-01-07 01:09:59 +00:00
2018-03-01 20:39:35 +00:00
- platform : history_stats
name : TV time
entity_id : media_player.living_room_ultra
state : 'playing'
type : time
end : '{{ now() }}'
duration :
hours : 24
2018-01-02 00:00:45 +00:00
- platform : history_stats
name : Landscaping Light time
entity_id : group.landscaping
state : 'on'
type : time
end : '{{ now() }}'
duration :
hours : 24
2018-03-01 20:39:35 +00:00
- platform : history_stats
name : Bolt Charging time
entity_id : sensor.carlojuice_charging_status
state : 'charging'
type : time
end : '{{ now() }}'
duration :
days : 7
2018-03-25 00:06:16 +00:00
### Building some interesting stats for tweeting. ###
- platform : template
sensors :
sensor_count :
friendly_name : 'Number of Sensors'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2019-09-30 16:57:55 +00:00
value_template : >-
{{ states.sensor | list | count }}
2018-03-25 00:06:16 +00:00
automation_count :
friendly_name : 'Number of Automations'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2019-09-30 16:57:55 +00:00
value_template : >-
{{ states.automation| list | count }}
2018-03-25 00:06:16 +00:00
script_count :
friendly_name : 'Number of Scripts'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2018-03-25 00:06:16 +00:00
value_template : >
2019-09-30 16:57:55 +00:00
{{ states.script | list | count }}
2018-03-25 00:06:16 +00:00
binary_sensor_count :
friendly_name : 'Number of Binary Sensors'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2019-09-30 16:57:55 +00:00
value_template : >-
{{ states.binary_sensor | list | count }}
2018-03-30 14:52:43 +00:00
tracker_count :
friendly_name : 'Number of Devices'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2019-09-30 16:57:55 +00:00
value_template : >-
{{ states.device_tracker| list | count }}
2018-03-30 14:52:43 +00:00
lights_count :
friendly_name : 'Number of Lights'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2018-03-30 14:52:43 +00:00
value_template : >
2019-09-30 16:57:55 +00:00
{{ states.light | list | count }}
2018-04-08 16:03:42 +00:00
protect_count :
friendly_name : 'Number of Smoke Detectors'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2018-04-08 16:03:42 +00:00
value_template : >
{% if states('group.protects') == 'on' %}
{% for e in states.group.protects.attributes.entity_id if states(e) == 'on' %}
{% if loop.last %}
{{ loop.index }}
{% endif %}
{%- endfor -%}
{% else %}
0
{% endif %}
2018-06-13 01:55:02 +00:00
camera_count :
friendly_name : 'Number of online Cameras'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2018-06-13 01:55:02 +00:00
value_template : >
2019-09-30 16:57:55 +00:00
{{ states.camera | list | count }}
2018-06-13 01:55:02 +00:00
2018-01-02 00:00:45 +00:00
#############################################################
automation :
- alias : 'New Twitter follower!'
trigger :
2020-02-14 07:24:03 +00:00
platform : event
event_type : ifttt_webhook_received
event_data :
action : new_follower
2020-02-15 21:22:42 +00:00
2018-01-02 00:00:45 +00:00
condition :
- condition : state
entity_id : group.bed
state : 'off'
action :
- service : media_player.play_media
data_template :
entity_id :
- media_player.livingroomCC
- media_player.bedroom_alarm_panel
2018-03-01 01:00:44 +00:00
media_content_id : "https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/sounds/twitter-chirp.mp3"
2018-01-02 00:00:45 +00:00
media_content_type : audio/mp4
- alias : 'Closed Github Issue'
trigger :
2020-02-14 07:24:03 +00:00
platform : event
2020-02-15 21:22:42 +00:00
#Sent from IFTTT Webhooks : {"action":"closed_github", "repo":" {{RepositoryName}}", "issue":" {{IssueTitle}}","issueurl":" {{IssueURL}}"}
2020-02-14 07:24:03 +00:00
event_type : ifttt_webhook_received
event_data :
action : closed_github
2018-01-02 00:00:45 +00:00
action :
2018-03-13 22:07:46 +00:00
- service : script.tweet_engine_image
2018-01-02 00:00:45 +00:00
data_template :
tweet : >-
{% set repo = trigger.event.data.repo %}
{% set issue = trigger.event.data.issue %}
{% set issueurl = trigger.event.data.issueurl %}
{% set phrases = [
2018-03-13 20:40:46 +00:00
"New Code: " ~ issue ~ " " ~ issueurl
2018-01-02 00:00:45 +00:00
] %}
{% set hashtags = [
"#Github" ,
"#SmartHomeCode"
] %}
{{ phrases|random ~ " " ~ hashtags|random }}
2018-03-13 20:53:10 +00:00
image : >-
{% set pictures = [
2018-03-13 20:58:01 +00:00
"/config/www/custom_ui/floorplan/images/branding/repo_ad.png" ,
2018-03-16 17:27:11 +00:00
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png" ,
2018-03-31 18:36:07 +00:00
"/config/www/custom_ui/floorplan/images/branding/repo_ad3.png" ,
2018-07-25 00:34:10 +00:00
"/config/www/custom_ui/floorplan/images/branding/bearstoneflow.png" ,
2018-03-31 18:36:07 +00:00
"/config/www/custom_ui/floorplan/images/branding/repo_ad4.png"
2018-03-13 20:53:10 +00:00
] %}
{{ pictures|random }}
2018-01-02 00:00:45 +00:00
- alias : 'Random House stats'
trigger :
2019-02-23 23:03:43 +00:00
- platform : time_pattern
2018-03-25 00:06:16 +00:00
hours : '/2'
minutes : 45
2018-01-05 19:45:57 +00:00
condition :
- condition : template
value_template : >
{%- if states.automation.random_house_stats.attributes.last_triggered -%}
{{ (as_timestamp(now()) - as_timestamp(states.automation.random_house_stats.attributes.last_triggered)) > 10000 }}
{%- else -%}
true
{%- endif -%}
2018-01-02 00:00:45 +00:00
action :
2018-06-14 19:33:39 +00:00
- 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 }}'
2018-03-16 19:23:09 +00:00
- service : script.tweet_engine_setup
2018-01-02 00:00:45 +00:00
data_template :
2018-03-16 19:23:09 +00:00
pick : >-
{% set pick = [
2019-08-24 18:10:14 +00:00
"solar" ,
"robot" ,
"door" ,
"weather" ,
2018-03-29 13:36:18 +00:00
"cloud" ,
2019-08-24 18:10:14 +00:00
"speedtest" ,
"internet" ,
"stocks" ,
2019-07-23 16:28:29 +00:00
"night" ,
2019-08-24 18:10:14 +00:00
"tv" ,
"promo" ,
2019-07-16 19:40:16 +00:00
"joke"
2018-03-16 19:23:09 +00:00
] %}
{{ pick|random }}
2019-08-02 18:00:49 +00:00
2019-08-02 23:51:35 +00:00
- alias : 'Random YouTube Videos BearStone'
2019-08-02 18:00:49 +00:00
trigger :
- platform : time_pattern
2019-11-24 16:52:54 +00:00
hours : '/7'
2019-08-02 23:51:35 +00:00
minutes : 18
2019-08-02 18:00:49 +00:00
condition :
- condition : template
value_template : >
2019-08-02 23:51:35 +00:00
{%- if states.automation.random_youtube_videos_bearstone.attributes.last_triggered -%}
{{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_bearstone.attributes.last_triggered)) > 10000 }}
2019-08-02 18:00:49 +00:00
{%- else -%}
true
{%- endif -%}
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 }}'
- service : script.tweet_youtube_engine_setup
data_template :
pick : >-
{% set pick = [
2019-08-02 23:51:35 +00:00
"ThrowBack" , "S01E01" , "S01E02" , "S01E03" , "S01E04" , "S01E05" , "S01E06" , "S01E07" , "S01E08" , "S01E09" , "S01E10" ,
"S01E11" , "S01E12" , "S01E13" , "S01E14" , "S01E15" , "S01E16" , "S01E17" , "S01E18" , "S01E19" , "S01E20" , "S01E21" ,
"S02E01" , "S02E02" , "S02E03" , "S02E04" , "S02E05" , "S02E06" , "S02E07" , "S02E08" , "S02E09" , "S02E10" ,
"S02E11" , "S02E12" , "S02E13" , "S02E14" , "S02E15" , "S02E16" , "S02E17" , "S02E18" , "S02E19" , "S02E20" ,
2019-09-22 15:18:23 +00:00
"S02E22" , "S02E25" , "S02E26" , "S02E27" , "S02E28" , "S02E29" , "S02E30" , "S02E31" , "S02E32" , "S02E33" , "S02E34" ,
2020-02-16 21:45:40 +00:00
"S02E35" , "S02E36" , "S02E37" , "S02E38" , "S02E39" , "S02E40" , "S02E41" , "Bearnews1" , "Bearnews2" , "Bearnews3" , "Bearnews4" ,
2020-05-31 19:10:58 +00:00
"S03E01" , "Bearnews5" , "Bearnews6" , "Bearnews7" , "S03E02" , "S03E03"
2019-08-02 23:51:35 +00:00
] %}
{{ pick|random }}
- alias : 'Random YouTube Videos CCostan'
2020-02-06 19:32:18 +00:00
2019-08-02 23:51:35 +00:00
trigger :
- platform : time_pattern
hours : '/22'
minutes : 45
condition :
- condition : template
value_template : >
{%- if states.automation.random_youtube_videos_ccostan.attributes.last_triggered -%}
{{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_ccostan.attributes.last_triggered)) > 10000 }}
{%- else -%}
true
{%- endif -%}
action :
- service : script.tweet_youtube_engine_setup
data_template :
who : 'ccostan'
pick : >-
{% set pick = [
"ThrowBack" , "S01E01" , "S01E02" , "S01E03" , "S01E04" , "S01E05" , "S01E06" , "S01E07" , "S01E08" , "S01E09" , "S01E10" ,
2019-08-02 21:31:58 +00:00
"S01E11" , "S01E12" , "S01E13" , "S01E14" , "S01E15" , "S01E16" , "S01E17" , "S01E18" , "S01E19" , "S01E20" , "S01E21" ,
2019-08-02 22:22:46 +00:00
"S02E01" , "S02E02" , "S02E03" , "S02E04" , "S02E05" , "S02E06" , "S02E07" , "S02E08" , "S02E09" , "S02E10" ,
"S02E11" , "S02E12" , "S02E13" , "S02E14" , "S02E15" , "S02E16" , "S02E17" , "S02E18" , "S02E19" , "S02E20" ,
2019-09-22 15:18:23 +00:00
"S02E22" , "S02E25" , "S02E26" , "S02E27" , "S02E28" , "S02E29" , "S02E30" , "S02E31" , "S02E32" , "S02E33" , "S02E34" ,
2020-02-16 21:45:40 +00:00
"S02E35" , "S02E36" , "S02E37" , "S02E38" , "S02E39" , "S02E40" , "S02E41" , "Bearnews1" , "Bearnews2" , "Bearnews3" , "Bearnews4" ,
2020-05-31 19:10:58 +00:00
"S03E01" , "Bearnews5" , "Bearnews6" , "Bearnews7" , "S03E02" , "S03E03"
2019-08-02 18:00:49 +00:00
] %}
{{ pick|random }}