Weather/Temp from online source

Currently Rule Machine does not support custom attributes, only custom commands. This is the same issue as @homeauto2112 using the forecast attribute. Right now the options are: custom app, webCoRE, multiple WU devices changing the temperature mapping, or writing a service manager that creates multiple devices for each attribute. Both those options will clutter up the device list. Custom app right now seems like the best option.

3 day forecast is included with the free API. Yesterday's weather is only included in their top paid API plan. You can check out the features included in each plan here.

Yeah sorry, I hard coded everything for those fahrenheit freedom units. :smile: The precipitation, visibility, pressure, etc can be changed to metric too.

2 Likes

Actuallyā€¦ like most ā€˜oldā€™ folk in the UK
I use Celsius for temp but ā€˜imperialā€™ for speed etc. :slight_smile:

so easy to convert just those few settings

Andy

1 Like

One option for the data (though as @mattw mentioned youā€™ll still need an app) is Darksky. They offer precip info and include historical as well in their API

https://darksky.net/dev/docs

They offer 1,000 calls per day for free

I hacked it a bit and hijacked the humidity and illuminance attributes in @mattw device code. I set the humidity to the forecast high and the illuminance to the forecast low. This allowed me to create a couple of virtual switches and turn them on/off at 6:00 AM to drive my other rules.

I hacked it a bit more.. :slight_smile:

As I'm in the UK, we tend to use Celsius rather than Fahrenheit
So... I made it switchable between the two
It's here in case anyone else finds it useful..

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

This is really useful - Thanks @mattw for creating this.

Andy

1 Like

Guys
Iā€™m thinking of writing a little custom app for this driver.
I would like the ability to use the data properly
E.g. If the wind is too high I want to turn on/off a switch which controls my conservatory skylight windows.
Or as @homeauto2112 turn on/off a switch at forecast high/low thresholds

Would anyone else find this useful?

Andy

I would. I have to keep some notes around regarding the hijacking I did and a little app would help with that!

What have people put in for zip code in the UK.
Iā€™ve got an API key put it in to the device but donā€™t get anything.

Lat & long separated by a comma
Like this...

26-03-2018%2016-33-45

You can find that by using google maps :slight_smile:

Andy

Brilliant thanks.

Bump.
OK. I have this installed and Iā€™m getting data.
What I would like to do is extract the ā€˜solarradiationā€™ value into a variable in webCoRE.
Does anyone know how I can extract the data?
Thanks.

Iā€™m not getting solar radiation or illuminace. Is this area specific?

The built-in Hubitat Weather Device does not currently expose any of the WU data as ā€˜Illuminanceā€™. Others must be using custom code.

Yes. I was using the custom WU device posted above. Iā€™d really love to get illumice. I had a few automations that used that vs sunset

1 Like

So is there a way to set a weather station? I found one that has SolarRadiation.

You set your weather station in the settings after you create the device.

This is how ST handled lux. Seems like it would not be hard to add this to the Weather Underground device driver.

This is the link to weather underground api. The terms seems to be the same

https://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary&_ga=2.67507793.1310804216.1523371381-1626569218.1523371381

private estimateLux(sunriseDate, sunsetDate, weatherIcon) {
 def lux = 0
 def now = new Date().time
 if (now > sunriseDate.time && now < sunsetDate.time) {
  //day
  switch(weatherIcon) {
   case 'tstorms':
    lux = 200
    break
   case ['cloudy', 'fog', 'rain', 'sleet', 'snow', 'flurries',
    'chanceflurries', 'chancerain', 'chancesleet',
    'chancesnow', 'chancetstorms']:
    lux = 1000
    break
   case 'mostly cloudy':
    lux = 2500
    break
   case ['partlysunny', 'partlycloudy', 'hazy']:
    lux = 7500
    break
   default:
    //sunny, clear
    lux = 10000
  }
  //adjust for dusk/dawn
  def afterSunrise = now - sunriseDate.time
  def beforeSunset = sunsetDate.time - now
  def oneHour = 1000 * 60 * 60
  if(afterSunrise < oneHour) {
   //dawn
   lux = (long)(lux * (afterSunrise/oneHour))
  } else if (beforeSunset < oneHour) {
   //dusk
   lux = (long)(lux * (beforeSunset/oneHour))
  }
 }
 else {
  //night - always set to 10 for now
  //could do calculations for dusk/dawn too
  lux = 10
 }
 lux
}

You can get Lux and solar radiation already.
It's getting to it to use it that I'm having problems with.

I saw that, but it appears that not all locations have solar radiation. My zip code is one of those.

This is how it shows up for me "--"