here is the entity with its attributes in the states page:
the entity doesn’t expose the “alerts” attribute.
However, this has helped me figure out a couple of things…
First, and most importantly, I didn’t realize until your last post that “properly formatted json” includes whitespace (newlines, spaces, tabs).
Second, I had no idea what the json.dumps() did.
Putting those two pieces of info together I was able to change component code to get a truly properly formatted json string in the “alert” attribute. And now I can access the desired values using the nethods above like I expected to.
Here is the bit of code I changed (the last line):
try:
nws = noaa.NOAA().alerts(active=1, **params)
nwsalerts = nws['features']
self._attributes = {}
self._state = len(nwsalerts)
if self._state > 0:
nwsalerts = sorted(nwsalerts, key=sortedbyurgencyandseverity)
self._attributes['urgency'] = nwsalerts[0]['properties']['urgency']
self._attributes['event_type'] = nwsalerts[0]['properties']['event']
self._attributes['event_severity'] = nwsalerts[0]['properties']['severity']
self._attributes['description'] = nwsalerts[0]['properties']['description']
self._attributes['headline'] = nwsalerts[0]['properties']['headline']
self._attributes['instruction'] = nwsalerts[0]['properties']['instruction']
self._attributes['alerts'] = nws
and the result:
Time to submit a PR to the code.
Thanks for the help!