I just had a closer look at the Copernius EMS feeds. I could find two feeds - the rapid feed and the risk and recovery feed. Each feed seems to contain all activations that the EMS has ever recorded going back to 2012. On the website you can filter activations by open/closed status, but I couldn’t find any indication in the GeoRSS feeds to determine an item’s status.
To prevent HA from showing you alerts from years ago, one option would be to filter by publication date, but this approach may miss some long-term ongoing open activations.
Hi!!
First I want to give thanks for this work improving the GeoRSS.
I´m starting to use this component in Hassio. I have already the file in my custom_component folder. but I don´t know how to configure the sensor
I´m trying to read this RSS: http://www.ign.es/ign/RssTools/sismologia.xml
I have this code:
- platform: geo_rss_events_new
name: Terremoto
url: http://www.ign.es/ign/RssTools/sismologia.xml
radius: 500
custom_attributes:
- name: magnitud
source: description
regexp: '.*magnitud\ (?P<custom_attribute>\d+.\d+) .*'
- name: descripcion
source: description
regexp: '(?P<custom_attribute>.* .*)'
sort_by: 'magnitud'
sort_reverse: true
publish_events: true
Becasue I want to extrack not only the title but description and magnitude from that RSS
I have this in the log:
2019-03-13 18:08:30 DEBUG (SyncWorker_4) [custom_components.geo_rss_events_new.sensor] Keeping event {'category': None, 'title': '-Info.terremoto: 11/03/2019 19:52:51', 'date_published': None, 'date_updated': None, 'distance': 167.92182853566703, 'id': 'http://www.ign.es/web/ign/portal/sis-catalogo-terremotos/-/catalogo-terremotos/detailTerremoto?evid=es2019dafaf', 'magnitud': '2.7', 'descripcion': 'Se ha producido un terremoto de magnitud 2.7 en ATLÁNTICO-CANARIAS en la fecha 11/03/2019 19:52:51 en la siguiente localización: 28.9791,-14.2134'}
So I have the attributes that I want, tittle, description and magnitud
But I can´t see them in Hassio, I´m trying to do a template senor but I get none:
- platform: template
sensors:
terremoto_descripcion:
friendly_name: "Descripción"
value_template: "{{ state_attr('sensor.terremoto_any', 'descripcion') }}"
What am I doing wrong? How can I get that values for an automation or frontend for example???
Best regards
Thanks for your interest in this custom component.
Unfortunately it works differently to what you seem to expect. Your configuration will generate 1 sensor that just shows the number of current incidents found in the GeoRSS feed. At the same time it generates internal events - 1 event per incident - that you can pick up in an automation. A template sensor won’t work in this case.
See in my post above for an example of how you can create a notification for each event fired. You probably need to change the event type to: event_type: terremoto
aligning it with your sensor’s name.
In the meantime a lot of things have changed though: The above mentioned pull requests was closed, and instead I implemented a new geolocation component from scratch. There is already a platform that retrieves earthquake data from the USGS, but that does not appear to cover Europe.
I have been working on a python library that integrates several other GeoRSS feeds which could in turn easily be integrated into HA. I’ve already got a Canadian and an Italian earthquake feed available.
If you like you can help with a similar integration of this Spanish earthquakes feed as a contribution to my python library, followed by an integration into HA. Otherwise, if there is a lot of interest also by other users, I could look at doing that myself.
I´m quite interested to help in the integration with the oficial IGN spanish earthquakes and after the HA integration
I´m pretty new in this world but I think than I learn fast
In the other hand, now I got the eartquake notification in my phone, but I have the whole event with a lot of info. I’ts confusing all that info unformatted in the message
Do you know if its possible only to show in the message some attributes like tittle and magnitud?, both atributes are inside de whole event
¿Maybe something like this?
message: 'Earthquake Warning: {{ trigger.tittle }}'
Thank you
I’m also interested in sensor for GeoRSS feeds since it appears that there are no other formats/sources for Europe.
Yes, you can access the event details, for example in your setup you should be able to get the earthquake’s magnitude like this:
{{ trigger.to_state.attributes.magnitud }}
Nice!!!
I will test today the new automation with a big radius
Thank you
Let me know any thing you need
I have my sensor completely configured for the Spanish eartquakes warning (IGN)
This is the code into sensor.yaml
# Colocar este código en el fichero sensor.yaml. Modificar la variable radius a los KMS deseados
# Sensor de Terremotos http://www.ign.es/ign/RssTools/sismologia.xml
- platform: geo_rss_events_new
name: Terremoto
url: http://www.ign.es/ign/RssTools/sismologia.xml
radius: 5000
custom_attributes:
- name: magnitud
source: description
regexp: '.*magnitud\ (?P<custom_attribute>\d+.\d+) .*'
- name: descripcion
source: description
regexp: '(?P<custom_attribute>.* .*)'
- name: fotoweb
source: id
regexp: '.*(?P<custom_attribute>.{11}$)'
# '(?P<custom_attribute>es\d{4}.{5})'
- name: fecha
source: title
regexp: '-Info.terremoto:\ .*(?P<custom_attribute>\d{2}\/\d{2}\/\d{4})'
# '-Info.terremoto:\ .*(?P<custom_attribute>\d{2}\/\d{2}\/\d{4})\s+\d{2}:\d{2}:\d{2}'
sort_by: 'fecha'
sort_reverse: true
publish_events: true
And this is the code for automation.yaml to send notifications via telegram and also a picture of the eartquake epicenter taken from IGN website:
# Colocar este código en el fichero automation.yaml
#########################################
## ##
## NOTIFICAR TERREMOTOS ##
## ##
#########################################
- id: 'Terremotos'
alias: 'Atencion Terremoto'
trigger:
- platform: event
event_type: terremoto
action:
- data_template:
title: '*Aviso de Terremoto*'
message: >
Terremoto de magnitud: *{{ trigger.event.data.magnitud }}* a una distancia de *{{ trigger.event.data.distance | round(1) }}* Kms de casa.
{{ trigger.event.data.descripcion }}
service: notify.domo_telegram
- data_template:
caption: Epicentro del terremoto
url: 'http://www.ign.es/web/resources/sismologia/www/dir_images_terremotos/detalle/{{ trigger.event.data.fotoweb }}.gif'
service: telegram_bot.send_photo
initial_state: true
I just released a new version of my georss library with support for the IGN earthquakes feed.
Next step is the HA integration.
Nice!!! Thanks for add the IGN
@exxamalte I´m having an annoying thing that happens sometimes and I don´t know how to fix it.
If I lose the connection to the RSS feed, the events goes to cero, and when I recover the connectivity then the events goes again to the normal value .
Due this, my automation thinks that, of a sudden, has happened ‘X’ eartquakes, for example 14 in this moments, and shows the 14 eartquakes in Telegram Bot
Do you think it´s possible to avoid this behaviour?.
For example I lost the connection today and I received 14 messages in Telegram, You can see here the pannel:
Normally I would recommend changing the automation so that it only gets triggered if the state of the sensor has changed for a certain amount of time. That way you could bridge short gaps.
But since your automation should notify you about earthquakes, I’m not sure if you really would want to delay every single notification.
Good idea!, I am trying to change the code into this:
trigger:
platform: event
event_type: terremoto
for:
minutes: 10
but I get an error, maybe is because the ‘from’ or ‘to’ is missing.
I do not know very well what states are right for events, for that reason in my firs automation I left empty
I am lost with events…
Sorry, little misunderstanding - I thought your trigger was based on the sensor value, not the event.
Unfortunately, for a trigger based on events there is no for
parameter that would help you here.
In the long term, I probably need to implement a mechanism that lets you define a grace period during which any errors while retrieving the external feed are ignored.
PR for the new platform is underway:
Nice, when do you think will be published?
I will announce in the HA spanish telegram group with your credits
I solved, I made another automation to stop the eartquake notify automation for 11 minutes if detects 0 events. It isn´t a “clean way” but it works.
- id: 'falsos terremotos'
alias: 'Parar Falso Terremoto'
trigger:
platform: template
value_template: "{{ (states.sensor.terremoto_any.state | int) == 0}}"
action:
- service: automation.turn_off
entity_id: automation.atencion_terremoto
- delay: '00:11:00'
- service: automation.turn_on
entity_id: automation.atencion_terremoto
initial_state: true
That’s a bit hard to predict. Aiming for 0.92, but I can’t make any promises.
seguo questo topic…
hello, any news? Thank you.
Edit:
I’m a newbie, but maybe the configuration is this? I’ll wait for the next earthquake.
Note: Change latitude and longitude to your home. Radius in meters
geo_location:
- platform: ign_sismologia
zone:
- name: Home
latitude: xx.xxxxxxx
longitude: -x.xxxxxx
radius: 5000000
passive: true
- id: Alerta Terremotos plataforma
alias: Alerta Terremotos plataforma
trigger:
platform: geo_location
source: ign_sismologia
zone: zone.home
event: enter
action:
- data_template:
title: '*Aviso de terremoto*'
message: >-
'Terremoto de magnitud: *{{ trigger.event.data.magnitud }}*
a una distancia de *{{ trigger.event.data.distance | round(1) }}* Kms de casa.
{{ trigger.event.data.descripcion }}
'
service: notify.domotica
- data_template:
caption: Epicentro del terremoto
url: http://www.ign.es/web/resources/sismologia/www/dir_images_terremotos/detalle/{{ trigger.event.data.fotoweb }}.gif
service: telegram_bot.send_photo