[RELEASE] wx-ApiXU-driver

community_driver

#101

Real vs. calculated:

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

Green is measured illuminance
Blue is calculated


#102

Thanks @dan.t


#103

-- == 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.


#104

Hi

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

I am having some issues with the Luxuriant driver though:

Any thoughts?


#105

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


#106

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


#107

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.


#108

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.


#109

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


#110

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!


#111

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


#112

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:


#113

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


#114

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.


#115

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.


#116

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?


#117

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


#118

Bummer. Anyway thanks for the code!


#119

image
any idea what if this might be or if it will cause issues?


#120

Harmless, but I'll fix it. :slight_smile:

The line should read: "wx-ApiXU-Driver was initialized." but the name gets saved AFTER that :frowning: