[RELEASE] Weather-Display With OWM-Alerts Forecast Driver

[UPDATED]
V0.0.8
09/08/2020

Changes:

PLEASE NOTE : after any update of the driver code, even if you use Hubitat Package Manager, you should open the virtual device, click 'Save Device', then click 'Save Preferences'.

CURRENT STATUS OF ALERTS

There are issues with the weather.gov alert API. All seems to work as expected when there is an actual current alert. However, if there are no current alert, the API is not returning a valid response.

The expected response to a 'no current alerts' condition would be a valid response to the poll with a 'null' for the current alert ('event'). When that condition is detected the code responds with 'There are no current weather alerts'. However, because there is no valid response, the code responds to that condition with a response of 'Weather alerts are not available'.

This same code use to work, so something must have changed on the weather.gov API side. I have no workaround for now. Hopefully the weather.gov site will get corrected. If not, at least for now, valid alerts do appear to show correctly, but 'Weather alerts are not available' may mean either that the weather.gov site is down or busy so alerts are not available, or, that the site is available and there are no current alerts. I have no way to distinguish between the two conditions as it is now.

UPDATE: I sent a note to weather.gov ......

Their response was

"There is some maintenance that is going on this time. Your patience is
appreciated. No estimated time of return of service is known.

Again sorry for the issue."

You can always turn off alerts and alert tiles if that is objectionable.

[UPDATED]
V0.0.9
09/08/2020

Changes:

There is a known issue with the weather.gov API at this time. It does not return a vald response when there are no alerts, so the driver will return a 'Weather alerts are not available' when this condition exists. Their reponse was: "There is some maintenance that is going on this time. Your patience is
appreciated. No estimated time of return of service is known."

PLEASE NOTE : after any update of the driver code, even if you use Hubitat Package Manager, you should open the virtual device, click 'Save Device', then click 'Save Preferences'.

1 Like

[UPDATED]
v0.1.0
09/12/2020

Changes:
Significant code refactoring by @nh.schottfam (Thanks!). Goals where to:

  • remove database accesses from the weather driver, as these do cause a lot of memory and JVM (Java Virtual Machine) resources consumption on HE.
  • Removed a lot of string creation done by the JVM. This is avoiding the creation of so many string constants for comparison.
  • Fixed some issues in variable mis-spellings
  • Cleanup of dead code based on analysis by IntelliJ.

Redisigned the threedayfcstTile, inspired by @pmasl77.
image

Other than the threedayfcstTile there are no changes to features or functions.

There is a known issue with the weather.gov API at this time. It does not return a vald response when there are no alerts, so the driver will return a 'Weather alerts are not available' when this condition exists. Their reponse was: " There is some maintenance that is going on this time. Your patience is appreciated. No estimated time of return of service is known. "

PLEASE NOTE : after any update of the driver code, even if you use Hubitat Package Manager, you should open the virtual device, click 'Save Device', then click 'Save Preferences'.

[UPDATED]
v0.1.1
09/14/2020

Changes:
Re-worked how the api.weather.gov poll works to remove dependency on it returning a valid response code. It will now report 'No current weather alerts' if there are no alerts returned in the poll, even without a valid response code of 200 (OK).

UPDATED again at 5:00 PM EDT for a minor parentheses correction (thanks @nh.schottfam). That should not cause any errors, but it may change the logic. I did NOT increment the version. If you pulled the code prior to 5:00 EDT on 9/14/2020 you should pull it again.

[UPDATED]
v0.1.2
09/16/2020

Changes:
Removing 'severity' and 'certainty' restrictions from alerts poll. This was excluding some 'minor' and 'unlikely' alerts. Now the only alerts that are excluded are 'past' alerts.

[UPDATED]
v0.1.3
09/21/2020

Changes:
Added forecast High/Low temp attributes for tomorrow (forecastHigh+1/forecastLow+1) and day-after-tomorrow (forecastHigh+2/forecastLow+2)

image

[UPDATED]
v0.1.4
09/22/2020

Changes:
Added forecast icon url attributes for tomorrow (condition_icon_url1) and day-after-tomorrow (condition_icon_url2).

[UPDATED]
v0.1.5
09/23/2020

Changes:
Removed 'urgency' restriction from weather.gov alert API poll. It was preventing some alerts from being shown.

[UPDATED]
v0.1.6
09/24/2020

Changes:
Code optimization: More string constant optimizations, and removal of white space characters (by @nh.schottfam)

There were no functional changes.

[UPDATED]
v0.1.7
09/27/2020

Changes:
Fix to allow for use of multiple virtual devices, More string constant optimizations (by @nh.schottfam)

[UPDATED]
v0.1.8
09/27/2020

Changes:
Bug fix preventing polling I introduced in V0.1.7

1 Like

Thanks for the fix, I wasn't getting much love with that v.0.1.7 update!

1 Like

[UPDATED]
v0.1.9
10/02/2020

Changes:
More string constant optimizations (by @nh.schottfam)

[UPDATED]
v0.2.0
10/07/2020

Changes:
Change to use asynchttp for NWS alerts (by @nh.schottfam).

[UPDATED]
v0.2.1
10/19/2020

Changes:
Added forecast 'Morn', 'Day', 'Eve' and 'Night' temperatures for current day and tomorrow.
image

You must have the Optional Attribute of 'Forecast High/Low Temperatures' selected for these to show up.
image

[UPDATED]
v0.2.2
10/20/2020

Changes:

  • Now pulls weather alerts from OpenWeatherMap instead of weather.gov.
  • Various cleanups and bug fixes (from @nh.schottfam, Thanks!)

OpenWeatherMap now provides " Government weather alerts data from major national weather warning systems" This driver now uses that as the source for all weather alerts. This means that alerts are no longer exclusive the the United States. For the list of all sources that OWM claims is uses look here.

At this time only the first alert is shown, even if there are multiple alerts. I will look into displaying more than one alert if those exist in a future release.

Additional attributes available include:
alertDescr = The first 1,024 characters of the detailed alert description.
alertSender = The source of the alert.

[UPDATED]
v0.2.3
10/20/2020

Changes:
Corrected some Tile displays

[UPDATED]
v0.2.4
10/21/2020

Changes:
Updated URLs in the dashboard tile hyperlinks to take you to a OWM location specific page for details, including any weather alerts. (Thanks @arnb)

Thank you Matthew! That works perfectly on platforms and browsers supporting geolocation, including: Chrome on Windows, Firefox on Windows.

However, some platforms I'm using, Fully Kiosk Browser on Android and Amazon Fire OS (for my Dashboards), and Vivaldi on Windows, have geolocation issues and always show London, UK until the location is set manually, then the site stores the city code and units information in cookies and it works the next time entered.

To get the correct city it must be entered as cityname, 2digit country code
Here in the US, state code is not included with the results. This is problematic when the search returns numerous results.

Not much you can do about this, just letting people know.

1 Like