Forked from michal-stelmach/meteoalarm_mobile.yaml
Last active
January 7, 2022 22:57
-
-
Save slovenec88/403656bb2e1433f51f93801da3e34619 to your computer and use it in GitHub Desktop.
MeteoAlarm notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: MeteoAlarm notification | |
description: | | |
Modified for official HA MeteoAlarm integration | |
Send a notification when there's new weather aleft form MeteoAlarm | |
Available message elements: | |
- {{ alert_name }} = Event, | |
- {{ alert_level }} = Awerness level, | |
- {{ alert_type }} = Awerness type, | |
- {{ alert_issued }} = Effective, | |
- {{ alert_start }} = Onset, | |
- {{ alert_end }} = Expires, | |
- {{ alert_content }} = Descrpition, | |
- {{ alert_instruction }} = Instruction | |
domain: automation | |
input: | |
alert: | |
name: MeteoAlarm sensor | |
description: The sensor which indicates if there's an alert | |
selector: | |
entity: | |
domain: binary_sensor | |
notification_title: | |
name: Notification title | |
description: 'Default: "{{ alert_name }}"' | |
default: "{{ alert_name }}" | |
include_whole_alert: | |
name: Include detailed data from alert | |
description: > | |
Toggle if you'd like to receive whole alert within the notification, default is true; | |
When false only alert level and alert type will be send | |
selector: | |
boolean: | |
default: true | |
custom_message: | |
name: Send alert with custom message | |
description: Toggle if you'd like to customize notification, default is false | |
selector: | |
boolean: | |
default: false | |
notification_message: | |
name: Custom notification message (optional) | |
description: "Create customized message" | |
default: "{{ alert_type }}: {{ alert_start }}-{{ alert_end }}: {{ alert_content }}" | |
trigger: | |
platform: state | |
entity_id: !input alert | |
to: "on" | |
variables: | |
alert: !input alert | |
alert_name: "{{ states[alert].attributes.event }}" | |
alert_issued: "{{ as_datetime(states[alert].attributes.effective).strftime('%d.%m.%Y %H:%M') }}" | |
alert_start: "{{ as_datetime(states[alert].attributes.onset).strftime('%d.%m.%Y %H:%M') }}" | |
alert_end: "{{ as_datetime(states[alert].attributes.expires).strftime('%d.%m.%Y %H:%M') }}" | |
alert_type: "{{ states[alert].attributes.awareness_type.title()|regex_replace(find='[1-9]; ', replace='', ignorecase=True) }}" | |
alert_level: "{{ states[alert].attributes.awareness_level.title()|regex_replace(find='[1-9]; ', replace='', ignorecase=True)|regex_replace(find='; [a-z]*', replace='', ignorecase=True) }}" | |
alert_content: "{{ states[alert].attributes.description }}" | |
alert_instruction: "{{ states[alert].attributes.instruction }}" | |
include_whole_alert: !input include_whole_alert | |
notification_title: !input notification_title | |
custom_message: !input custom_message | |
notification_message: !input notification_message | |
notify_device: !input notify_device | |
action: | |
- device_id: !input notify_device | |
domain: mobile_app | |
type: notify | |
title: "{{ notification_title }}" | |
message: | | |
{% if include_whole_alert %} | |
{% if custom_message %} | |
{{ notification_message }} | |
{% else %} | |
{{ alert_level }} MeteoAlarm: {{ alert_type }} :: | |
From {{ alert_start }} To {{ alert_end }} :: | |
{{ alert_content }} | |
{% endif %} | |
{% else %} | |
MeteoAlarm: {{ alert_level }}: {{ alert_type }} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment