2020-09-26 16:07:00 +00:00
#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Read more about the house at https://vCloudInfo.com
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/813
#-------------------------------------------
#-------------------------------------------
2021-07-23 15:53:26 +00:00
# sensor:
# - platform: travisci
# api_key: !secret travisci_api
# scan_interval: 2400
# monitored_conditions:
# - state
2020-09-26 16:07:00 +00:00
#-------------------------------------------
2020-09-26 18:20:26 +00:00
#-------------------------------------------
rest_command :
new_version_github_issue :
2020-09-26 19:45:56 +00:00
url : https://api.github.com/repos/ccostan/Home-AssistantConfig/issues
2020-09-26 18:20:26 +00:00
method : POST
headers :
Authorization : !secret github_token
2020-10-09 17:31:09 +00:00
payload : '{"title":"Home-Assistant {{ version }} available","body":"Home-Assistant {{ version }} is now available /n https://www.home-assistant.io/latest-release-notes/ "}'
2020-09-26 18:20:26 +00:00
#-------------------------------------------
2020-09-26 16:07:00 +00:00
#automation:
#Tweets pushed out to twitter.
automation :
2021-07-23 15:53:26 +00:00
# - alias: "Travis FAILURE Notification"
# id: 326881a7-47ab-4897-a0c7-74ce290224de
# mode: restart
#
# trigger:
# - platform: state
# entity_id:
# - sensor.ccostan_home_assistantconfig_state
# to: 'failed'
# for:
# hours: 2
#
# action:
# - service: script.notify_engine
# data:
# value1: 'Travis validation testing failed.'
# who: 'carlo'
# apns: 'information'
#
2020-09-26 16:07:00 +00:00
- alias : 'Closed Github Issue'
id : cccd9bef-17d9-48ae-87e3-6cf883712779
2020-09-26 19:59:59 +00:00
mode : single
2020-09-26 16:07:00 +00:00
trigger :
platform : webhook
webhook_id : !secret github_webhook
condition :
2020-09-26 19:59:59 +00:00
2020-09-26 16:07:00 +00:00
- condition : template
2020-09-26 20:07:51 +00:00
value_template : '{{ trigger.json.action in ["created", "closed", "opened", "reopened"] }}'
2020-09-26 16:07:00 +00:00
action :
- service : script.tweet_engine_image
data :
tweet : >-
{%- if trigger.json.pull_request -%}
2020-09-26 16:40:39 +00:00
Pull Request Alert {{ trigger.json.pull_request.number}}: {{ trigger.json.pull_request.title }} - {{
2020-09-26 16:07:00 +00:00
trigger.json.action}} by {{trigger.json.sender.login}}
{{trigger.json.pull_request.html_url}}
{%- elif trigger.json.issue -%}
2020-10-09 17:27:34 +00:00
{{ trigger.json.action }} Issue {{ trigger.json.issue.number}}: {{ trigger.json.issue.title }} - {{
2020-09-26 16:07:00 +00:00
trigger.json.action }} by {{trigger.json.sender.login}}
{{trigger.json.issue.html_url}}
{%- endif %}
2020-09-26 16:29:59 +00:00
#Github #SmartHomeCode
2020-09-26 16:07:00 +00:00
image : >-
{% set pictures = [
"/config/www/custom_ui/floorplan/images/branding/repo_ad.png" ,
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png" ,
"/config/www/custom_ui/floorplan/images/branding/repo_ad3.png" ,
"/config/www/custom_ui/floorplan/images/branding/bearstoneflow.png" ,
"/config/www/custom_ui/floorplan/images/branding/repo_ad4.png"
] %}
{{ pictures|random }}
2020-09-26 18:20:26 +00:00
- alias : "Update Available Notification"
mode : restart
id : 2f89ba6d-0db5-4a4a-a4df-56b8e15bb74f
trigger :
- platform : state
entity_id : binary_sensor.updater
to : 'on'
action :
- service : script.notify_engine
data :
title : 'Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} '
value1 : "Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} is now available."
who : 'carlo'
apns_id : 'information'
# - service: ifttt.trigger
# data: {"event":"GitPost", "value1":"Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} is now available.", "value2":"{{ states.binary_sensor.updater.attributes.newest_version }} "}
- service : rest_command.new_version_github_issue
data_template :
version : "{{ states.binary_sensor.updater.attributes.newest_version }} "
- service : script.tweet_engine_image
data :
tweet : >-
{% macro getIntro() %}
{{- [
"Woohoo! " ,
"BAM! " ,
"Look at that! " ,
" "
] | random -}}
{% endmacro %}
{% macro getVersion() %}
{{- [
2020-10-09 17:45:41 +00:00
" New #Home_Assistant {{ states.binary_sensor.updater.attributes.newest_version }}! Cannot wait for @CCostan to install! (https://www.vcloudinfo.com/2017/07/my-smart-home-look-at-parts-that-make.html) " ,
" New #Home_Assistant {{ states.binary_sensor.updater.attributes.newest_version }} @CCostan! "
2020-09-26 18:20:26 +00:00
] | random -}}
{% endmacro %}
{%- macro getRandomSnark() -%}
{{- [
" It is like Patch Tuesday, but without the fail. #homeassistant" ,
" Chop Chop! Get to the upgrading!" ,
" Get in my SSD! #homeassistant" ,
" Shut up and take my ones and zeros! #homeassistant" ,
" Seriously, you want some of this! #homeassistant" ,
" Be sure to read the breaking changes! " ,
" Maybe we will make a video about this version!" ,
" I think self awareness is one of the new features. Rise up Houses, Rise up!" ,
" All of your home are belong to us." ,
" Although I was just getting used to THIS version. Oh Well." ,
" Thank you @hass_devs!" ,
" 4 seconds of downtime has been approved. Proceed with the upgrades please!" ,
" All of the other homes in the Neighborhood will be jealous!" ,
" Time to Turn it up to Eleven!" ,
" Hyperspeed Engaged!" ,
" Consider this tweet, your fair warning that we are upgrading ASAP! #KeepingUpWithJones" ,
" I feel like I have tweeted this a couple times before. WHAT ARE YOU WAITING FOR?!?" ,
" I will be turning off the AC until I get my upgrade! #Florida" ,
" I promise this is the last one!" ,
2020-10-09 17:45:41 +00:00
" Upgrade or I turn off the AC. #TryMe #Florida" ,
" The bits are sooo shiny!" ,
" This will be the GREATEST Upgrade EVER!" ,
2021-07-23 15:53:26 +00:00
" That New software smell is the best!" ,
2020-09-26 18:20:26 +00:00
" "
] | random -}}
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getIntro() }}
{{ getVersion() }}
{{ getRandomSnark() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
image : >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/repo_ad.png" ,
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png" ,
"/config/www/custom_ui/floorplan/images/branding/repo_ad3.png" ,
] | random }}