Weather/Temp from online source

This is proving more difficult than I 1st thought.
The problem is that the driver outputs numbers as strings and for comparing to a configured value, I need them as integers.
I’m not sure how to convert “3” to a number 3

Still trying things :slight_smile:

Andy

2 Likes

I made some small tweaks to this to suit my needs … havent gotten them up on Git yet,

@mattw do you want these tweaks ? Pull Request?

so far just added

// Added by JHOKE to collect more info for Hubitat Dashboards
attribute "icon_url", "string"
attribute "icon", "string"
attribute "wind_dir", "string" 

and then

// Added by JHOKE for other needs - may add additional as I dig in more 
sendEvent(name: "icon_url", value: resp.data.current_observation.icon_url)
sendEvent(name: "icon", value: resp.data.current_observation.icon)
sendEvent(name: "wind_dir", value: resp.data.current_observation.wind_dir)

I am going to play around with tryign to get a tile to display an icon based on these values …

@JHoke
Thanks John
I’ve added wind dir to my driver and the app I’m working on

Andy

1 Like

Yeah - there is quite a bit of data returned … need to play around to parse out the forecast output as well

Thinking of use cases
if $forecastString Contains “Snow”
then turn on heaters
If $forecastTemp < 40F
Then Turn off ExteriorWaterValves

etc etc

I will say when it comes to illuminance, i find that it’s a little buggy compared to Smarttthings. Not buggy as in it does not work, but maybe it’s just too accurate. Smartthings used some logic to create a “fake” illuminance based on weather, time of day and a couple other things (i Believe). I actually did not even know that until i moved over to HE, and wanted to add illiuminance into my routines.

It looks like Solar Radiation is just too accurate. As in sometimes when it’s light enough outside (1st couple of hours in the morning, or near the end of the evening), my routines based on illiminace fire when with ST they did not.

It’s not horrible, and I am glad to have it as an option, it will just require more tweaking to figure it out.

I usually add time and mode restrictions to my apps
This helps with not firing at silly o’clock just because it’s summer and the sun rose at 4am :slight_smile:

I only use 4 modes: morning, afternoon, evening & night so it’s easier to do.

Andy

Bob
want to try this beta for me?

At the moment it just turns on/off a switch in response to a weather item and doesn't have my usual time/day/presence restrictions but I'll add them soon.
I'll look at adding additional actions later if required.

Andy

Did a little work on this driver (and my app posted above)

Cleaned up capitalisation/naming
Added ‘Wind Gust’

Added ability to select the following units (in addition to being able to select the temperature unit)

Pressure (mb or in)
Distance/Speed (mi or km)
Precipitation (in or mm)

Added the ability to disable the majority of the logging

I have also added extreme weather alerts (which I was unable to test as I can’t find any!)
It should work in theory :slight_smile:

I have updated Github with the new file

https://github.com/CobraVmax/Hubitat/tree/master/Drivers/Weather

Andy

That’s not a bad idea. I think that’s beyond my programing abilities at this point (note the word “hack”) :slight_smile:

I set the poll on the custom driver to 1 hour so to not piss off the WU gods. I also forgot that I have to setup a separate RM Poll for the default WU driver.

I added in these capabilities to your driver:

capability "Temperature Measurement"
capability "Illuminance Measurement"
capability "Relative Humidity Measurement"

Without that I could not select those capabilities in my weather station for some other apps (HousePanel).

Thanks!

@Matthew

You might want to host it on github or similar so others,can use it ;
My developement of this driver is related to my Weather Switch app,so probably won’t be much good for others (don’t really have time to maintain both)

Andy

Well ... I have never bothered to create my own GitHub until now ... so here you go....

Again, the only change is I added three capabilities to @Cobra's driver.

2 Likes

Not sure what has happened but I updated to your code and polling appears to have stopped.

EDIT: Reverted to old code, auto polling now working again.

I believe @Cobra’s changes stops the logging data from being shown (“Added the ability to disable the majority of the logging”) . Is that what you are referring to? If you look at the driver ‘States’ it does show the observation time and mine is updating at the requested interval.

With the old code, polling was done every 5 minutes and I could see Lux, SolarRadiation, Humidity etc. updating every 5 minutes.
When I loaded your code there was no polling every 5 minutes.
I filled in all the configurable fields. Polling was already populated with 5 so I left it alone.

I don't know what to say? It is working for me. Did you fill in the appropriate 'preferences' in the driver?

Yep. All filled in.
Will give it another try.

EDIT: Well I re-installed and now its working. Not sure what happened but as long as its working, that’s all that matters.
I like the extra features by the way. Nice one.

Made a minor update to my version of the driver. For the three capabilities I added, I had to change to lower-case the attribute title (they were all in Title-Case). I added those capabilities so I could use them in HousePanel, but HousePanel did not pull in the values until I changed them to lower-case.

Just an update on the problem I saw yesterday when there was no polling.
It looks like it occasionally does not poll. It misses the 5 minute poll.
As you can see from the events for the device below, there was no poll at 1:55pm.
image

@bobbles
@Matthew

Guys
I've posted a new driver which includes all the correct attributes for use with dashboards if you want to try that
I have also added a 'Weather Summary' which I hope to use later in WS