ITALY METEO-HYDRO ALERT - To get more detailed information about parameters of warnings visit Civil Protection Department. Dipartimento Protezione Civile
The state of the sensor will be the highest alert level.
The Vigilance sensor will also report in attributes the values of all other meteo alerts and/or forecasts from next 12-48 hours, if there are any.
The Criticality sensor (DPC Alert) will also report in attributes the values of all other warning and/or forecasts from next 12-24 hours, if there are any.
Using Home Assistant Community Store (recommended)
- Click on HACS in the Home Assistant menu
- Click on
Integrations
- Click the
EXPLORE & ADD REPOSITORIES
button - Search for
Dpc
- Click the
INSTALL THIS REPOSITORY IN HACS
button - Restart Home Assistant
To configure this integration go to: Configurations
-> Integrations
-> ADD INTEGRATIONS
button, search for Dpc
and configure the component.
You can also use following My Home Assistant link
Now the integration is added to HACS and available in the normal HA integration installation
-
In the HomeAssistant left menu, click
Configuration
-
Click
Integrations
-
Click
ADD INTEGRATION
-
Type
Dpc
and select it -
Enter the details:
- Name: Your location name or name of sensor
- Latitude: Latitude of monitored point
- Longitude: Longitude of monitored point
-
Optional:
- Binary sensor enable/disable
- Sensor enabled/disable
- Municipality
- Update interval (minutes, default 30)
- Minimum level of warning. (int, default 2)
N.B Some municipalities border on multiple alert areas. With the option (3) "municipality" the search is done by name of the municipality, and the area with the highest alert will be considered.
⚠️ Multiple instance are possible, but... for the moment the updates are independent, it is advisable not to exceed more than two / three locations.
Preview From my Natural Events project.
Cards: card-mod, auto-entities
Cards: card-mod, auto-entities, config-template-card
attribution: Data provided by Civil Protection Department
integration: dpc
id: "20210805_1513"
publication_date: "2021-08-05T15:13:00"
last_update: "2021-08-05T19:48:05.000855"
max_level: 3
total_alerts: 2
today:
info: Moderata per rischio temporali
alert: ALLERTA ARANCIONE
level: 3
image_url: >-
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica/master/files/preview/20210805_1513_oggi.png
expires: "2021-08-05T00:00:00"
events_today:
- risk: Temporali
info: Moderata
alert: ALLERTA ARANCIONE
level: 3
icon: mdi:weather-lightning
- risk: Idrogeologico
info: Moderata
alert: ALLERTA ARANCIONE
level: 3
icon: mdi:waves
tomorrow:
info: Assenza di fenomeni significativi prevedibili
alert: NESSUNA ALLERTA
level: 1
image_url: >-
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica/master/files/preview/20210805_1513_domani.png
expires: "2021-08-06T00:00:00"
zone_name: Lario e Prealpi occidentali
friendly_name: DPC Alert
icon: mdi:hazard-lights
attribution: Data provided by Civil Protection Department
integration: dpc
tomorrow:
phenomena: []
icon: mdi:numeric-1-circle
image_url: >-
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Vigilanza-Meteorologica/master/files/preview/20220201_domani.png
level: 1
precipitation: Assenti o non rilevanti
aftertomorrow:
phenomena: []
icon: mdi:numeric-1-circle
image_url: null
level: 1
precipitation: Assenti o non rilevanti
today:
phenomena:
- id: 202202011
date: 2022-01-31Z
id_event: 11
event: Venti
value: burrasca
latitude: 43.15908136602766
longitude: 12.860448349161915
distance: 46
direction: WSW
degrees: 256
icon: mdi:weather-windy
icon: mdi:numeric-2-circle
image_url: >-
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Vigilanza-Meteorologica/master/files/preview/20220201_oggi.png
level: 2
precipitation: Deboli
id: '20220201'
publication_date: '2022-02-01T00:00:00'
zone_name: Coste marchigiana meridionale e abruzzese centro-settentrionale
last_update: '2022-02-01T17:27:04.002291'
max_level: 2
total_phenomena: 1
total_alerts: 1
icon: mdi:hazard-lights
friendly_name: DPC Vigilance
attribution: Data provided by Civil Protection Department
integration: dpc
id: '20220322_1401'
publication_date: '2022-03-22T14:01:00'
expires: '2022-03-23T00:00:00'
last_update: '2022-03-22T20:30:16.170457'
risk: Idrogeologico
info: Assenza di fenomeni significativi prevedibili
alert: NESSUNA ALLERTA
level: 1
zone_name: Bacini di Roma
image_url: >-
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica/master/files/preview/20220322_1401_domani.png
link: https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita/
device_class: safety
icon: mdi:waves
friendly_name: Rischio Idrogeologico Domani
type: markdown
content: |-
___
{% set entity = 'sensor.dpc_alert' %}
#### PROTEZIONE CIVILE - [CRITICITA](https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita)
##### ZONA {{state_attr(entity, 'zone_name')}}
{% set color = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red'} %}
{% set days_map = {'today':'Oggi.', 'tomorrow':'Domani.', 'aftertomorrow': 'Dopodomani.'} %}
{%- for day in ['today', 'tomorrow'] %}
{% set d = state_attr(entity, day) %}
{%- set events = state_attr(entity, 'events_'+day) %}
{%- if d %}
{%- if d['level'] >= 1 %}
| | |
|:--|:--|
| <font color="{{ color.get(d['level']) }}"/> <ha-icon icon="{{ 'mdi:numeric-' ~ d['level'] ~ '-box'}}"/></ha-icon> | {{ days_map[day] }} {{d['info']}} {{d['alert']}}</font> |
{% endif %}
{%- endif %}
{%- if events %}
{%- for ev in events %}
| | | |
|:--|:--|:--|
| <font color="{{ color.get(ev['level']) }}"/> <ha-icon icon="{{ 'mdi:numeric-' ~ ev['level'] }}"/> | <font color="{{ color.get(ev['level']) }}"/> <ha-icon icon="{{ ev['icon'] }}"/> | {{ ev['alert'] }} {{ ev['info'] }} criticità per rischio {{ ev['risk'] }} |
{%- endfor %}
{%- endif %}
{%- endfor %}
___
{% set entity = 'sensor.dpc_vigilance' %}
#### PROTEZIONE CIVILE - [VIGILANZA METEO](https://mappe.protezionecivile.it/it/mappe-rischi/bollettino-di-vigilanza)
##### ZONA {{state_attr(entity, 'zone_name')}}
{% set color = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red', 5: 'BlueViolet'} %}
{# set color_vigilance = {0:'#FFFFFF', 1:'#008000', 2:'#C3FFFE', 3:'#50FFFF', 4:'#508BFF', 5: '#A040FF'} #}
{% set color_v = {0:'White', 1:'Green', 2:'LightCyan', 3:'BabyBlue', 4:'CornflowerBlue', 5: 'BlueViolet'} %}
{% set day = {'today':'Oggi.', 'tomorrow':'Domani.', 'aftertomorrow': 'Dopodomani.'} %}
{%- for status in ['today', 'tomorrow','aftertomorrow'] %}
{% set v = state_attr(entity, status) %}
{%- if v %}
{%- if v['level'] >= 1 %}
<font color="{{ color_v.get(v['level']) }}"/> <ha-icon icon="{{ v['icon'] }}"/></ha-icon> {{ day[status] }} Quantitativi previsti {{ v['precipitation'] }} </font>
{%- endif %}
{%- if v.phenomena %}
{% for d in v.phenomena %}
| | |
|:--|:--|
| <ha-icon icon="{{ d['icon'] }}"/> |{{ d['event'] }} {{ d['value'] }} [{{ d['distance'] }} Km {{ d['direction'] }}] |
{%- endfor %}
{%- endif %}
{%- endif %}
{%- endfor %}
[Sito Web Protezione Civile](https://www.protezionecivile.gov.it/it/) ~ [Radar](https://mappe.protezionecivile.it/it/mappe-rischi/piattaforma-radar)
type: markdown
content: >-
___
{% set entity = 'sensor.dpc_alert' %}
#### PROTEZIONE CIVILE -
[CRITICITA](https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita)
##### ZONA {{state_attr(entity, 'zone_name')}}
{% set color = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red'} %}
{% set days_map = {'today':'Oggi.', 'tomorrow':'Domani.', 'aftertomorrow':
'Dopodomani.'} %}
{%- for day in ['today', 'tomorrow'] %}
{% set d = state_attr(entity, day) %}
{%- set events = state_attr(entity, 'events_'+day) %}
{%- if d %}
{%- if d['level'] >= 1 %}
<font color="{{ color.get(d['level']) }}"/> <ha-icon icon="{{ 'mdi:numeric-' ~
d['level'] ~ '-box'}}"/></ha-icon> {{ days_map[day] }} {{d['info']}}
{{d['alert']}}</font>
{% endif %}
{%- endif %}
{%- if events %}
{%- for ev in events %}
| | | |
|:--|:--|:--|
| <font color="{{ color.get(ev['level']) }}"/> <ha-icon icon="{{
'mdi:numeric-' ~ ev['level'] }}"/> | <font color="{{ color.get(ev['level'])
}}"/> <ha-icon icon="{{ ev['icon'] }}"/> | {{ ev['alert'] }} {{ ev['info'] }}
criticità per rischio {{ ev['risk'] }} |
{%- endfor %}
{%- endif %}
{%- endfor %}
___
{% set entity = 'sensor.dpc_vigilance' %}
#### PROTEZIONE CIVILE - [VIGILANZA
METEO](https://mappe.protezionecivile.it/it/mappe-rischi/bollettino-di-vigilanza)
##### ZONA {{state_attr(entity, 'zone_name')}}
{% set color = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red', 5:
'BlueViolet'} %}
{% set color_v = {0:'White', 1:'Green', 2:'#C3FFFE', 3:'#50FFFF', 4:'#508BFF',
5: '#A040FF'} %}
{% set day = {'today':'Oggi.', 'tomorrow':'Domani.', 'aftertomorrow':
'Dopodomani.'} %}
{%- for status in ['today', 'tomorrow','aftertomorrow'] %}
{% set v = state_attr(entity, status) %}
{%- if v %}
{%- if v['level'] >= 1 %}
<font color="{{ color_v.get(v['level']) }}"/> <ha-icon icon="{{ v['icon']
}}"/></ha-icon> {{ day[status] }} Quantitativi previsti {{ v['precipitation']
}} </font>
{% if "zone_name" in v %} {{v['zone_name'] if state_attr(entity, 'zone_name')
!= v['zone_name'] else ''}}{%- endif %}
{%- endif %}
{%- if "phenomena" in v%}
{% for d in v.phenomena %}
| | |
|:--|:--|
| <ha-icon icon="{{ d['icon'] }}"/> |{{ d['event'] }} {{ d['value'] }} [{{
d['distance'] }} Km {{ d['direction'] }}] |
{%- endfor %}
{%- endif %}
{%- endif %}
{%- endfor %}
[Sito Web Protezione Civile](https://www.protezionecivile.gov.it/it/) ~
[Radar](https://mappe.protezionecivile.it/it/mappe-rischi/piattaforma-radar)
title: Markdown Alert and Vigilance
type: markdown
card_mod:
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none;}
content: >
___
#### PROTEZIONE CIVILE
{% set color = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} %}
{% for state in states.binary_sensor %}
{%- if is_state_attr(state.entity_id, 'integration', 'dpc') and state.state == 'on' %}
<font color= {{color[state.attributes.level|int]}}> <ha-icon icon="{{ 'mdi:numeric-' ~ state.attributes.level|int ~ '-box'}}" style="width: 36px; height: 36px;"></ha-icon>
{{state.name}} - {{state.attributes.alert}} {{state.attributes.info}}</font>
{%- endif -%} {% endfor %}
[Protezione Civile](https://www.protezionecivile.gov.it/it/) ~ [Vigilanza Meteo](https://mappe.protezionecivile.it/it/mappe-rischi/bollettino-di-vigilanza)
~ [Criticità Idro](https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita) ~ [Radar](https://mappe.protezionecivile.it/it/mappe-rischi/piattaforma-radar)
Lovelace custom config-template-card example to display maps (autoupdate fase)
type: custom:config-template-card
entities:
- sensor.dpc_alert
card:
type: iframe
card_mod:
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
margin-top: 8px;
}
aspect_ratio: 100%
url: >-
${const d = new Date();
const dpc_d = new Date(String(states['sensor.dpc_alert'].attributes.publication_date));
var fase = (dpc_d.getDate() === d.getDate()) ? 'today' : 'tomorrow';
'https://servizio-mappe.protezionecivile.it/#/view/dashboard?x=11.756&y=41.495&
zoom=5.8&basemap=BING_AERIAL&appname=BollettinodiCriticità&file=
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica/master/files/'
+states['sensor.dpc_alert'].attributes.id+'.json&hidden=info,minimap&fase=' + fase}
type: custom:config-template-card
entities:
- sensor.dpc_vigilance
card:
type: iframe
card_mod:
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
margin-top: 8px;
}
aspect_ratio: 100%
url: >-
${const d = new Date();
const dpc_d = new Date(String(states['sensor.dpc_vigilance'].attributes.publication_date));
var fase = (dpc_d.getDate() === d.getDate()) ? 'today' : 'tomorrow';
'https://servizio-mappe.protezionecivile.it/#/view/dashboard?x=11.756&y=41.495&
zoom=5.8&basemap=OPEN_STREET_MAP&appname=Bollettino di Vigilanza&file=
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Vigilanza-Meteorologica/master/files/'
+states['sensor.dpc_vigilance'].attributes.id+'.json&hidden=minimap,info&fase=' + fase}
# #hidden=minimap,info,switch <<---
Lovelace custom lovelace-card-templater example to display maps (autoupdate fase)
type: custom:card-templater
card:
type: iframe
aspect_ratio: 100%
url_template: >-
{% set day = 'today' if now().day == state_attr('sensor.dpc_vigilance',
'publication_date').day else 'tomorrow' %}
{{'https://servizio-mappe.protezionecivile.it/#/view/dashboard?x=11.756&y=41.495&
zoom=5.8&basemap=OPEN_STREET_MAP&appname=Bollettino di Vigilanza&file=
https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Vigilanza-Meteorologica/master/files/'
+ state_attr('sensor.dpc_vigilance', 'id') +
'.json&hidden=minimap,info,&fase=' + day}}
type: custom:card-templater
card:
type: iframe
aspect_ratio: 100%
url_template: >-
{% set day = 'today' if now().day == state_attr('sensor.dpc_alert',
'publication_date').day else 'tomorrow' %}
{{'https://servizio-mappe.protezionecivile.it/#/view/dashboard?x=11.756&y=41.495&zoom=5.8&basemap=GOOGLE_SATELLITE&appname=Bollettino
di
Criticità&file=https://raw.githubusercontent.com/pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica/master/files/'
+ state_attr('sensor.dpc_alert', 'id') + '.json&hidden=info,minimap,&fase='
+ day }}
alias: protezione_civile_notifications_criticita_sensor
trigger:
- platform: state
entity_id:
- sensor.dpc_alert
condition:
- condition: template
value_template: >-
{{ not trigger.from_state.state in ["unavailable","unknown"] and (
trigger.from_state.attributes.total_alerts !=
trigger.to_state.attributes.total_alerts or
( trigger.to_state.attributes.id != trigger.from_state.attributes.id and trigger.to_state.attributes.total_alerts > 0 )) }}
action:
- variables:
BULLETIN: >-
https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita
WARNING_SIGN:
"0": ⚪
"1": 🟢
"2": 🟡
"3": 🟠
"4": 🔴
WARN_DPC:
none: ❌
Temporali: ⚡
Idraulico: 💧
Idrogeologico: 🌊
ENTITY: "{{ trigger.entity_id |default('sensor.dpc', true) }}"
DAYS:
"1": today
"2": tomorrow
GIORNI:
"1": oggi
"2": domani
- repeat:
while:
- condition: template
value_template: "{{ repeat.index <= DAYS|length }}"
sequence:
- variables:
giorno: "{{ GIORNI[repeat.index|string] }}"
day: "{{ DAYS[repeat.index|string] }}"
event: "{{ 'events_' + day }}"
- choose:
- conditions:
- condition: template
value_template: "{{ state_attr(ENTITY, event) is not none }}"
sequence:
- service: notify.discord
data:
title: DPC Criticità
message: >
{% set attr = state_attr(ENTITY, event) %}
Criticità per {{giorno}}
{%- for d in attr %}
{{WARNING_SIGN[d['level']|string]}} {{ WARN_DPC[d['risk']]
}} {{ d['info'] }} {{ d['alert'] }} per rischio {{
d['risk'] }}.
{%- endfor %}
Zona: {{ state_attr(ENTITY, 'zone_name') }}
mode: queued
max_exceeded: silent
max: 10
alias: protezione_civile_notifications_vigilance_sensor
trigger:
- platform: state
entity_id:
- sensor.dpc_vigilance
condition:
- condition: template
value_template: >-
{{ trigger.from_state.state not in ["unavailable","unknown"] and (
trigger.from_state.attributes.total_alerts !=
trigger.to_state.attributes.total_alerts or
( trigger.to_state.attributes.id != trigger.from_state.attributes.id and
( trigger.to_state.attributes.total_phenomena > 0 or trigger.to_state.attributes.total_alerts > 0 ))) }}
action:
- variables:
BULLETIN: >-
https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-vigilanza
ENTITY: "{{ trigger.entity_id |default('sensor.dpc_vigilance', true) }}"
DAYS:
"1": today
"2": tomorrow
"3": aftertomorrow
GIORNI:
"1": oggi
"2": domani
"3": dopodomani
WARNING_SIGN:
"0": ⚪
"1": 🟢
"2": 🟡
"3": 🟠
"4": 🔴
- repeat:
while:
- condition: template
value_template: "{{ repeat.index <= DAYS|length }}"
sequence:
- variables:
giorno: "{{ GIORNI[repeat.index|string] }}"
day: "{{ DAYS[repeat.index|string] }}"
- choose:
- conditions:
- condition: template
value_template: "{{ state_attr(ENTITY, day) is not none }}"
- condition: template
value_template: "{{ state_attr(ENTITY, day).level|default|int > 1 }}"
sequence:
- service: notify.pushover
data:
title: DPC Vigilanza Meteo
message: >
{% set attr = state_attr(ENTITY, day) %}
Vigilanza meteo per {{giorno}}
{{WARNING_SIGN[attr['level']|string]}} Quantitativi
previsti {{attr['precipitation']}}
{% if 'phenomena' in attr %}
Fenomeni nelle vicinanze:
{% for f in attr['phenomena'] %}
➡️ {{f.event}}: {{f.value}} in direzione {{f.direction}}
alla distanza di {{f.distance}}km.
{% endfor %}
{% endif %}
Zona: {{ state_attr(ENTITY, 'zone_name') }}
mode: queued
max_exceeded: silent
max: 10
automation:
- alias: Protezione Civile Notifications
mode: queued
max_exceeded: silent
max: 10
trigger:
- platform: state
entity_id:
- binary_sensor.dpc_idrogeologico_oggi
- binary_sensor.dpc_idraulico_oggi
- binary_sensor.dpc_temporali_oggi
- binary_sensor.dpc_idrogeologico_domani
- binary_sensor.dpc_idraulico_domani
- binary_sensor.dpc_temporali_domani
condition:
- condition: template
value_template: >-
{{ trigger.to_state.state == 'on' and (trigger.from_state.state == 'off'
or (trigger.to_state.attributes != trigger.from_state.attributes))}}
action:
- variables:
BULLETIN: "https://mappe.protezionecivile.gov.it/it/mappe-rischi/bollettino-di-criticita"
dpc_tts_msg: >-
{% set attr = trigger.to_state.attributes if trigger.to_state is defined else ({}) %}
Attenzione. {{ attr.get('friendly_name','Test DPC') }}.
Allerta {{ attr.get('allerta','Bianca') }} {{ attr.get('info','Nessuna info') }}.
- service: notify.pushover
data:
title: >-
{% set attr = trigger.to_state.attributes if trigger.to_state is defined else ({}) %}
Protezione Civile - {{ attr.get(''rischio'') }}
message: |
{% set attr = trigger.to_state.attributes if trigger.to_state is defined else ({}) %}
{% set alert = {'0': '⚪', '1':'🟢', '2':'🟡', '3':'🟠', '4': '🔴'} %}
{% set risk = {none: '❌', 'Temporali':'⚡', 'Idraulico':'💧', 'Idrogeologico':'🌊'} %}
{{ risk[attr.get('rischio')] }} {{ attr.get('friendly_name','Test DPC') }}.
{{ alert[attr.get('level', 0)|string] }} Allerta {{ attr.get('allerta','Bianca') }}
{{ attr.get('info','No info') }}.
Bollettino di criticità {{ attr.get('link', BULLETIN) }}
- service: tts.google_translate_say
data:
message: "{{ dpc_tts_msg }}"
entity_id: media_player.red
- service: notify.alexa_media
data:
message: "{{ dpc_tts_msg }}"
data:
type: tts
target: "media_player.studio"
Other Lovelace Examples HA Card weather conditions @r-renato
Information provided by Department of Civil Protection - Presidency of the Council of Ministers Creative Commons Licenses CC-BY-SA 4.0.
Dati forniti dal servizio Dipartimento della Protezione Civile-Presidenza del Consiglio dei Ministri Licenza Creative Commons CC-BY-SA 4.0.
All product names, trademarks and registered trademarks in the images in this repository, are property of their respective owners. All images in this repository are used by the author for identification purposes only. The use of these names, trademarks and brands appearing in these image files, do not imply endorsement.