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.