custom-components / weatheralerts

A sensor that gives you weather alerts from alerts.weather.gov.
MIT License
126 stars 15 forks source link

NULL values #64

Closed mjnovotny82 closed 2 years ago

mjnovotny82 commented 2 years ago

Version of the custom_component 0.1.5

Describe the bug null values are being generated for alert_NWSheadline and at the end of spoken_title variables. This is not occurring for all weather alerts. I'm not seeing anything immediate that would be causing the null value

Log Nothing is being writing in the HA log files.

Attached are the api json file from https://api.weather.gov/alerts/active?zone=WIZ060,WIC089 and the HA generated sensor.weatheralerts_1alert# variables. The nulls are in the second alert file.

WIZ060_WIC089.json.txt sensor.weatheralerts_1_alert_1.txt sensor.weatheralerts_1_alert_2.txt

mjnovotny82 commented 2 years ago

It looks like the NWSheadline value is not specified in the PARAMETERS array from NWS.

This is generated from python.py line 174 "NWSheadline": properties["parameters"].get("NWSheadline", "null"), . In this case, the alert title is a Special Weather Statement but doesn't list exactly why for the fog in the PARAMETERS array. This happened over the weekend too when the heat advisory was issued but it is not giving the null values anymore for that alert.

mjnovotny82 commented 2 years ago

NWS just updated the alerts - heat advisory, dense fog, and the special weather statement (for the fog). The third alert is still missing the NWSheadline variable and is causing the null values.

WIZ060_WIC089-3alerts.json.txt sensor.weatheralerts_1_alert_1.txt sensor.weatheralerts_1_alert_2.txt sensor.weatheralerts_1_alert_3.txt

mjnovotny82 commented 2 years ago

Resolved by modifying my weatheralerts.yaml file - attached. Please note that this has personalized customizations.

weatheralerts.yaml.txt

jlverhagen commented 2 years ago

Sorry, I forgot to respond to this issue. Thanks for bringing this to my attention! In the next release I will check if properties[parameters][NWSHeadline] exists and fallback to the properties[headline] value for NWSHeadline if it does not exist in the alert feed.