Closes #606 - Fixed update sensor.

This commit is contained in:
ccostan 2020-05-31 17:09:04 -04:00
parent d1f521d76d
commit 86697aeee7
1 changed files with 19 additions and 13 deletions

View File

@ -1,21 +1,27 @@
- alias: "Update Available Notification" #-------------------------------------------
# @CCOSTAN
trigger: # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
platform: state # Notifications for new updates from Home Assistant
entity_id: updater.updater # https://github.com/CCOSTAN/Home-AssistantConfig/issues/606
#-------------------------------------------
condition: - alias: "Update Available Notification"
- condition: template
value_template: "{{ states('updater.updater') != 'unknown' }}" trigger:
- platform: state
entity_id: binary_sensor.updater
to: 'on'
action: action:
- service: script.notify_engine - service: script.notify_engine
data_template: data_template:
value1: "Home Assistant {{ states.updater.updater.state }} is now available. {{now().strftime('%Y-%m-%d %I:%M %p')}}" 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' who: 'carlo'
apns_id: HAUpdate
- service: ifttt.trigger - service: ifttt.trigger
data_template: {"event":"GitPost", "value1":"Home Assistant {{ states.updater.updater.state }} is now available.", "value2":"{{ states.updater.updater.state }}"} 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 }} "}
- service: script.tweet_engine_image - service: script.tweet_engine_image
data_template: data_template:
@ -28,7 +34,7 @@
] | random -}} ] | random -}}
{% endmacro %} {% endmacro %}
{% macro getVersion() %} {% macro getVersion() %}
"New version of @Home_Assistant! Cannot wait for @CCostan to install {{ states('updater.updater') }}! (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 }}! Cannot wait for @CCostan to install! (https://www.vcloudinfo.com/2017/07/my-smart-home-look-at-parts-that-make.html)"
{% endmacro %} {% endmacro %}
{%- macro getRandomSnark() -%} {%- macro getRandomSnark() -%}
{{- [ {{- [
@ -81,10 +87,10 @@
- service: notify.html5 - service: notify.html5
data_template: data_template:
title: "Update Available" title: "Update Available"
message: "Home Assistant {{ states('updater.updater') }} is available. - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}" 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) }}"
- service: persistent_notification.create - service: persistent_notification.create
data: data:
title: "Update Available" title: "Update Available"
message: "Home Assistant {{ states('updater.updater') }} is available. - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}" 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" notification_id: "update_available"