apixu updates their data every hour ... at least that seems to be the case for the free version ... so the polling frequency is defaulted to 30 minutes in settings.
since a key reason for doing this was supporting illuminance data for those of us with no external lux sensor the illuminance data is calculated and published every 5 minutes independent of the polling interval.
the seconds indicator for the local_time attribute blinks at ~2 second interval. works well when using this to display time on the dashboard for non-local locations.
there is an attribute called illuminated which is the illuminance value properly formatted for display on dashboard.
here is the clock seconds indicator blinking every ~2 seconds:
here are the attributes that are published and usable on the dashboard:
need a way to do notifications based on attributes from this driver? try WATO:
if you would like to donate to support this work ... donate here.
i use this driver with rooms manager and rooms occupancy to turn on and off lights etc when the outside lux is at a certain values. if you havent tried rooms manager do consider giving it a try. it will change how you automate your house. more details here:
unfortunately the free api key does not return some of the data hence the non working attributes.
i was going to use get sunrise and sunset data from the hub but that api does not seem to work in drivers. so sunrise/sunset/illuminance and forecast is not available on this.
i have posted on the hubitat support forum to see if the sunrise/sunset api can work in drivers. if it does some of the missing attributes could be filed in that way.
ok. would you please consider adding an attribute with City, State? that seems to be one thing i use thats missing. and solar radiation is that a good approximation for lux? at my location there is no value for solar radiation however the light is still fairly bright outside.
since solar radiation is not always reported and its not typically the same as illuminance ... you could add a setting to have the user confirm if they want the value of solar radiation from the weather station published as illuminance. if user sets that flag as true via settings then publish the solar radiation as illuminance otherwise publish solar radiation as solar radiation and dont publish as illuminance.
since the illuminance capability is supported in the device and not all weather stations support returning solar radiation having an option not to publish solar radiation as illumination will prevent false triggers.
i was going to use this in the driver i had posted. this returns local sunrise and sunset in ISO 8601 format if you want to calculate illuminance based on this, current time and condition.
// attribution: sunrise and sunset data and api courtesy https://sunrise-sunset.org/
private getSunriseAndSunset() {
def params = [
uri: "https://api.sunrise-sunset.org/json?lat=${location.latitude}&lng=${location.longitude}&date=today&formatted=0"
]
def sunRiseAndSet = [:]
try {
httpGet(params) { resp ->
sunRiseAndSet = [sunrise: resp.data.results.sunrise, sunset: resp.data.results.sunset]
}
} catch (e) {
log.error "http call failed for sunrise and sunset api: $e"
}
// returns map with sunrise and sunset in ISO8601 format example: [sunrise:2018-05-01T13:11:41+00:00, sunset:2018-05-02T02:58:41+00:00]
return sunRiseAndSet
}
the site uses rate limiting so might be worth calling this only when the date changes to a new date.
Just as a heads up for anyone looking into this. currently (5/18/18) you can not get a free API key from WU any more. It looks like as long as you have a key you'll be ok for a while, but no new keys are being given out.
i had seen these last time looking for weather API back in 2017 ... the website seems unavailable now ... maybe someone at .gov doesnt like sharing weather data any more.