[DEPRECATED] wx-ApiXU-driver

I loaded the Luxuriant driver, and there is a huge difference in my case...

wx-ApiXU illuminance = 5952.0
Luxuriant illuminance = 7377.0

Both are successfully polling at 5 min intervals.

J

Luxuriant-Driver is the raw calculation. I think I mentioned it above... the day is split into 5 slices...

"Fully Night Time"
"between sunset and twilight"
"between sunrise and twilight"
"between sunrise and noon"
"between noon and sunset"

Sunrise to Sunset ("between sunrise and noon" + "between noon and sunset" ) have a maximum LUX value of 10000, while the Twilight slices are max of 50. Night Time is, of course, 5 fixed.

From those Max Values, time within each slice is used to create a 'factor' and that factor reduces the theoretical (Max) Lux. In other words, that would be the calculated value of sunlight hitting the tops of clouds.

45%20AM

wx-ApiXU-Driver acquires cloud cover and condition code. Those factors further reduce Lux.

I've got a version (v1.5) of Luxuriant that does get the ApiXU data but because I completely rewrote the "slice the day into 5 pieces" code, I need to finish testing before releasing.

v1.5 of Luxuriant-Driver Released.

  • Optional APIXU acquisition of Cloud data.
  • Rewrite of the "split day into 5 slices" code to reduce the number of conversions.
  • Added "betwixt" attribute to display the "slice of day" text.
    Note: ApiXU polling runs at the same rate as Illuminance.

I can't think of anything else to do with this code. It was mostly a vehicle to allow me to rework the "slice of day" code, but it turned out nicely.

Please remind yourselves that LUX is a calculated value, not measured, and probably won't even be close to a real measurement. Its value, for me, is the relative number, not the explicit number. Knowing that a bright sunny day has a lux of X and that a gloomy, rainy day has a value of Y is pretty much all I need. I can then hard code in those values to my RM rules to decide if extra light is needed now.

Real vs. calculated:

Here is an example of what @csteele is trying to say

Green is measured illuminance
Blue is calculated

2 Likes

Thanks @dan.t

-- == Release v1.3 == –

With v1.3, I think I have completed my transition of the original code into something less taxing on the hub. Let me be clear about that statement… the code and therefore the Hub have to do the same work BUT it’s spread out and isn’t continuous.

There are Four main ‘loops’ in wx-ApiXU-Driver code:
poll()
updateLux()
pollSunRiseSet()
updateCheck()

All have been converted to asynchttp to free the hub to do other things while the website (cloud) responds, and are completely independent. There are ‘road blocks’ between the ‘loops’ though. Everything starts with the value you enter in the first Preference: ‘Zip code or city name or latitude,longitude? *’ That value is sent to ApiXU and returns with Latitude/Longitude and Time Zone. pollSunRiseSet() accepts only Latitude/Longitude + Time Zone and thus must defer til the results come back from ApiXU. UpdateLux() must wait for Sunrise, Sunset, Noon and Twilight times from pollSunRiseSet(). updateLux() was included as part of poll() originally, and that has been removed to make each loop as independent as possible.

I hope it’s clear that the first ‘cycle’ through all three of the main ‘loops’ are cascaded. The vagaries of The Internet can conspire against the smooth flow of answers/responses. Clicking “Save Preferences” does that AND fires the three main ‘loops’ again. They are initiated a few seconds apart so that their repeat actions won’t be on top of each other, but I imagine as we look at the logs, those few seconds won’t look like much of a gap. But the Hub is able to work on the ‘Z-something radio queues’ during the gap, and that is the predominant purpose for my amendments to this code, started by Bangali.

Going back to my first statement and beyond… ApiXU is still polled for the exact same data and with the exact same results from Bangali’s original code via poll(); sunrise-sunset.org is still polled for the exact same data and with the exact same results from Bangali’s original code via pollSunRiseSet(); updateLux() must still calculate Lux nearly the same as Bangali’s original code. However, my goal has been to ‘insert gaps’ in the large loop(s) to allow the Hub to keep the Z-something radio queues as empty as possible.

This image might assist you in determining the correct functionality of the loops:

Please remember, this portion of the Device Info page is NOT dynamic. You’ll have to use your browser’s refresh to see updates to these values. I think each is distinctive in what they are, the point is, they need to have values vs empty. The sunRiseSet value is updated once per day just after midnight and are in UTC. updateLux() needs those values and a valid TimeZone to calculate where the sun is in your sky.

Finally, if all you’re using is Lux to augment your Automations for dim or gloomy days, you might find that Luxuriant-Driver is a little lighter load on the hub.

3 Likes

Hi

Updated wx-apixu-driver to the latest, no isses there.

I am having some issues with the Luxuriant driver though:

Any thoughts?

1 Like

Did you add in the ApiXU key to the Device Info page?

Yup. ORIGINALLY copied & pasted when it first became available / an option...

You asking if I added the key had me check again.
Yes, there was a key in it. BUT, upon x-referencing with the ApiXU driver, they key was different.

I recopied the ApiXU key & pasted it in, saved, and all appears to be good now. Thanks.

QUESTION: Can / does the key change between versions? I AM POSITIVE I copied the correct key originally as I didn't see this error until I updated wx-ApiXU-driver to the latest version...

Thanks
J

2 Likes

I just loaded the latest code update for the wx-ApiXU-driver.
I assigned it to my device and it still shows 5 in the illuminance.
From the logs you can see it thinks it is night. Whatever time of day/evening/night it always shows the same.
Other sunset/sunrise triggered rules are firing at the correct time so it's not the hubs 'time' that is wrong.
I have tried refresh and poll but it makes no difference.
If I change it to Bangali's driver it immediately shows the correct illuminance level.
Any one else having these issues?
Have I missed something obvious maybe?
Do I need to let it run through a 24hr cycle for it to maybe do some sunrise/sunset polling to get the correct info?
Any ideas anyone?
Thanks.

1 Like

Take a look at post # 103 just about 5 posts above...

There's a screencap of some of the critical variables found on the Device Info page....

lux = 5 is (as you note) because the code thinks it's night. There's a cascade of data needed to get the right data... it's just math. :smiley:

Can you post a screen cap of that here or PM me, please? It's the LEFT column of data I'm interested in. It is NOT a dynamic area of the page, so click your browser's refresh before capturing, please.

Hasn't for me... and I haven't heard of anyone saying so.

I am using the same key on all instances of driver that converses with ApiXU. By the way, to disable acquiring cloud data in Luxuriant-Driver, just erase the key..

Yup, tis what I thought, but I had to ask.
I guess it is Moi making a mistake, although I have no idea where I got that "phantom" key from then!

1 Like

did it have extra characters?? could you have pasted it twice?

Just after I posted, I decided to define another device and see what it did.
Guess what, it's working OK.
With all my switching back and forth I can only assume the device got corrupt somehow.
I'll leave it as it is and see what happens.
Thanks for your prompt response. :smile:

No, it was just outright wrong. Me thinks an ID10T error.

Do I need to create a new Virtual device for each bit of info I want to create a tile for? I created 3 devices, temp, humidity, & Pressure When I went to make the tile and select the attribute the list wasn't there. The issue is that the device name is on the bottom of the tile. Having only one device doesn't indicate which info is being displayed.

One virtual device. 60 possible tiles.

You pick the same device, and the same template, over and over. The difference is which attribute in the far right column is selected.

OK One device. What I want to change is the Tile entry at the bottom. In your screenshots it is Weather(ApiXU) I would like it to sya, Temp, Humidity , Pressure.... Or to not show it at all and use the titles on the top that are formatted better, IE feelslike_f would be Feels Like. Is that possible?

Not with Dashboard v2. Maybe some future Dashboard. :slight_smile: