Skip to content

Automation for nearby Earthquake detection #37778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
claudy-us opened this issue Mar 3, 2025 · 3 comments
Open

Automation for nearby Earthquake detection #37778

claudy-us opened this issue Mar 3, 2025 · 3 comments
Labels
integration: usgs_earthquakes_feed Stale The PR had no activity for quite some time, and is marked as Stale

Comments

@claudy-us
Copy link

claudy-us commented Mar 3, 2025

Feedback

I'm struggling to create an automation that triggers when an earthquake is detected nearby. The problem is that a dynamic entity is generated when this event occurs. I'm trying to catch this event. but it is not as simple as a direct attribute automation.
I tried getting the attributes first, but as it is a new entity, I wouldn't be able to catch it.
Now I'm trying to get an event, but I think the way it is is somewhat inneficient (1st Code)

Maybe this way is a little better, but I have to wait for an earthquake to see if it works... (2nd Code)

I will be glad if someone could point me in the right direction.

URL

https://www.home-assistant.io/integrations/usgs_earthquakes_feed/

Version

2025.2.5

Additional information

1st Automation:

alias: Earthquake Notification
description:
Notify via TTS when a significant earthquake occurs.
triggers:
  - trigger: event
    event_type: state_changed
condition:
  - condition: template
    value_template: >
      {{ 'geo_location' in trigger.event.data.entity_id }}
  - condition: template
    value_template: >
      {{ trigger.event.data.new_state.attributes.magnitude | float > 4.0 }}
  - condition: template
    value_template: >
      {{ trigger.event.data.new_state.state | float < 50 }} 

Second Automation:

alias: Earthquake Notification - Optimized
description: Notify via TTS when significant earthquakes occur dynamically and efficiently.
trigger:
  - platform: template
    value_template: >
      {{ trigger.event.data.new_state and
         trigger.event.data.new_state.domain == 'geo_location' and
         'usgs_earthquakes_feed' in trigger.event.data.new_state.attributes.source and
         trigger.event.data.new_state.attributes.magnitude | float > 4.0 and
         trigger.event.data.new_state.state | float < 50 }}
@home-assistant
Copy link

home-assistant bot commented Mar 3, 2025

Hey there @exxamalte, mind taking a look at this feedback as it has been labeled with an integration (usgs_earthquakes_feed) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of usgs_earthquakes_feed can trigger bot actions by commenting:

  • @home-assistant close Closes the feedback.
  • @home-assistant rename Awesome new title Renames the feedback.
  • @home-assistant reopen Reopen the feedback.
  • @home-assistant unassign usgs_earthquakes_feed Removes the current integration label and assignees on the feedback, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information) to the feedback.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information) on the feedback.

@exxamalte
Copy link
Contributor

My recommendation would be to use a geolocation trigger in your automation, using usgs_earthquakes_feed as source, and a large zone around your home. That way, when an earthquake occurs, a new geolocation entity is created and "appears" in your zone.

Copy link

github-actions bot commented May 2, 2025

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved.
If this issue is still relevant, please let us know by leaving a comment 👍
This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale The PR had no activity for quite some time, and is marked as Stale label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration: usgs_earthquakes_feed Stale The PR had no activity for quite some time, and is marked as Stale
Projects
None yet
Development

No branches or pull requests

2 participants