-
-
Notifications
You must be signed in to change notification settings - Fork 503
/
Copy pathgithub.yaml
executable file
·180 lines (158 loc) · 7 KB
/
github.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#-------------------------------------------
# @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
#-------------------------------------------
#-------------------------------------------
sensor:
- platform: travisci
api_key: !secret travisci_api
scan_interval: 2400
monitored_conditions:
- state
#-------------------------------------------
#-------------------------------------------
rest_command:
new_version_github_issue:
url: https://api.github.com/repos/ccostan/Home-AssistantConfig/issues
method: POST
headers:
Authorization: !secret github_token
payload: '{"title":"Home-Assistant {{ version }} available","body":"Home-Assistant {{ version }} is now available"}'
#-------------------------------------------
#automation:
#Tweets pushed out to twitter.
automation:
- 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'
- service: persistent_notification.create
data:
title: "Travis-CI FAILURE"
message: "Travis validation testing failed."
notification_id: "travis_failed"
- alias: 'Closed Github Issue'
id: cccd9bef-17d9-48ae-87e3-6cf883712779
mode: single
trigger:
platform: webhook
webhook_id: !secret github_webhook
condition:
- condition: template
value_template: '{{ trigger.json.action in ["created", "closed", "opened", "reopened"] }}'
action:
- service: script.tweet_engine_image
data:
tweet: >-
{%- if trigger.json.pull_request -%}
Pull Request Alert {{ trigger.json.pull_request.number}}: {{ trigger.json.pull_request.title }} - {{
trigger.json.action}} by {{trigger.json.sender.login}}
{{trigger.json.pull_request.html_url}}
{%- elif trigger.json.issue -%}
Issue Alert {{ trigger.json.issue.number}}: {{ trigger.json.issue.title }} - {{
trigger.json.action }} by {{trigger.json.sender.login}}
{{trigger.json.issue.html_url}}
{%- endif %}
#Github #SmartHomeCode
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 }}
- 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() %}
{{- [
" 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! "
] | 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!",
" "
] | 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 }}