Hi. The automation works only if an earthquake has actually occurred. When I see an earthquake point on a minimap, I run the automation manually and the alerts come. But it doesn’t work automatically. Thanks!
map:
type: map
title: Earthquakes
entities:
- entity: zone.home
geo_location_sources:
- usgs_earthquakes_feed
default_zoom: 5
theme_mode: auto
configuration.yaml:
geo_location:
- platform: usgs_earthquakes_feed
feed_type: "past_day_all_earthquakes"
radius: 1000
minimum_magnitude: 1.0
latitude: SOMELATITUDE
longitude: SOMELONGITUDE
automation:
alias: earthquake
trigger:
- platform: geo_location
source: usgs_earthquakes_feed
zone: zone.home
event: enter
condition: []
action:
- variables:
header: 🌎EARTHQUAKE
time: >-
{{ as_timestamp( states.geo_location | selectattr('attributes.source',
'eq', 'usgs_earthquakes_feed') | map(attribute='attributes.time') | max
) | timestamp_custom('%Y-%m-%d %-H:%M') }}
place: >-
{{ states.geo_location | selectattr('attributes.source', 'eq',
'usgs_earthquakes_feed') | map(attribute='attributes.place') | max }}
magnitude: >-
{{ states.geo_location | selectattr('attributes.source', 'eq',
'usgs_earthquakes_feed') | map(attribute='attributes.magnitude') | max
}}
latitude: >-
{{ states.geo_location | selectattr('attributes.source', 'eq',
'usgs_earthquakes_feed') | map(attribute='attributes.latitude') | max }}
longitude: >-
{{ states.geo_location | selectattr('attributes.source', 'eq',
'usgs_earthquakes_feed') | map(attribute='attributes.longitude') | max
}}
- data:
title: "{{ header }}"
message: |
Time: {{ time }}
Place: {{ place }}
Magnitude: {{ magnitude }}
On map: https://maps.yandex.ru/?text={{latitude}}%2C{{longitude}}
action: persistent_notification.create
mode: single