[RELEASE] Precipitation and Weather Monitor for National Weather Service Data (USA Only)

I was unable to find a good source of precipitation data within Hubitat that did not require a subscription or a key of some kind so I wrote my own. This driver uses the hourly reports from the thousands of airports around the US (link) collated by the NWS to extract precipitation and other weather related data for a specified location.

So, for those that live close enough to an airport where that precipitation number is generally a reasonable estimate for the rainfall at your home and you want to integrate some logic with your sprinkler\irrigation system then this driver could prove quite useful to you.

This is how the raw NWS data looks for the Minneapolis St. Paul Airport - KMSP.

This is how the data looks for Albany, NY - KALB once it has been processed by the driver. I chose to use Albany because they have had some precipitation there in the last 24 hours.

Current States
These reflect the most recent data or an average over a period as described below.
Day - Day of month for last reported record
Time - Time of day for last reported record
NewestRecord - R-??? where ??? is the hour of the month.

Dewpoint - last reported
Humidity - last reported
Humidity24HrAvg - the 24 hour rolling average humidity
Pressure - last reported
Temperature - last reported
Temperature24HrAvg - the 24 hour rolling average temperature
Wind - last reported

Precipitation
Precip1Hr - Total precipitation received in the last hour.
Precip3Hr - Total precipitation received in the last 3 hours.
Precip6Hr - Total precipitation received in the last 6 hours.
Precip12Hr - Total precipitation received in the last 12 hours.
Precip24Hr - Total precipitation received in the last 24 hours.

Precip-Today - Precipitation received so far in the current calendar day.
Precip-Yesterday - Total precipitation received in the prior calendar day.
Today and Yesterday make it easy to reference precipitation data in rules vs using specific days of the week.
Precip-?????day - Precipitation received for a specific day of the week. These attributes are populated as new information is received and most likely to be useful for human consumption. In the above case Precip-Yesterday and Precip-Monday are the same because yesterday was Monday.

Note: Additional attributes may be displayed if the settings are adjusted but are informational only and not used in any internal calculations.

Settings

  • 4 digit ICAO Airport code always begins with the letter K in the USA. So the code becomes K followed by your normal 3 digit airport code such as KMSP, KATL, KALB etc. The ultimate URL looks like this: 'National Weather Service : Observed Weather for past 3 Days : Albany International Airport'

  • Data Retention Period in Hours. The NWS posts new data hourly and maintains a rolling 3 days of history (72 records). You can choose to keep anywhere between 2 days and 7 days or records as you may wish. Note that the precipitation data for past days of the week will be retained regardless of the amount of data retained. Unfortunately Hubitat does not sort State Variables and enquiries to have this addressed have been ignored so the retention of a lot of data has little value as it is hard to visually process.

  • The Watering Threshold in Inches. The driver incorporates a water sensor capability which is used to indicate the state of the ground. If the Precip24hr is less than the watering threshold then the water sensor will be set to dry (indicating the ground is dry). If the Precip24hr is greater than the watering threshold then the water sensor will be set to wet (indicating the ground is wet.

  • The time at which the watering threshold should be checked. The value of Precip24Hr is evaluated once daily against the watering threshold. Normally this would be performed an hour or two prior to running a sprinkler or irrigation system. This lets you select the time at which this calculation is performed.

  • Poll Frequency. The frequency at which the website should be checked for new data. NWS posts new data once per hour. If a poll is missed the subsequent poll will fill in any prior missed records.

  • The amount of detail to record and display. Allows the user to select between three levels of data. as described.

  • The amount of data to send to the log. This is only used for debugging purposes and should left at the default value.

Final Thoughts
I could base my decision on whether to run my sprinklers at 6:00 AM upon the uncertain weather forecast for later today. Or I could ask, did it rain sufficiently yesterday that I do not need to water today. The latter approach removes the inherent uncertainty of weather and is the logical approach that this driver enables.

I have included a Temperature24HrAvg and Humidity24Avg which represent the rolling 24 hour averages of those numbers. Both of these numbers are significant (among others) in determining the watering need but I don't have a good algorithm at this point. Some people may wish to use rules to incorporate these value into their sprinkler operations.

I will endeavor to keep this driver current and bug free so if you find an issue please let me know. Also, I will update this post with any important changes that may occur.

Code Location
The code for the driver can be found here.
The app is also now available in HPM using the Weather or Irrigation keywords.

9 Likes

This is of keen interest to me. I have been using the Weather Dot Gov driver which the author has announced that they will no longer maintain. In verbose mode your driver gives me what I need to determine if it's appropriate to extend my automated awning: Weather Conditions and wind. Thank you! I know that screen scraping is tricky to maintain especially with a government website... Would love this to be in HPM, but have added it manually for now. THANKS!

1 Like

It is now in HPM.

That's great news. I was unable to find it. Searched for NWS, Milne. Did a "Match" on HPM. Is there a trick here I'm unaware of?

I never find the search function works well in HPM. You can find it under tags for weather and irrigation.

I tried to install it from HPM and it gave an error, but it might just be my environment. Let me know if you try it.

BTW, been working very well for me. No issues so far.

Agree that your driver is working GREAT. However, I think the HPM integration is incorrect. I've never had problems doing searches to find things. And in this case, I want to use the HPM MATCH function so it "takes over" managing updates for your driver. I've tried multiple times and HPM doesn't think they match. Perhaps @csteele would be willing to give you a hand making sure that the HPM package is correct?

Screen Shot 2022-09-28 at 7.12.00 AM

Screen Shot 2022-09-28 at 7.13.02 AM

My conclusion... HPM Search is working fine.

Regarding an install....

Screen Shot 2022-09-28 at 7.13.34 AM

Results in an Error:

The error clearly says that the App at that URL failed to install. When I try it manually, I get the following:

Screen Shot 2022-09-28 at 7.15.11 AM

I'd suggest reviewing both Manifests for category errors. :smiley:

Screen Shot 2022-09-28 at 7.21.35 AM

I don't think "apps": is right and since there's only ONE piece of code to install, why "required": false, ?? Shouldn't it be true and thus skip the step of picking the one and only option?

Thanks for looking into this. Would this explain why “Match Up” doesn’t work?

Yes. You've manually installed it as a driver (correctly) but matchup is still looking in Apps Code for it... and of course, not finding it there.

1 Like

That's good. I only made that prior comment because it did not used to find my Tasmota Sync drivers when using the search phrase "tasmota" so I would steer people to the tags.

Even now, on one of my hubs if I do a search using a keyword for "Precip" it finds my code, but on the other it does not. Neither HPM shows that it needs to be updated. Not asking for any action on your part, just something I have to fix.

The error was that I had it identified as an app, when it should have been a driver. It all seems to be working now.

Thanks for your attentiveness.

Yes, I have re-published the app with a slightly different name so I don't know if match-up will work or not. If it does not match up just install the new one from HPM and switch your device to using the new driver and you should be set.

This is great news. I love the way you have implemented this.

Is it entirely outside the scope of your project to provide forecast parameters, e.g. precip in the next 24/48 hours?

Yes, I would say so. My approach was to make watering decisions on what I know happened vs what might possibly happen. There are multiple weather apps out there but precip info was lacking IMO which was largely why I wrote this and went the other way, looking at history vs future.

Glad you like it. Let me know if you find any predictive precip info. I’d be curious to see it.

Really cool! Would it be possible to add a "last 7 days" precipitation total? I'm just thinking about the use case of my garden where in that case watering guidance is in "inches per week" so it would be nice to once a week just toss out a notification to water if the total isn't enough. As I'm writing this I guess could just grab the precip-XXXX day #s and add it up and get to the same place so feel free to tell me to pound sand :slight_smile: .

Thanks, glad that you like it.

Yes, I think that would be a good add for the reasons that you point out. Of course it will be inaccurate until you have 7 days of history (Monday - Sunday populated) but it's a set and forget driver so it should not be an issue for long. So I will add it in due course.

Do I read it correctly that you don't have an in ground sprinkler system and are using this to alert you to water manually? That is a use case I had not considered but it makes a lot of sense.

Correct. Right now I look out at our herb planter and if things are drooping I water (which honestly is a bit too late as that's stressing those plants, lol) and our garden probably doesn't need as much attention but it wouldn't hurt to know and perhaps add some consistency to their lives.

Thanks Gary. I'm all switched over to your updated driver. Installed from HPM and deleted the old one. All is working. Thanks again. Delayed feedback due to travel...

1 Like

Download the Hubitat app