custom-components / weatheralerts

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

Add additional alert properties #33

Closed claytonjn closed 4 years ago

claytonjn commented 4 years ago

Is your feature request related to a problem? Please describe. I would like additional properties exposed - effective, expires, and NWSheadline.

Describe the solution you'd like I can submit a PR, but I'd like to know which option below you'd prefer.

Describe alternatives you've considered

  1. I can add these three properties to each of the alerts objects.
  2. The full properties object could be pushed to the alerts object.

They're both minor changes and I tested both without issues. I personally think option 2 would be better because it doesn't limit anything from the end-user, however it would be a breaking change - area would become areaDesc, and title would go away (from my limited testing the "generated" title seems to be the same as event).

Additional context ends is None in my testing, but expires does have a datetime. NWSheadline is perfect for a broadcast message because it's a good concise description of the alert that won't get truncated.

jlverhagen commented 4 years ago

I've got a pull request started here: https://github.com/custom-components/weatheralerts/pull/29

that adds those additional properties. It also allows zone or county ID number to be specified and later today I'll push a commit that adds PlatformNotReady to allow the component to retry the setup if weather.gov request fails during the first setup try.

jlverhagen commented 4 years ago

The latest release of weatheralerts contains several additional alert properties. The full list:

sensor attribute alert property
area areaDesc
certainty certainty
description description
ends ends
event event
instruction instruction
response response
sent sent
severity severity
title headline (everything before ' by ')
urgency urgency
NWSheadline parameters:NWSheadline
effective effective
expires expires
onset onset
status status
messageType messageType
category category
sender sender
senderName senderName
id id
zoneid feedid (passed to alert api URL)

I kept 'area' instead of renaming it to 'areaDesc' so it wouldn't break any existing configurations. I changed 'title' to add the issued date and time. If that isn't desired, 'event' can be used instead of 'title'. The 'zoneid' is set to equal the full 6 character zone ID or a comma separated list of the 6 character zone and county ID's that are passed to the weather.gov alert api URL.

I didn't think any of the other alert properties were particularly useful. If you disagree, feel free to comment on which additional properties you think would be useful and I'll get them in there.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.