Updating #773 with new localized HA Update Github Issue generation

This commit is contained in:
ccostan 2020-09-26 14:20:26 -04:00
parent 5b08122cd9
commit fbfa7dd3e7
4 changed files with 101 additions and 97 deletions

View File

@ -1,97 +0,0 @@
#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Notifications for new updates from Home Assistant
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/606
#-------------------------------------------
- alias: "Update Available Notification"
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: 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 }}
- service: persistent_notification.create
data:
title: "Update Available"
message: "Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} is available. - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}"
notification_id: "update_available"

View File

@ -14,6 +14,16 @@ sensor:
- state
#-------------------------------------------
#-------------------------------------------
rest_command:
new_version_github_issue:
url: https://api.github.com/repos/ccostan/home-assistant-config/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.
@ -84,3 +94,93 @@ automation:
"/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 }}

View File

@ -40,6 +40,7 @@ garadget_username: user@email.com
garadget_password: password
garadget_access_token: ThisIsAVERYSECUREANDUNiqueAccessToken
github_webhook: https://www.home-assistant.io/docs/automation/trigger/#webhook-trigger
github_token: sampledata
google_cal_clientid: clientidsecretsecretsecret.apps.googleusercontent.com
google_cal_clientsecret: more-secretstuff
sleepiq_username: user@email.com

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 34 KiB