Using weather in triggers and conditions

It seems like I've read posts about using local weather conditions in triggers and conditions, and I would like to learn how to do that. I don't have a weather station so I would be relying on data from a weather service. For example, my front porch lights come on at 6am and shut off half an hour after sunrise, but when it's extremely overcast it would be nice to keep the lights on longer because it's much darker than when the sky is clear.

Any tips?

Hubitat has a native driver for Open Weather Maps (OWM). You need to get a free API key from their website: Pricing - OpenWeatherMap

If you want more features that what is available with the native OWM device, you can install this device driver: see below

Once the device is in your device list, just load in your location and API key and you will have a device with a lot of weather attributes. Changes to any of these attributes can trigger a rule to run. In your example you would use the attribute "Lux". I am not sure but you may need to use the custom driver posted below (as opposed to the native driver) to get a lux value.

Sorry @kosmicken I think I gave you the wrong link to the custom driver, this is the link: OpenWeatherMap-Alerts-Weather-Driver

1 Like

Thanks, @Stephan.J! I am going to look into this. Looks like it should do what I need it to.

Why do you suggest using lux and not cloud coverage? (I assume cloud coverage would be reported. Do weather stations have lux meters to report actual outdoor lux?)

I believe that OWM uses cloud cover and time of day and day of the year for a calculation of lux. Its an approximation but better than just cloud cover.

I am in Canada so a completely cloud free day at 1:00pm on December 25th would have a different lux value than a completely cloud free day at 1:00pm on June 25th. Heck some areas in my country would be completely dark at 1:00pm on December 25th. lol

Alright, I've got a dumb question. I've got the driver installed on my hub. Now how do I create the device which will use this driver?

Edit: Figured it out!

Looks like I can do away with sunset and sunrise as triggers for my porch lights and just use luminance instead. Any suggestions for threshold? Would turning on "Use lux jitter control" prevent the lights from constantly turning on an off when the value approaches the threshold?

Sorry, I don't really know. I don't use lux in any of my automations, what I mentioned earlier was what I remembered reading. If you read the entire thread for the custom driver listed above, you will find a lot of clarifications for how to use the driver.

Remember triggers are always event based and a lux value is a state (a lux becoming a certain value or crossing a certain threshold is an event). You can run into trouble quick if your owm driver is updating its data frequently, by this I mean you could be triggering your rule often. With time based triggers at least you know when they happen. I would stick with time based triggers and use lux as a condition.

I have my owm driver update every 15 minutes, that means I only get a new value 4 times an hour. Close to sunset and sunrise has lux value changing more often than that.

If you post your question on the thread for the custom driver I linked to above, you will probably get a more knowledgeable answer.

1 Like

My turn for the dumb question -- I also just figured out how to install the driver, but don't see how to add the device. How did you do it?

EDIT: reading all the instructions helps -- I had looked at How to Install Custom Drivers - Hubitat Documentation but didn't realize that I needed to go all the way to the very very bottom of the list to add my virtual device.

...but still no idea what makes sense to put in for the "Event history size" and "State history size" values.