OpenWeatherMap Multi-API Weather Driver
Thank you for looking at my code!
This driver is shared under HPM and found with a search for Weather, or OpenWeatherMaps.
A direct link - here: https://raw.githubusercontent.com/jshimota01/hubitat/main/Drivers/owm_multi-API_weather/owm_multi-API_weather.groovy
My name is Jim Shimota and I rewrote this older driver to improve its use for myself and have decided to share it.
The last author seemed excited so I'm comfortable giving this a shot! The previous driver, called Weather-Display With OWM-Alerts Forecast Driver had been a valuable tool on my dashboard, but I forked off it a few years ago. It has been around and evolved from 2020!
I NEED to also acknowledge the work of @thebearmay and @libresun. Both of which built a moon phase tool I’ve used for years now. It is also embedded into this driver as well and I thank them!
I felt it needed a rewrite since I was getting errors with secondary sources, and many issues with Units and Precision. This is the result. Other than an Alternative Icons map, the code is completely new, little if anything was lifted from the original. As you can see by the Title of the previous driver, it was very Alerts centric. I made this more of a full service weather tool.
Another important reason I went down this path is that OWM uses API keys. These keys have evolved themselves over the years. The original Key I had was called 'API 2.5'. Later OWM released a new token counting system for tracking how often you polled, it was called 'One-Call.' So the API key name changed to One-Call 2.5. a few years later, One-Call 3.0 was released, which basically adjusted the polling pricing and free levels. This year OpenWeatherMaps has declared 'One-Call 2.5' obsolete. They also released 'One-Call 4.0' and any new key you obtain is detailed as such. Old keys CURRENTLY are still supported BUT OpenWeatherMaps has warned that the 'One-Call 2.5' support will end any day. Also, you can no longer obtain a One-Call 3.0 if you want, that option is no longer available.
All this said - this driver will accept ANY of the three One-Call versions - so 2.5, 3.0 and 4.0 are supported! I also want to note that One-Call 4.0 API is a radical departure in the polled data returned! I do NOT parse the 4.0 API yet. It is more sophisticated and there are multiple polls required to return Current data and Forecast Data - to name but one major change.
** often you'll see OWM references - it may not be obvious to some but that is OpenWeatherMaps.
Finally, here is a link to some Icons and Images folders - hubitat/Icons-Images at bb40e3b8ec5e9454ae1c2d632e6cf08ec1ed2fd0 · jshimota01/hubitat · GitHub
This folder includes subfolders of Wind Direction images, Moon Phase Images (including SVG components), the original OWM icons, and the HubitatPublic Icons as well. I myself have a local NAS that servers images without leaving my local subnet and my driver allows you to set yourself however you see fit.
Goals:
-
Support data for my future use of blinds. I wanted sun angles that were accurate and reliable.
-
Moon phase – At a glance moon phase for fishing.
-
Control of image paths - Localized icons and images option, fallback to icons
-
Integrated Twilight and day/night, Solar, Moon feature so one app replaces three I currently use
-
Improved city/long/lat lookup with reverse city name
-
Pre-written attributes that have the Unit with the value – ie; 5 mph.
-
Added barometer, and improved outdoor luminance
Extra features:
-
Tile length debug
-
Huge embedded comments content to assist in the future
-
Optimized SendEvent to minimize database writes
AI Reviews:
ChatGPT - Overall, I'd score v2.4.0 at approximately 9.6/10
It includes:
-
Support for multiple OWM API version keys (2.5, 3.0 and 4.0)
-
Dynamic polling based on sunrise/sunset
-
Extensive unit conversion
-
Extensive precision detail
-
Multiple date/time formats
-
Alternate icon packs
-
Wind direction graphics
-
Moon phase graphics (SVG/PNG/Emoji)
-
Automatic city lookup overrides
-
Weather alerts
-
Solar position calculations
-
Twilight calculations
-
Illuminance estimation
-
Four dashboard tiles
-
Huge number of device attributes
-
Comprehensive logging controls
Gemini - Grade: A+ (9.6 / 10)
This driver is written at a commercial/community-expert level. The code is clean, deeply defensive, and shows a strong understanding of Hubitat’s platform quirks (such as state committing delays and tile string limits).
Updates:
v2.5.9 07/28/26 jshimota Added moon alt and az text to moonPhaseTile
v2.5.8 07/28/26 jshimota Bug check: Cleaned up calcMoonPosition variables, aligned versions, and added text updates for moon angles in calcTextValue
v2.5.7 07/28/26 jshimota Added independent calcMoonPosition routine dispatches for currentMoon attributes
v2.5.6 07/28/26 jshimota Fixed location.timeZone null safety on tile date formats and corrected fallback attribute target in calcMoonPhaseSvgImage
v2.5.5 07/28/26 jshimota Bug check cleanup: fixed null safe checks on generateTiles and convertWindDirectionState
v2.5.4 07/28/26 jshimota Renamed ConditionImageText attributes to ConditionImageName and added .png extension to attribute values
v2.5.3 07/28/26 jshimota Renamed ConditionIcon attributes to ConditionImageText across metadata, logic, and tiles
v2.5.2 07/28/26 jshimota Renamed ConditionAltIcon attributes to ConditionAltImage across metadata, logic, and tiles
v2.5.1 07/28/26 jshimota Renamed generic altitude references across routines/variables to sunAltitude
v2.5.0 07/28/26 jshimota Renamed currentRain/currentSnow attributes to currentRainfall/currentSnowfall (and text variants)
v2.4.9 07/28/26 jshimota Strictly enforce precisionPrecip scaling on zero and default values (0, 0.0, 0.00)
v2.4.8 07/28/26 jshimota Separated hourly vs daily rain/snow mapping structure (daily returns direct number, current uses 1h key)
v2.4.7 07/28/26 jshimota Fixed rain and snow extraction logic for current and forecast data sets
v2.4.6 07/28/26 jshimota Renamed Wind Direction Icon attributes to WindDirectionImage
v2.4.5 07/28/26 jshimota Fix init race condition by evaluating sun position/isDay prior to parsing forecast data
v2.4.4 07/28/26 jshimota Fix race condition on forecast tile. fixed state storage of sun altitude to correct name
v2.4.3 07/28/26 jshimota changed altitude and azimuth to currentSun prefixed, added currentMoon values,
v2.4.2 07/28/26 jshimota changed api log switch to logging section. renamed precisionSunAngles to precisionSunMoonAngles

