2018-01-02 00:00:45 +00:00
#-------------------------------------------
# This is the configuration account for @BearStoneHA - My Home's automated twitter account.
# @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
#
2018-01-02 00:00:45 +00:00
# hidden: False
#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-03-25 16:35:32 +00:00
# - platform: sql
# db_url: sqlite:///home-assistant_v2.db
# queries:
# - name: "Solar 24h"
# column: 'solar_kwh'
# unit_of_measurement: 'kWh'
# query: >-
# SELECT ROUND(SUM(solar_kwh), 2) AS solar_kwh
# FROM (
# SELECT AVG(state) AS solar_kwh
# FROM states
# WHERE entity_id = 'sensor.solar_now'
# AND state != 'unknown'
# AND last_updated >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 24 HOUR)
# GROUP BY HOUR(last_updated)
# ) AS total_kwh;
2018-03-25 15:58:56 +00:00
2018-01-02 00:00:45 +00:00
- platform : history_stats
name : Doorbell Presses
entity_id : binary_sensor.skybell_stone_door_button
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'
value_template : >
{%- set domains = ['sensor'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
automation_count :
friendly_name : 'Number of Automations'
value_template : >
{%- set domains = ['automation'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
script_count :
friendly_name : 'Number of Scripts'
value_template : >
{%- set domains = ['script'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
binary_sensor_count :
friendly_name : 'Number of Binary Sensors'
value_template : >
{%- set domains = ['binary_sensor'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
2018-03-30 14:52:43 +00:00
tracker_count :
friendly_name : 'Number of Devices'
value_template : >
{%- set domains = ['device_tracker'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
lights_count :
friendly_name : 'Number of Lights'
value_template : >
{%- set domains = ['light'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
2018-04-08 16:03:42 +00:00
protect_count :
friendly_name : 'Number of Smoke Detectors'
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'
value_template : >
{%- set domains = ['camera'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{% if loop.first %}
{{loop.length}}
{% endif %}
{%- endfor -%}
{%- endfor -%}
2018-01-17 16:39:08 +00:00
2018-01-05 02:39:55 +00:00
group :
tweet_stats :
entities :
- sensor.doorbell_presses
- sensor.landscaping_light_time
2018-01-09 01:49:59 +00:00
- sensor.hvac_time
2018-01-22 20:58:08 +00:00
- sensor.speech_time
2018-03-01 20:39:35 +00:00
- sensor.tv_time
- sensor.bolt_charging_time
2018-03-25 13:15:49 +00:00
- sensor.sensor_count
- sensor.script_count
- sensor.binary_sensor_count
2018-03-25 15:58:56 +00:00
- sensor.automation_count
2018-03-30 14:52:43 +00:00
- sensor.lights_count
2018-04-01 18:34:34 +00:00
- sensor.tracker_count
2018-04-08 16:03:42 +00:00
- sensor.protect_count
2018-06-13 01:55:02 +00:00
- sensor.camera_count
2018-01-05 02:39:55 +00:00
2018-01-02 00:00:45 +00:00
#############################################################
automation :
- alias : 'New Twitter follower!'
hide_entity : True
trigger :
- platform : event
event_type : new_follower
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'
hide_entity : True
trigger :
- platform : event
event_type : closed_github
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
2018-05-11 21:09:54 +00:00
- alias : 'ThrowBack message'
trigger :
- platform : time
2018-10-16 16:47:33 +00:00
hours : '/28'
2018-05-15 17:34:08 +00:00
minutes : 13
2018-05-11 21:09:54 +00:00
seconds : 00
2018-06-14 19:33:39 +00:00
2018-05-11 21:09:54 +00:00
action :
- service : notify.ccostan
data_template :
message : >-
{% set phrases = [
2018-05-11 21:21:45 +00:00
"One of the most popular #SmartHome Projects I have done: (https://www.vcloudinfo.com/2017/07/visualizing-smart-home-using-home.html)" ,
"This project was one of the most popular: (https://www.vcloudinfo.com/2017/11/building-digital-cuckoo-clock-with-home.html)" ,
"Some of the Best Home Assistant resources around! (https://www.vcloudinfo.com/2018/04/some-of-my-favorite-home-assistant.html)" ,
"My Journey to Docker #ThrowBack - (https://www.vcloudinfo.com/2018/02/journey-to-docker.html)" ,
"My Popular DIY Motion Sensor #ThrowBack - (https://www.vcloudinfo.com/2017/11/yet-another-inexpensive-motion-sensor.html)" ,
"Build your own DIY Outdoor Smart Home LED strips - (https://www.vcloudinfo.com/2017/08/diy-outdoor-smart-home-led-strips.html)" ,
"Breakdown of the entire smart home - (https://www.vcloudinfo.com/2017/07/my-smart-home-look-at-parts-that-make.html)" ,
2018-05-15 17:34:08 +00:00
"Build your own Home Alarm System - (https://www.vcloudinfo.com/2017/06/building-my-home-alarm-system-hardware.html)" ,
2018-06-19 15:21:32 +00:00
"Adding a Mixer and AMP to this Text to Speech solution changed the Smart Home COMPLETELY! (https://www.vcloudinfo.com/2017/07/giving-voice-to-smart-home.html)" ,
2018-06-14 19:33:39 +00:00
"Some of my favorite #Docker Containers that I am using - (https://www.vcloudinfo.com/2018/06/rolling-out-some-new-docker-containers.html)" ,
2018-05-15 23:19:49 +00:00
"Be Sure to follow all of my Twitter Accounts! @CCostan and my HOUSE bot @BearStoneHA!" ,
2018-08-23 21:55:38 +00:00
"If you are not subscribed to my Smart Home YouTube channel, come join us now! (https://YouTube.com/ccostan)" ,
2018-07-25 00:34:10 +00:00
"My Full Smart Home diagram and #IOT icon set that you can download to build your own! - (https://www.vcloudinfo.com/2018/07/the-bear-stone-home-assistant-icon.html),"
2018-05-15 17:34:08 +00:00
"Be sure to like me on Facebook and join our HA group! (https://www.facebook.com/groups/HomeAssistant/) (https://www.facebook.com/VMwareInfo/) (https://www.facebook.com/BearStoneHA/)" ,
2018-05-15 23:19:49 +00:00
"You can see how ALL of this is done by browsing my GitHub Repository (https://github.com/CCOSTAN/Home-AssistantConfig#logo)" ,
"10 year safety check. If you haven't done it yet, you need to! (https://www.vcloudinfo.com/2017/06/psa-check-out-your-smoke-detectors-once.html)"
2018-05-11 21:09:54 +00:00
] %}
{% set hashtags = [
2018-05-11 21:21:45 +00:00
"#Throwback"
2018-05-11 21:09:54 +00:00
] %}
2018-05-13 23:26:00 +00:00
{{ phrases|random ~ " " ~ hashtags|random ~ " #IOT #SmartHome" }}
2018-05-13 13:54:02 +00:00
data :
2018-05-11 21:09:54 +00:00
media : >-
{% set pictures = [
"/config/www/custom_ui/floorplan/images/branding/throwback.png"
] %}
{{ pictures|random }}
2018-01-02 00:00:45 +00:00
- alias : 'Random House stats'
hide_entity : True
trigger :
- platform : time
2018-03-25 00:06:16 +00:00
hours : '/2'
minutes : 45
2018-01-02 00:00:45 +00:00
seconds : 00
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 = [
2018-04-15 15:13:49 +00:00
"solar" , "solar" , "solar" ,
2018-06-14 19:33:39 +00:00
"robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" , "robot" ,
2018-03-16 19:23:09 +00:00
"door" , "door" , "door" ,
2018-03-30 14:52:43 +00:00
"weather" , "weather" , "weather" , "weather" , "weather" ,
2018-03-29 13:36:18 +00:00
"cloud" ,
2018-05-01 16:12:47 +00:00
"internet" , "internet" , "internet" , "internet" , "internet" , "internet" , "internet" ,
2018-04-23 17:53:37 +00:00
"stocks" , "stocks" , "stocks" , "stocks" ,
2018-03-16 19:23:09 +00:00
"night" , "night" ,
2018-05-13 13:54:02 +00:00
"tv" , "tv" , "tv" ,
2018-05-15 17:35:34 +00:00
"throwback" ,
"promo"
2018-03-16 19:23:09 +00:00
] %}
{{ pick|random }}