Open ejpenney opened 1 year ago
I received answer from emsc: Yes it is unlikely that we resume the rss feed, but our data are still available from our seismicportal: https://seismicportal.eu/fdsn-wsevent.html best regards,
Hi,
thanks for looking at this. Sadly, w/o RSS this integration will not work anymore.
BR
I don't know how to solve this quite as thoroughly as this integration did, but for folks in the US, there does exist the USGS integration. Looks like some quakes are reported outside the US, but the number is low enough I believe the data's incomplete.
Using USGS I get behavior similar to this integration by adding this to configuration.yaml:
geo_location:
- platform: usgs_earthquakes_feed
feed_type: "past_day_all_earthquakes"
template:
- sensor:
name: usgs_earthquakes_feed
state: "{{ this.attributes.quakes | count }}"
attributes:
quakes: >
{%- set entities = integration_entities("usgs_earthquakes_feed") %}
{%- set ns = namespace(entities = []) %}
{%- for entity_id in entities %}
{%- set ns.entities = ns.entities + [ entity_id ] %}
{%- endfor %}
{{ ns.entities }}
Then I created a card like this:
type: conditional
conditions:
- entity: sensor.usgs_earthquakes_feed
state_not: '0'
card:
type: markdown
content: >
|Time|Title|Magnitude|
|----|-----|---------:|
{%- for entry in state_attr("sensor.usgs_earthquakes_feed", "quakes") %}
|{{ relative_time(state_attr(entry, "time")) }} ago | {{
state_attr(entry, "place") }} | {{ state_attr(entry, "magnitude") }}|
{%- endfor -%}
The geo_location domain also provides this nifty map, so you could also do something like this:
type: conditional
conditions:
- entity: sensor.usgs_earthquakes_feed
state_not: '0'
card:
title: Earthquakes!
type: vertical-stack
cards:
- type: map
geo_location_sources:
- all
- type: markdown
content: >
|Time|Title|Magnitude|
|----|-----|---------:| {%- for entry in
state_attr("sensor.usgs_earthquakes_feed", "quakes") %}
|{{ relative_time(state_attr(entry, "time")) }} ago | {{
state_attr(entry, "place") }} | {{ state_attr(entry, "magnitude") }}|
{%- endfor -%}
Hello, Is it possible the integration to receive the earthquake data from this page: https://www.emsc-csem.org/Earthquake_information/
Hello I checked their app, it retrieves data from this geojson. Can it be implemented? (I don't know how to build integrations, unfortunately)
It is simple extracting the data from the json with some small code in the configuration.yaml and some rest platform. This is my code I use to get some WAQI data, this should be something similar. I dont know how to do integrations as well.
- platform: rest
resource:https://api.waqi.info/feed/A181300/?token=<token>
scan_interval: 600
name: WAQI Butel
value_template: "{{ value_json.data.aqi | int }}"
unique_id: waqi_butel
My (newbie) Home Assistant solution for the EMSC monitor, see the code below. Please note: I am only interested in the latest earthquake within a region roughly the rectangle region left top Iceland, right bottom Turkey. I use the following URL for that:
https://www.seismicportal.eu/fdsnws/event/1/query?limit=1&minlat=34.443&maxlat=68.270&minlon=-23.921&maxlon=41.365&format=json&minmag=4.0
limit=1
-> means I only want the latest quake
minlat=34.443&maxlat=68.270&minlon=-23.921&maxlon=41.365
-> is the region I'm interested in
minmag=4.0
-> only magnitude 4.0 and above
You can create this URL at the website of EMSC and then past it in the code.
In de configuration.yaml
rest:
# EMSC Earthquakes
- resource: https://www.seismicportal.eu/fdsnws/event/1/query?limit=1&minlat=34.443&maxlat=68.270&minlon=-23.921&maxlon=41.365&format=json&minmag=4.0
timeout: 50
scan_interval: 900 # scan every 15 minutes
sensor:
- name: "EMSC Earthquakes"
value_template: "OK"
json_attributes_path: "features[0].properties"
json_attributes:
- lastupdate
- time
- flynn_region
- lat
- lon
- depth
- mag
- magtype
- unid
Next, I added a Markdown Card (on one of my dashboards. If you open the YAML-editor of that card, you can paste it in.
type: markdown
content: >
<ha-icon icon="mdi:earth"></ha-icon><b>Latest earthquake >=4.0 in the EU:</b>
Location: <a href="https://www.google.com/maps/search/?api=1&query={{ state_attr('sensor.emsc_earthquakes', 'lat') }}+{{
state_attr('sensor.emsc_earthquakes', 'lon') }}" style="color:blue" target="_blank"> {{ state_attr('sensor.emsc_earthquakes', 'flynn_region') | title }} </a>
Magnitude (4>): {{ state_attr('sensor.emsc_earthquakes', 'mag') }} ({{ state_attr('sensor.emsc_earthquakes', 'magtype') | title}})
Depth: {{ state_attr('sensor.emsc_earthquakes', 'depth') }} km
Date: {{ state_attr('sensor.emsc_earthquakes', 'time')[0:10] }} Time: {{ state_attr('sensor.emsc_earthquakes', 'time')[11:19] }}
This gives you an idea how you could use the information. I am new to Home Assistant, so maybe a wizard would do a better job, but this works for me.
Version of the custom_component
0dc231c
Configuration
Describe the bug
Getting this error in the logs:
Debug log
Not bothering to generate logs as I confirmed the URL is indeed giving a 404 in my browser. I suspect the RSS feed has moved (or is possibly defunct).
If you really want debug logs, just ask and I'll generate some.