OpenWeatherMap-Alerts-Weather-Driver

[UPDATED]
v0.5.0
12/08/2020

Changes:

  • Bug fix for 'forecast_text1' and 'forecast_text2' optional attributes.

These two optional attributes were not updating/showing unless the 'Forecast High/Low Temperatures' was selected. This has been corrected to update/show when then 'Forecast Text' option is selected.

Wow. That was fast :slight_smile:

Never looked at it. The volume of data returned, even at every three hours, far exceeds what would be utilized by almost all users of the driver. Everyone has their own use case, so trying to either accomodate 'cherry picking' of what data elements to expose, or exposing all the available data elements, in the driver would greatly expand the complexity/difficulty and inefficiency of the driver. That is not something I am going to attempt to do.

Thanks.

Makes total sense. thanks!

Hello there,
After much searching, I have not found any installation instructions. After adding the code to the drivers, I created a virtual device with the "OpenWeatherMap" type. While this seems to work, I have none of the optional attributes under the device to select. I had them when I used the DarkSky driver, but now they are not part of this device. Please let me know what step I am missing. Thanks in advance!

Sounds like you selected the integrated OpenWeatherMap system driver and not this custom driver. When you select the driver for your virtual device, make sure you scroll to the bottom where the 'User' drivers are and select the 'OpenWeatherMap-Alerts Weather Driver'.

1 Like

Thanks! That certainly did it.

I have tried specifying the language in the API as you suggested, it did not work. I was able to construct a call from by browser showing the problem. I have opened a ticket with OWM. We'll see what happens.

[UPDATED]
v0.5.1
12/12/2020

Changes:

  • Changes to dahboard tiles logo/hyperlinks when using weather.gov for alerts and there is an alert.

In order to save characters (and reduce the likelihood of needed to remove icons because of exceeding the 1,024 tile character limitation), I have removed the hyperlink on the alert message on myTile. The hyperlink on the weather source on the bottom line will remain.

Also, if you have selected weather.gov as your weather alert source, AND there is a current weather alert, the logo and hyperlink on the myTile and threedayfcstTile dashboard tiles will be for weather.gov's site. Otherwise, including if you have selected weather.gov for your weather alert source and there are no current alerts, they will have the logo and hyperlink for OWM's site.

[solved] - I had to go to the dashboard app and add in the device to the 'allow access' list.

I must be missing something simple. I successfully added the virtual driver, API key, and location. I see the data getting polled inside the driver. But when I go to the dashboard and add a tile there is no OpenWeatherMap device in the Device List. How do I get it to populate the device list so I can use it to build a tile?

?? When you created the dashboard, did you select your virtual driver as one of the devices? If it is not selected, it will not show in the available list when you go to add a tile.

Hi @Matthew any idea what causes a null +null?
Everything else looks good.

Thanks

I have not seen that before? Could you PM me your lat/lon coordinates and I'll test it to see if I can replicate it?

Thank you @Matthew, opening the virtual device and clicking 'Save preferences' fixed it as you suggested.

Snow issue?

The OWM API reports snow in mm that is properly converted to inches. However my local forecast currently calls for perhaps 12 to 18 inches of snow in the next two days, while the Three Day tile shows .64in and 1.04in for the next two days. Perhaps that forecast is for "melted snow"?

Any chance for converting the OWM snow value to estimated snow inches or cm?

from Old Farmers Almanac
This varies depending on the type of snow, but to make 1 inch of water (rain), you need 10 inches of average snow, 4 to 5 inches of wet snow, or 15 inches of powdery snow.

image

The driver does add together the forecasted 'rain' + the forecasted 'snow' as 'Precip' as presented by OWM. I suggest you request that OWM report as you have suggested, then the driver will pick that up. If OWM would report the snow accumulation in the 'snow' field from the API, the driver will pick it up. As you suggested, it does look like they report the 'melted' precipitation measurement instead.

As your Old Farmers Almanac suggests, the 'conversion' factors from rain to snow is quite a large range and will vary based on many local conditions. That 1" of precipitation forecasted for Thursday could range from 4 to 15 inches of snow according to it. I have no plans to attempt to codify such a complex and subjective conversion factor selection. It will be wrong at least as often as it is right, if not more.

Thanks.

For what it's worth, I filed an OWM support request.

Meanwhile, multiplying the Imperial snow amount value by 10 gives a rough good enough for me estimate in inches, and I plan adjusting my local code version to do that on the 3day tile when precip is from the snow vs rain. Just have to somehow handle a day with both snow and rain.

Update: I'm planning to append the Precip amount with an S for snow, and leave Rain as is. When both occur on same day insert a <br> html string between the values amounts. None remains the same.

That could be easily done. In the current code the current day 'precip' forecast measurement is on line 523. It adds together both the rain and the snow amounts. You could multiply just the snow amount by 10. So change:
BigDecimal t_p0 = (owmDaily==null || !owmDaily[0]?.rain ? 0.00 : owmDaily[0].rain.toBigDecimal()) + (owmDaily==null || !owmDaily[0]?.snow ? 0.00 : owmDaily[0].snow.toBigDecimal())

to:
BigDecimal t_p0 = (owmDaily==null || !owmDaily[0]?.rain ? 0.00 : owmDaily[0].rain.toBigDecimal()) + (owmDaily==null || !owmDaily[0]?.snow ? 0.00 : owmDaily[0].snow.toBigDecimal() * 10)

Tomorrow's 'precip' amount (t_p1) is on line 529 and day-after-tomorrow (t_p2) is on line 530. The same change should be made there too.

Hope that helps.

1 Like

I updated my post at the same time you posted. Appreciate the code locations and suggestions.

Went with your suggestion. Quick and easy. Thank you! Makes more sense to me.
image

1 Like