{"id":15095834,"url":"https://github.com/devincarr/lighthouse","last_synced_at":"2026-02-06T07:03:56.034Z","repository":{"id":71061553,"uuid":"422463618","full_name":"DevinCarr/lighthouse","owner":"DevinCarr","description":"Notification system for local earthquakes from USGS and weather alerts from NWS","archived":false,"fork":false,"pushed_at":"2021-12-08T02:57:52.000Z","size":409,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-25T03:30:02.647Z","etag":null,"topics":["home-automation","homeassistant","mqtt","nws-alerts","usgs-earthquake"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevinCarr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-29T06:21:33.000Z","updated_at":"2024-04-15T19:49:44.000Z","dependencies_parsed_at":"2023-02-25T08:30:41.353Z","dependency_job_id":null,"html_url":"https://github.com/DevinCarr/lighthouse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DevinCarr/lighthouse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevinCarr%2Flighthouse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevinCarr%2Flighthouse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevinCarr%2Flighthouse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevinCarr%2Flighthouse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevinCarr","download_url":"https://codeload.github.com/DevinCarr/lighthouse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevinCarr%2Flighthouse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29153890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T02:39:25.012Z","status":"ssl_error","status_checked_at":"2026-02-06T02:37:22.784Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["home-automation","homeassistant","mqtt","nws-alerts","usgs-earthquake"],"created_at":"2024-09-25T15:42:27.212Z","updated_at":"2026-02-06T07:03:55.994Z","avatar_url":"https://github.com/DevinCarr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lighthouse\n\nNotification system for local earthquakes from USGS and weather alerts from NWS.\n\n## Usage\n\n`$ ./lighthouse -config config.json`\n\n### Config\n\n```json\n{\n    \"Latitude\": 61.181,\n    \"Longitude\": -149.989,\n    \"Distance\": 500.0, // in km\n    \"Interval\": \"1m\", // interval to check sources\n    \"Weather\": {\n        \"Zones\": [\"AKZ101\", \"AKZ225\"], // NWS weather zones (https://alerts.weather.gov/index.php)\n        \"Email\": \"email@email.com\" // Email for NWS API\n    },\n    \"Mqtt\": {\n        \"Endpoint\": \"tcp://homeassistant.local:1883\",\n        \"Username\": \"mqtt-client\",\n        \"Password\": \"fancy-password-here\"\n    }\n}\n```\n\n### MQTT/HomeAssistant Integration\n\nFor any alert published by the monitored systems, the message will be packed into a MQTT payload for easy parsing in HomeAssistant Automation.\n\nExample MQTT payload (earthquake):\n\n```json\n{\n    \"Type\": \"alerts/earthquakes\",\n    \"Id\": \"nc73648785\",\n    \"Message\": \"M 2.1 - 7km NE of San Martin, CA\",\n    \"Link\":\"https://earthquake.usgs.gov/earthquakes/eventpage/nc73648785\"\n}\n```\n\nExample Home Assistant Automation (earthquake):\n\n\u003cimg src=\"screenshot.jpeg\" alt=\"Mobile Notificatio Screenshot\" height=\"200\"/\u003e\n\n```yaml\nalias: Send Push Notification for Local Earthquake Alerts\ndescription: 'Send Push Notification for Local Earthquake Alerts'\ntrigger:\n  - platform: mqtt\n    topic: alerts/earthquakes\ncondition: []\naction:\n  - service: notify.mobile_app_\u003cdevice\u003e\n    data:\n      title: Earthquake Alert\n      message: '{{ trigger.payload_json.Message }}'\n      data:\n        actions:\n          - action: URI\n            title: Open USGS Alert\n            uri: '{{ trigger.payload_json.Link }}'\nmode: parallel\nmax: 5\n```\n\n## Remarks\n\nI currently run this setup on a Raspberry PI Zero and as such, I have setup some additional embedded system contraints in the design.\n\n### DNS Pre-cached\n\nSince the code runs on a very short interval, I cache the DNS responses for a period of time to reduce the number of out-going DNS requests. In normal cases this wouldn't be needed but I had a unique network configuration via [Tailscale](https://tailscale.com/) in which this system helped save some request latency on the small cpu of the pi.\n\n### Notification Send Debouncing\n\nSince an alert from either NWS or USGS could be sent multiple times, there is a cache lookup on the alert's id to only send it once. This also helps reduce the (potenial) amount of notification spam to my device.\n\nThe mechanism is a simple ring buffer that has 15 entries which adds a new entry at the end by id. On processing an alert, if the entry already exists in the buffer it will just drop the alert and not publish it to the MQTT queue. In the case that the alert is not in the buffer, it will publish the notification to the MQTT queue and add the id to the buffer at the next pointer.\n\nSince it is a ring buffer, it means that there would need to be 15 alerts all within a short period of time for the first one to possibly be re-shown again. This helps by reducing the overall active memory usage and having to keep track of the alerts which are only every likely to report unique alerts within reasonable time periods.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevincarr%2Flighthouse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevincarr%2Flighthouse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevincarr%2Flighthouse/lists"}