Last active
March 30, 2022 04:15
-
-
Save mougeat/d36a7417c89991df99d5c18aaee53351 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: Notification pour alerte météo | |
description: Envoie une notification si une alerte météo est levée par Météo-France | |
domain: automation | |
input: | |
sensor_weather_alert: | |
name: Weather Alert | |
description: L'entité décrivant les alertes météo | |
selector: | |
entity: | |
integration: meteo_france | |
domain: sensor | |
notifier: | |
name: Notification | |
description: Nom du service de notification à utiliser | |
source_url: https://gist.github.com/mougeat/d36a7417c89991df99d5c18aaee53351 | |
trigger: | |
- platform: state | |
entity_id: !input 'sensor_weather_alert' | |
variables: | |
weather_alert_sensor: !input 'sensor_weather_alert' | |
action: | |
- choose: | |
- conditions: | |
- condition: state | |
entity_id: !input 'sensor_weather_alert' | |
state: | |
- Jaune | |
- Orange | |
- Rouge | |
sequence: | |
- service: !input 'notifier' | |
data: | |
message: "Alerte météo {{states(weather_alert_sensor)}} en cours:\n {%- for\ | |
\ attr in ['Vent violent', 'Pluie-inondation', 'Orages', 'Inondation', 'Neige-verglas',\ | |
\ 'Canicule', 'Grand-froid', 'Avalanches', 'Vagues-submersion'] -%} {%-\ | |
\ if state_attr(weather_alert_sensor, attr) != 'Vert' and state_attr(weather_alert_sensor,\ | |
\ attr) != None %}\n - {{attr}} : {{state_attr(weather_alert_sensor, attr)}}\ | |
\ {%- endif -%} {% endfor -%}" | |
- conditions: | |
- condition: state | |
entity_id: !input 'sensor_weather_alert' | |
state: Vert | |
- '{{ trigger.from_state.state != ''unavailable'' }}' | |
sequence: | |
- service: !input 'notifier' | |
data: | |
message: Fin de l'alerte météo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment