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

You have to add a custom repo in the Settings screen.
From my experience, make sure you have “github” not “GitHub” - it gives me errors when there area caps.

https://hacs.netlify.com/usage/settings/#add-custom-repositories

Cheers!
DeadEnd

1 Like

Any way to change the “0” to something like “No Alerts” when you use it as a card?

I think I can make that happen.

Awesome it would look better on a card setup.

I’d be really careful with that change, it could have unexpected consequences for users who have automations that trigger based on the state…seems like a rather large breaking change for a relatively obscure cosmetic improvement. Just my $0.02

EDIT: @gdreelin, maybe a better solution would be for you to use a template for the frontend card to make it show “No Alerts” when the state is 0. That way each user can have it say whatever they want.

Sounds like a plan too whatever seem easier. Can share an example of what you are saying? Kind of new to templates. Thanks for great idea.

Yeah I am going to try and not make it a breaking change. Like an option to enable it.

You’d have to add the custom lovelace card here to be able to use templates in the lovelace frontend (in this case you would use the state_template option. The template is pretty simple, it would look something like this:

{% if is_state("sensor.noaa_alerts", "0") -%}
  No Alerts
{%- else -%}
  {{ states("sensor.noaa_alerts") }}
{%- endif %}

If you don’t want to use a custom card you could use a template sensor to accomplish the same thing, you’d then have the regular sensor.noaa_alerts and your “formatted” sensor with whatever entity id you create in the template sensor.

Of course, this is all moot if @dcshoecomp add the option as a configuration parameter.

Ah thanks for that.

@gdreelin So after a little review i probably got a little ahead of myself by thinking that would be a good idea to change the state via option. It seems the best options is really to use the custom card with state_template option as suggested by @clayonjn. I say this because inherently the way the states are treated by my code is using the state as an integer, thus if the integer state is now a text, it will require reworking of the attribute if statements.
Let us know how the custom cards are working for you.

Yeah I agree don’t need to redo it all for cosmetic stuff.

We just had an alert but it shows on the card as a “1” then if you click it, it shows you the alert. Does it do that for all alerts? I would think it would show you the type of alert, warning, watch, advisory?

The state number is the number of active alerts. Technically all the alerts will be in the attributes. However the easy to read attributes will show the most urgent/severe alert.

1 Like

Is this still working or am I missing something?

I’ve followed the setup and Check Configuration says:
Platform error sensor.noaa_alerts - No module named ‘noaa_sdk’

1. yaml config =
sensor:

  • platform: noaa_alerts
    zoneid: MNZ078
    zoneid: MNZ092

2. Created a folder: custom_configurations/noaa_alerts

3. Installed in the folder the 3 files below:

image

Did you import the files to your homeassistant custom directory? if you don’t know what i mean your best bet is to add the integration HACS aka Home Assistant Community Store. Then after that is loaded go into the “community” on the left menu and add the custom repository https://github.com/dcshoecomp/noaa_alerts

Working now. Thank you