Weather/Temp from online source

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 "--"

It took me awhile to find a local PWS that was reporting solarradation. What I did was goto the ā€œWundermapā€ and check each PWS to see which values it was reporting. I eventually found a few somewhat close by. I looked at the historical data and found the one with the most consistent chart data. I wish there was a tool to find stations reporting specific values sorted by distance. You can probably try nearby zip codes as well if you donā€™t want to search around the map.

In the driver settings you can set the specific PWS as the location with pws:[Station ID].

Awesome, so I found on within a few miles of my house. I put in the location ID in the section where is asked for zip or location. Did not work, so iā€™m assuming I made a mistake. Yourā€™re saying to hard code into driver? Can you tell me which line I need to edit, I looked and have a couple guesses, but not 100% sure.

Thanks

Or just leave zip code empty. Then it finds your nearest one I believe.

Iā€™m trying to use one that has solar radiation data. Using the Wundermap above, I was able to do that. I need to have it use that specific station.

It should be prefixed with pws: in the location field. An example is pws:KCASANFR49

1 Like

Ah. OK. Iā€™m in the UK and it finds my nearest one which probably just happens to have the solar radiation data. Didnā€™t realise they donā€™t all supply this data.

Did you do anything with this?
I'm trying to extract the 'solarradiation' data that is polled and use it for lux levels to turn lights on and off.
On ST with webCoRE I just put the following expression into a piston, and it extracted the solarradiation.
With webCoRE on HE it returns 0.

image

How about just using IFTTT? Not local, but the HE to IFTTT integration has been very reliable and no more than 7 seconds in responding so far.

The WU widget would give you what you need if your weather station (or one near by) is published to WU.

Wind speed rises above

This Trigger fires every time the wind speed rises above a value you specify in your location.

Trigger Fields
  • Speed
  • Units
  • Direction

I cannot see anything for lux or solar radiation in weather underground on IFTTT.

This worked for me. Found one reasonably close to my house that had solar radiation.

I am using weather underground and can get the information polled OK.
My problem, as described above, is that I want to extract the value and put it into a variable.
I can do this OK with WebCoRE using the expression as shown. It does not work in HE.
Hope that all makes sense.

Instead of using solarradiation why not use lux instead? The custom driver mentioned above does the conversion from solarradiation to lux automatically already. Maybe I misread your goal?

Sorry Bob. I read the quote and replied to the request for wind data closing skylight windows, instead of what you were asking. :man_facepalming:

No problem.

@bobbles

Bob, Iā€™m sorry, I got sidetracked porting some of my code from ST
Iā€™ll try and have a look over the weekend and see if I can knock something up.

Andy

1 Like

Thanks for this!

Question though, can you use a PWS station ID in the Zip/Location or is it limited to just postcode or lat/long?

There are multiple stations near me and I want to ensure that I pull from my PWS as it has the solar and uv sensors (as well as some other bits)

Does anyone know if I can use my Bloomsky Weather with this app?