Severe Weather Alerts from the US National Weather Service

Check your /custom_components/nws_alerts folder and make sure you have the following files:

__init__.py
sensor.py

and a folder:

__pycache__

which should have the files:

__init__.cpython-37.pyc
sensor.cpython-37.pyc

I don’t see the pycache folder or the 2 files. Do I need to create them? On 0.91 it was working fine.

I did add the custom component/sensor.feedparser and the invalid config error went away. I assume that is what was needed even though I never had that previously and I didn’t see it being required for the nws_alert.

I think the pycache folder and files will be created for you.

no. it’s not necessary.

i said as much in my post right above yours. :wink:

But if you just copied the complete package from the github then you need it installed because the config is included in the package.

I think i’ll remove it from the package so it causes less confusion.

when i add the sensor like in the example:

sensor:
  - platform: nws
    zones:
      - COZ240
      - COZ040
      - COC005

(only using my areas)

i get an error when i do the config check:

Integration nws not found when trying to verify its sensor platform.

I do not see any platform: nws used in this thread either.

Please read how to post for help.

that’s in interesting reply. but considering it pertains to this custom component i put it here…
here is a link to the custom component that seems to be referenced above

I searched this thread for that platform and only found platform: nws_alerts

I see that component was last updated a month ago. There have been several changes that could break custom components that have not been updated.

have you changed the way you installed the component based on the requirements of “The Great Migration”?

the component needs to be in the following directory/file:

/config/custom_component/nws_alerts/sensor.py

you will copy the “raw” code from the eracknaphobia github repository for the nws_alert sensor and place the code into the above “sensor.py” file.

you also need to create an empty "__init__.py" file in that same directory (two underscores before & after init).

restart HA and it (hopefully…) will work.

yes, i did that before… and it was working, but since upgrading to 0.92.1 it’s now broken. so i checked the documentation. that documentation i linked no longer has:
/config/custom_components/nws_alerts/

it shows:
/config/custom_components/nws/

so that is now how i have it. if the link i provided is the incorrect component, maybe someone could link me the correct one and i can follow the directions for it so update mine

yes that is a completely different component than the one i’m using for this.

i’ve linked to the correct custom component upthread and in my gist with the instructions for this. but here it is again:

1 Like

that fixed my issue. thank you so much!

1 Like

Thanks for the awesome work on this!

I’m using 0.92.2 and noticed the below in my event log:
Error during template condition: UndefinedError: 'dict object' has no attribute 'to_state'

I’ve narrowed it down to the automation for ‘NWS Weather Alert Pop Up Control’.

Any idea’s on how why it’s popping up?

did you happen to have an active weather alert when you restarted HA the last time before the error popped up?

Yes. That would be correct. We’ve had a ton of alerts here in North Texas the last few days.

I’m not really sure but i think it might have been because there was no “to_state” because the trigger was already in the state that should have caused the to_state to begin with. :crazy_face:

Is everything working otherwise beside that one error?

The weathers calmed down some around here, so I haven’t seen any new alerts. As far as I can tell, everything else seems to be working.

Hopefully it was just a glitch from having the alerts already active when you restarted HA. I’ll guess we’ll see on the next alerts. Hopefully there won’t be a time to test it. Good luck on the weather!

1 Like

can anyone share an example of a working config with the notify.alexa_media service working with the custom component. the custom component works flawlessly. I’m having issue with all the automations working. the code in the gist of finity doesn’t work for me at all. I can see part of the announce automation is working as i get a beep on my alexa devices and the volume level goes up like the automation calls for, but it doesn’t broadcast the alert info. and the pushbullet automation just shows a title of alert withno description. any help would be welcome

let’s take the easy one first…

that’s exactly what it’s supposed to do.

- service: notify.pushbullet_notify
  data_template:
    message: >
      {% if states.sensor.nws_alerts.attributes.title.split(' - ')[5] is defined %}
        "NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[5] }}"

that code only sends the title of the alert (…title…) to your pushbullet. You can modify it to send the description if you want. just change “title” to “display_desc”.

as far as the announcement…

can you otherwise get announcements to work outside of my code?

If you go to the services area and select the “notify.alexa_media” service and put in the following (substituting your echo entity_id) does it work?:

{
“message”:“test”,
“title”:“My title for Echo show”,
“data”:{“type”:“announce”, “method”:“all”},
“target”:“media_player.computer_room_dot”
}