NOAA weather alerts from weather.gov aka US National Weather Service

So i lost my Wunderground api that was giving me my weather alerts, i saw @finity post and @eracknaphobia using rest to get the alerts and was inspired by it to create my own custom sensor. It is using https://pypi.org/project/noaa-sdk/

So here is my very initial commit of the sensor, i am planning on building it up to get much more data.
https://github.com/dcshoecomp/noaa_alerts

1 Like

How does your sensor using noaa-sdk differ from the custom sensor that eracknaphobia created?

eracknaphobia is directly interacting with the weather api via the component, i am just using the already built noaa-sdk to do all the heavy lifting for me to get basically the same information. It seems the noaa-sdk also has retrys built in if the first request failed. The noaa-sdk is pretty full featured and should be pretty easy for me to add in more config options such as filtering by urgency,serverity,type, or status(alert/update,cancelled). Also it seems the noaa-sdk is actively being maintained so if something changes on the weather.gov side i wouldn’t have to make changes to my sensor, just have to wait for noaa-sdk to be updated.
I also was reading https://developers.home-assistant.io/docs/en/creating_component_code_review.html and item #4 stuck out to me

1 Like

Ok. Thanks.

I’ll keep watching here for updates and if i figure it gives at least the equivalent functionality as the other custom component I’ll gladly switch over.

I don’t think that’s a concern until/unless you decide you want to try to get your component integrated into HA. I’ve never tried but I’ve heard that is a pretty steep hill to climb so a lot of custom components stay that way.

That SDK is not maintained by NOAA, but by an employee of The Weather Company / The Weather Channel.

I am not sure if that affects your decision choice.

I am curious if anyone has suggestions on how i should split up multiple alerts. I am pondering the idea of creating separate numbered attributes for multiple alerts. Then it would be sorted by severity.
Is this a good idea or a terrible one?

I’m not following what you mean so I guess I would have to see the end result to really know.

If there are 2 events, see second set of highlights. That’s what i have it doing now, it also sorts it by urgency and severity, so most urgent then most severe will be first.

Do you have any plans to update this for 0.92? It fails the config check now due to a missing manifest.json file.

Edit: I just went ahead and created my own manifest.json in /custom_components/noaa_alerts/

{
    "domain": "https://github.com/dcshoecomp/HA_noaa_alerts",
    "name": "NOAA Alerts",
    "documentation": "https://github.com/dcshoecomp/HA_noaa_alerts",
    "dependencies": [],
    "codeowners": ["@dcshoecomp"],
    "requirements": []
  }

I think I got everything right, but regardless, it doesn’t throw an error when I run Check Config now

Yeah I had to make manifest.jsons for all my custom components last night. Glad you got it solved for the moment.

running 93.1 and can’t get this to show up as a sensor.
Did this get updated to work after the great migration?

I added a manifest.json file that needs to be in the same folder as sensor.py
I am running .93.2 and it works with the included json file

I am trying to install under hassio .94 any guidance as per the sdk placement and install would be a help many thanks
also any thought about supporting multi zones

I was just trying this again and I also noticed the line talking about the noaa-sdk…Do we need to add this to HA too? Didn’t seem like it in the readme.
Also just to be clear we are copying and placing the folder “noaa_alerts” not “noaa_alerts-master” under /config/custom_components/ right?
Error I’m seeing

2019-06-06 17:05:49 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform noaa_alerts
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/noaa_alerts/sensor.py", line 50, in setup_platform
    add_devices([noaa_alertsSensor(zoneid, event_urgency, event_severity, latitude, longitude)])
  File "/config/custom_components/noaa_alerts/sensor.py", line 78, in __init__
    self.update()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/noaa_alerts/sensor.py", line 81, in update
    from noaa_sdk import noaa
ModuleNotFoundError: No module named 'noaa_sdk'

no module named noaa_sdk, thats intresting. I will look into a little more. I don’t seem to have any issues at the moment.

I am having the same issue and error that is why I asked about the sdk many thanks regards

From my understanding i thought HA will import libraries required from pypi.


How are you guys running this Raspi? Docker? HASSio?
Sorry i don’t have a quick answer, this is one of my first things ever built for HA and python.

They will, if the manifest & init files are properly set up I have not yet tried this component, though.

manifest.json needs to include the package in requirements now:

{
  "domain": "noaa_alerts",
  "name": "NOAA Alerts",
  "documentation": "https://github.com/dcshoecomp/noaa_alerts",
  "dependencies": [],
  "codeowners": ["@dcshoecomp"],
  "requirements": ["noaa_sdk"]
}

BTW, did you see my comment on my old PR? Did you mean to revert those changes when you added manifest.json to the repo?

Yeah i see that now. I must have screwed up and reverted those changes. DOH!