[PROJECT] Weather Service Monitor 4 Hubitat Driver

Yeah i just built my weather light based on that time. I just split the rules into two sections.

1 Like

Is there anyway to put one or both of the below into an attribute?

2021-05-07 02:40:21.688 pm infoDeVoe PWS - Weather Underground observation data as of Fri May 07 14:40:21 EDT 2021.

dev:3002021-05-07 02:40:21.493 pm infoDeVoe PWS - Weather Underground forecast data as of Fri May 07 14:40:21 EDT 2021.

How about an attribute named "Data as of" with the string value?

I can get that added tonight most likely.

Updated Version(s):

  • WSM4Hubitat.groovy = 0.8.4

Change(s):

  • Added attribute "Data as of" which will pull the current date/time from the Hubitat's Date() function when a successful data response is received. This is NOT the same as the "Updated" attribute which is when the API reports (if it does) what the data is as of. They could be very close though.
  • Changed all ProcessData statements to be ProcessEvent. This will result in no functional difference but it brings this driver more in line with most of my other drivers so should make it a little easier for me to maintain.
  • ProcessState was added, again to make maintaining drivers easier. But since this driver does not actually have any variables that are JUST state variables (all trigger events at this time) it does not currently see any use but could in the future.

That's awesome. My hope is that it's a separate reading from the "Updated" attribute. Then it will only trigger rules when that changes vs. every time it updates. They appear to be the same time, however, so far.

@snell sorry if I'm driving you insane haha.

Any chance these can be added as attributes?

"calendarDayTemperatureMax":[53,49,53,53,62,64],"calendarDayTemperatureMin":[35,37,34,31,34,39],"dayOfWeek":["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday"]

What are these? Is that a 5 day forecast?

"temperatureMax":[53,49,53,53,62,64],"temperatureMin":[37,34,31,34,39,44]

This would be even more of an amazing driver, than it already is, with a 5 day forecast this really looks like a 5 day forecast, broken into day and night, for my location lol.

"validTimeLocal":["2021-05-08T07:00:00-0400","2021-05-09T07:00:00-0400","2021-05-10T07:00:00-0400","2021-05-11T07:00:00-0400","2021-05-12T07:00:00-0400","2021-05-13T07:00:00-0400"],"validTimeUtc":[1620471600,1620558000,1620644400,1620730800,1620817200,1620903600],"daypart":[{"cloudCover":[67,70,96,46,49,30,46,12,9,29,63,55],"dayOrNight":["D","N","D","N","D","N","D","N","D","N","D","N"],"daypartName":["Today","Tonight","Tomorrow","Tomorrow night","Monday","Monday night","Tuesday","Tuesday night","Wednesday","Wednesday night","Thursday","Thursday night"],"iconCode":[28,29,39,29,30,29,30,33,34,33,30,29],"iconCodeExtend":[2800,2900,7103,2900,3000,2900,3000,3300,3400,3300,3000,2900],"narrative":["Mainly cloudy. A few peeks of sunshine possible. High 53F. Winds NW at 10 to 15 mph.","Mostly cloudy skies early, then partly cloudy after midnight. Low 37F. Winds ENE at 5 to 10 mph.","Considerable cloudiness. Occasional rain showers in the afternoon. High 49F. Winds ESE at 5 to 10 mph. Chance of rain 50%.","A few clouds. Low 34F. Winds N at 5 to 10 mph.","Partly cloudy skies in the morning will give way to cloudy skies during the afternoon. High 53F. Winds NW at 10 to 15 mph.","Partly cloudy skies. Low 31F. Winds NW at 10 to 15 mph.","Intervals of clouds and sunshine. High 53F. Winds NW at 10 to 20 mph.","Mostly clear skies. Low 34F. Winds NW at 10 to 15 mph.","Plentiful sunshine. High 61F. Winds NW at 5 to 10 mph.","Generally fair. Low 39F. Winds light and variable.","Intervals of clouds and sunshine in the morning with more clouds for later in the day. High 64F. Winds SW at 5 to 10 mph.","Partly cloudy skies. Low 44F. Winds light and variable."],"precipChance":[1,5,47,22,7,6,6,5,4,4,13,21],"precipType":

How about qcstatus as an attribute? Then you can monitor WU's quality control. I'd love to put the 1 and 0 from it into an excel spread sheet and see if I can figure out how they award and take away the little badge things lol

Other stats from the station? Neighboorhood, heat index, precip type, precip chance, dew point, wind chill, precipitation rate and precipitation total.

14:21:17","neighborhood":"Grand Blanc","softwareType":"myAcuRite","country":"US","solarRadiation":null,"lon":-83.644,"realtimeFrequency":null,"epoch":1620498077,"lat":42.913,"uv":null,"winddir":270,"humidity":44,"qcStatus":1,"imperial":{"temp":51,"heatIndex":51,"dewpt":30,"windChill":51,"windSpeed":2,"windGust":7,"pressure":30.08,"precipRate":0.00,"precipTotal":0.01,"elev":840}}]}

I can work on some of those, especially the current readings. But I had decided originally I was not sure of the value of a 5 day forecast when you get a new one every day, including the forecast for tomorrow. I could not think of any rules (water, temperature, whatever) that could benefit from more than tomorrow. Plus, unless I reworked them all as arrays of data (not as nice to read) it will grow the attribute list by about 3x.

But... I can give it some more thought and am open to being convinced if there are some good use arguments...

Thanks for this. Just a thought on how I could use the 5 day forecast. Over here we have 2 set watering days a week . Generally if there is rain forecasted between the 2 days (which are 2-3 days apart), I would skip the watering day. So far I'm having to manually skip for forecasted rain on the day after tomorrow.

Just to test my understanding...
You plan on watering Monday and Thursday.
You get the 1st forecast Sunday and it says rain tomorrow (Monday), you would skip Monday's watering.
But wouldn't you get a forecast each day (that includes the "tomorrow" at that time) so the Wednesday forecast should tell you if it was going to rain again on Thursday or not.

So any automation you have about watering would know as of Wednesday to water (or not) on Thursday?

Definitely not trying to be difficult, trying to understand the usage.

When I was working from an office I used a 5 day forecast for text notifications. I like to get the next work day weather when I get home from work so I know if its is a day I want to go in the field or not. When I would get home I had rules that would query the next day weather. If it was Friday I would query Monday or Tuesday (if Monday was a holiday). I actually have little use case for a 5 day forecast, since the pandemic hit, but thought it would be cool to have a weather app and my weather station together in one driver lol.

I'm truly interested in the other attributes from my weather station though. At this point I don't have a lot of ideas for those attributes but I love data and I'm sure I can find some use cases for them, especially humidity, wind chill/heat index and dew point, with summer coming, this could prove useful in saving some on my AC. I also really want to see a view of the qcstatus. I already have several ideas for this one. I'll set an alert if it goes to 0 and I want to put the data from it in a spreadsheet and keep track of it lol.

Say watering days are set Monday and Thursday,
For the Monday run, the rule checks whether it is forecasted to Rain on Monday (Today), Tuesday (Tomorrow) or Wednesday (Day after tomorrow) and turns on the rain switch that will skip watering

For the Thursday run, the rule checks whether it is forecasted to Rain on Thursday (Today), Friday (Tomorrow) or Saturday (Day after Tomorrow) and turns on the rain switch that will skip watering

In a sense the full 5 days is not really required. Just maybe up to 2-3 days ahead. Not sure how much a difference that would make in terms of implementation.

Ok... Those responses give me an idea on the desired outcome. I also have a thought on implementation that MIGHT make it a little easier but want to know if it would cause you a lot of trouble.

What if I make a week of child devices, each named for a day of the week. I would populate their attributes with the forecast for that particular day. If they are outside the forecast range, the child would exist but have null values for the attributes.

So if you want to check Tuesday's forecast, you check the Tuesday child.

I would still keep Today and Tomorrow forecast data in the parent, as well as any Current data, for simplicity sake.

I love that idea....

It would make it easier (I think) to code, but I am worried about how easily it would work for Rules.

  1. You would have to check the particular device (corresponding to a particular day) that you want to Rule to check.
  2. You might need to build in a bit of smarts that if the value is null... not to have a problem just realize that there is no forecast for that day yet.

Either way... I can start working on it the next couple evenings and hopefully have something. Worst case, it does not work out quite right and it gets removed and I work on a different method. Not a big deal.

1 Like

sounds great. That would work

Updated Version(s):

Change(s):

  • Added a preference to "Enable Forecast Child Devices?" for US National Weather Service, OpenWeather API, and Weather Underground (I am still working on the other services). By default it is disabled. If you enable it the child devices will be created after saving preferences. Disabling the feature will automatically delete all child devices from the parent. Uninstalling the parent will also delete the child devices. You MUST have the WeatherSensorChild.groovy driver installed if you want to enable this (and have it work properly). If you do not want the child devices, you do not need to add the driver nor enable this feature. Nothing else should appear different for you.
  • Child devices to handle individual day forecasts. These are based on the parent device name & day of the week (in English). So if your parent device is named "WeatherService" it will create 7 child devices "WeatherService Sunday", "WeatherService Monday", etc... These child devices will contain whatever forecast the particular weather service provided for that particular day. They have their values nulled out before each forecast, so if you check one and it has null values that means that there was no forecast received for that day.
1 Like

Will you still be adding the other variables to the driver as well?

I really like how the child devices work for the Weather reports.

I basically forgot about the other stuff since I focused on the forecast data. Everything I can include for the forecasts should be in (based on what they reasonably respond with per the services supported). But I think you are referring to the "current state" type of stuff, right?

I am, yes. I'm looking to use the actual data on my station for a few things.

Ok. Have to get back to that... Sorry. Here is an update with as much as I can get done tonight:

Updated Version(s):

  • HSM4Hubitat.groovy = 0.9.1

Change(s):

  • Current conditions (as reported by the weather service) have now been added as basic attributes (things like temperature, humidity, dewPoint, etc...) to the parent device for some services (OpenWeather, WeatherAPI, World Weather Online, & Weather Underground). Please note that not all of these services provide the same attributes but I tried to add in every single one they DO push as part of these general requests/forecasts.

Updated Version(s):

  • WSM4Hubitat.groovy = 0.9.2

Change(s):

  • Added additional attributes for current WU reported data (Neighborhood, Quality Control, Elevation, and Software Type).
2 Likes