2020-05-31 21:09:04 +00:00
#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Notifications for new updates from Home Assistant
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/606
#-------------------------------------------
2018-01-02 00:00:45 +00:00
- alias : "Update Available Notification"
2020-05-31 21:09:04 +00:00
trigger :
- platform : state
entity_id : binary_sensor.updater
to : 'on'
2018-01-02 00:00:45 +00:00
action :
- service : script.notify_engine
data_template :
2020-05-31 21:09:04 +00:00
title : 'Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} '
value1 : "Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} is now available."
2018-01-02 00:00:45 +00:00
who : 'carlo'
2020-06-07 20:23:56 +00:00
apns_id : 'information'
2018-01-02 00:00:45 +00:00
2018-05-30 21:18:59 +00:00
- service : ifttt.trigger
2020-05-31 21:09:04 +00:00
data_template : {"event" : "GitPost" , "value1" : "Home Assistant {{ states.binary_sensor.updater.attributes.newest_version }} is now available." , "value2" : "{{ states.binary_sensor.updater.attributes.newest_version }} " }
2018-05-30 21:18:59 +00:00
2018-03-31 18:36:07 +00:00
- service : script.tweet_engine_image
data_template :
2019-07-16 00:24:51 +00:00
tweet : >-
{% macro getIntro() %}
{{- [
"Woohoo! " ,
"BAM! " ,
2020-06-12 23:58:39 +00:00
"Look at that! " ,
" "
2019-07-16 00:24:51 +00:00
] | random -}}
{% endmacro %}
{% macro getVersion() %}
2020-06-12 23:58:39 +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! "
] | random -}}
2019-07-16 00:24:51 +00:00
{% endmacro %}
{%- macro getRandomSnark() -%}
{{- [
2019-08-27 17:00:34 +00:00
" It is like Patch Tuesday, but without the fail. #homeassistant" ,
2020-06-12 23:58:39 +00:00
" Chop Chop! Get to the upgrading!" ,
2019-08-27 17:00:34 +00:00
" 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-06-12 23:58:39 +00:00
" "
2019-07-16 00:24:51 +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()) -}}
2018-03-31 18:36:07 +00:00
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 }}
2018-01-02 00:00:45 +00:00
- service : persistent_notification.create
data :
title : "Update Available"
2020-05-31 21:09:04 +00:00
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) }}"
2018-01-02 00:00:45 +00:00
notification_id : "update_available"