finity69x2 / nws_alerts

An updated version of the nws_alerts custom integration for Home Assistant
86 stars 29 forks source link

Feature Request: Expose "severity" an an attribute #30

Closed rct closed 2 years ago

rct commented 2 years ago

Currently there is a severity in the display_desc text. It would be useful to have severity broken out as an attribute, similar to message_type and event_status.

This would be to enable automations to behave differently for Minor vs. Critical or Extreme severity.

In the alert response, severity shows up as one of the properties, see below.

There may be other fields that would be useful in determining how to handle and/or present alerts like certainty, urgency, and response, but I don't know enough yet/have enough experience.

Is there any current significance to the order of alerts?

Right now, the my first alert is Minor severity while the next two are Extreme.

If Severity was exposed as an attribute, I'd be expecting to see Minor - Extreme - Extreme that could be split the same way title, message_type, and event_status.

    "properties": {
        "@id": "https://api.weather.gov/alerts/urn:oid:2.49.0.1.840.0.3196c222a05cacdfbc32bebf8f2fdd3eb24e93c2.001.2",
        "@type": "wx:Alert",
        "id": "urn:oid:2.49.0.1.840.0.3196c222a05cacdfbc32bebf8f2fdd3eb24e93c2.001.2",
        "areaDesc": "Northern New London; Southern New London; Northeast Suffolk; Southeast Suffolk",
        "geocode": { ... },  
        "affectedZones": [
            "https://api.weather.gov/zones/forecast/CTZ008",
            "https://api.weather.gov/zones/forecast/CTZ012",
            "https://api.weather.gov/zones/forecast/NYZ079",
            "https://api.weather.gov/zones/forecast/NYZ081"
        ],
        "references": [],
        "sent": "2022-01-28T09:59:00-05:00",
        "effective": "2022-01-28T09:59:00-05:00",
        "onset": "2022-01-28T19:00:00-05:00",
        "expires": "2022-01-28T17:00:00-05:00",
        "ends": "2022-01-29T19:00:00-05:00",
        "status": "Actual",
        "messageType": "Alert",
        "category": "Met",
        "severity": "Extreme",
        "certainty": "Likely",
        "urgency": "Expected",
        "event": "Blizzard Warning",
        "sender": "w-nws.webmaster@noaa.gov",
        "senderName": "NWS Upton NY",
        "headline": "Blizzard Warning issued January 28 at 9:59AM EST until January 29 at 7:00PM EST by NWS Upton NY",
finity69x2 commented 2 years ago

Done.

It's published but might take a bit to show up in HACS.

Thanks again.