This driver has been Deprecated. Once ApiXU was acquired and they reduced the Free account, there's no need to continue developing this driver. Please try the DarkSky driver for most of the same features.
I've been interested in the ApiXu driver because it's long been on my list of Large Apps. It's not very large in lines of code but it is large in it's impact to the Hub. It's one of the contributing factors that triggered a move to a 'coordinator hub' -- and now to three hubs. It converses with internet sites (the cloud) and using sync http, which "steals" the site's response time from the Hub. (The hub waits for the response.) Everyone is encouraged to use Async http to allow the hub to work on other things during the response time. Like a lot of code on Hubitat, ApiXU converses with multiple sites. It gets Sunrise and Sunset times for your location from sunrise-sunset.org and it does so with each polling cycle. While weather can certainly change every few minutes, your sunrise/sun set times won't change again til tomorrow.
Bangali has incorporated previous offerings, and I've offered this latest to him but he's been away for several weeks. I hope it's intentional and not due to illness or accident.
Let me be clear.. I don't want to "own" the code but I also want to reduce the load, not just on my hub, but everyone's. I am willing to "Release" my code to bridge the gap but it's not clear to me that the benefit outweighs the turmoil. Turmoil because you'll probably want to add a new Virtual Device with driver and just disable the old.. then when Bangali returns and does integrate it.. switch back. The attribute names are all the same, for Dashboard, as an example, you'd open each tile and just select the new device, no need to change the Attribute.
Only about 10% of the change is visible to users. Quite obviously, ApiXU isn't offering more or better data to me The attributes that you use are all the same. What this code tries to do is reduce the load on your hub. 90% of my coding efforts are aimed only at that one goal. I have added a switch to 'roll up' the giant list of selectable attributes after you've made your selections, to reduce the clutter. Here in California, we don't have a lot of 'weather' -- not much sneaks up on us. I don't really need to poll very often so I've extended the poll times to include 1 hour and 3 hours. 3 hours is especially good for those that use a Rule to refresh on demand. Lux/illuminance does change frequently and has always had it's own poll cycle and that's unchanged. It's not really good for detecting that one cloud overhead and thus 5 mins is the current lower limit.
Sunrise and sunset times are now acquired once per day, (and once per Save Preference.) Forecast Precipitation rotates the daily values once per day too, but I've grouped all of the attributes behind a single selector (extended precip).
The question then is: Do I release it or not?
Consensus is: yes, release it. Therefore, in the tradition of using the First Post in a Thread to point to the github release, I've edited this to add:
Initially all the Attributes Selectors are visible. Once you've selected the set you want, you can click the Display All Preferences to off and save preferences. That will "roll up" the Selectors to reduce the clutter.
Some attributes have been grouped, for example: Latitude and Longitude, with a single Selector (Latitude) so that you don't have to find them individually in an alphabetical list. Other Groups are: Sunrise Sunset and Temp High / Low +1 day.
-- == Release v1.2 == --
This release makes a big change in the way the Attributes are presented to the Hub. From Day One, Attributes have been strings. Wind Speed, Precipitation, and Visibility, to name but a few, are all sent from APIXU as numbers. Beginning with v1.2, wx-ApiXU-Driver submits value to the hub in their intended format. Numbers are numbers (Floating point or Integer) and text remains as Strings. Depending on how you’ve been using APIXU this past year, this change has the possibility of breaking your comparisons.
Please take great care in upgrading to v1.2 and beyond. Take the time to evaluate your use and to check the results. If you find the results are different, either roll back to v1.1.9 or adjust your automations to account for the new values.
-- == 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.
-- == Release v1.4 == --
- Distributed forecastPrecip() into sunRiseSetHandler, for the once a day portion
and into calcTime and doPoll for the display of data.
- Reworked updateLux() to use a schedule() vs chained runIn for robustness.
- Moved sunRiseSet map from 'state' to 'data' storage to declutter State Variable