I am trying to setup a notification to my companion cell phone whenever an earthquake triggers, and I sort of have it working. Here is what I did so far:
- I setup the platform for usgs_earthquakes_feed in
configuration.yaml
geo_location:
- platform: usgs_earthquakes_feed
feed_type: "past_day_all_earthquakes"
radius: 25000
minimum_magnitude: 1.0
latitude: redacted
longitude: redacted
- Then I setup an automation with platform trigger
alias: Earth Quake Alert
description: ""
trigger:
- platform: geo_location
source: usgs_earthquakes_feed
zone: zone.redacted1
event: enter
id: earthquake_near_redacted1
- platform: geo_location
source: usgs_earthquakes_feed
zone: zone.redacted2
event: enter
id: earthquake_near_redacted2
condition:
- condition: template
value_template: "{{ trigger.to_state.attributes.type == 'earthquake' }}"
action:
- choose:
- conditions:
- condition: trigger
id:
- earthquake_near_redacted1
sequence:
- service: notify.mobile_app_pixel_5
data:
message: Magnitude {{ trigger.to_state.attributes.magnitude }}
title: Earthquake detected in redacted1
data:
url: >-
https://earthquakelist.org/latest-earthquakes-today/#latest-earthquakes-mag-5-distance-smart
- conditions:
- condition: trigger
id:
- earthquake_near_redacted2
sequence:
- service: notify.mobile_app_pixel_5
data:
message: Magnitude {{ trigger.to_state.attributes.magnitude }}
title: Earthquake detected in redacted2
data:
url: >-
https://earthquakelist.org/latest-earthquakes-today/#latest-earthquakes-mag-5-distance-smart
mode: queued
max: 15
The reason for the URL is because I’m hoping to get the notification to launch a URL, but that problem can be for another day.
The thing I notice happening, is when I restart HA I almost immediately get a notification. This is probably because I have the threshold set very low (for testing purposes). However, I never get another one.
My guess is that since the earthquake feed never “leaves” then it does not trigger an “Enter” again.
I feel like since I have a daily feed, as long as my “real” threshold is high (which it will be) then I won’t have to worry much about it. But I really would like to set this up so even if there were 2 earthquakes in 1 day, even at my “real” threshold, that I would receive a notification both times.
TL-DR; Is my trigger with platform geo_location “enter” the reason why I only get notifications once?
If so, my main question is - is there a way that I can trigger with the usgs_earthquakes_feed on every new item that appears?