AQI Widget
OpenWeather AQI + Temperature Widget

A powerful dual-mode widget for Scriptable that displays either Air Quality Index (AQI) or Temperature information with beautiful color-coded backgrounds. Built for iOS using the Scriptable app and powered by OpenWeatherMap APIs.
Inspiration & Credits: This widget was inspired by and adapted from Jason Snell's PurpleAir AQI Scriptable Widget. Special thanks to Jason for the original concept and design patterns that made this enhanced version possible.
Note: All example screenshots in this documentation are shown in light mode. If your phone is in dark mode, the widget background will appear pitch black by default. If you prefer the colorful backgrounds shown in the examples, add
"light"to your widget parameter to force light theme colors.
β¨ Features
π‘οΈ Temperature Mode
Current temperature with large, easy-to-read display
Daily high and low temperatures
Temperature difference from "feels like" temperature
Daily temperature range information
City/location name display
Temperature-based color themes (hot = red/orange, cold = blue)
π Air Quality Mode (Default)
Real-time Air Quality Index (AQI) for your location
Color-coded AQI levels following US EPA standards
PM2.5 and PM10 pollution measurements
AQI category labels (Good, Moderate, Unhealthy, etc.)
SF Symbol icons for different AQI levels
Last updated timestamp
π¨ Smart Theming
Auto Theme: Adapts to your device's light/dark mode
Light Theme: Force colorful backgrounds (as shown in examples)
Dark Theme: Force dark backgrounds with colored text
Dynamic colors based on AQI levels or temperature ranges
π How It Works
The widget uses two OpenWeatherMap APIs:
Air Pollution API: Fetches real-time air quality data including PM2.5, PM10, and calculates US AQI
Weather API: Retrieves current temperature, high/low, and location information
π§ Setup
1. Get OpenWeatherMap API Key
Go to OpenWeatherMap
Create a free account
Navigate to the API Keys section
Generate a new API key (free tier includes 1,000 calls/day)
2. Install the Script
Option A - Direct Download:
Download
OpenWeatherAQI.jsSave it to the
Scriptablefolder in your iCloud Drive
Option B - Manual Copy:
Open Scriptable app
Tap the + icon to create a new script
Copy and paste the entire script content
Save with a name like "OpenWeather AQI"
3. Configure API Key
Open the script in Scriptable
Find this line at the top:
Replace
YOUR_API_HEREwith your actual API key:Save the script
4. Add Widget to Home Screen
Long-press your iOS Home Screen to enter edit mode
Tap the + icon in the top left
Search for and select Scriptable
Choose Small widget size (this widget is optimized for small widgets)
Place the widget on your home screen
Tap the widget to configure it:
Script: Select your "OpenWeather AQI" script
When Interacting: Choose "Run Script"
Parameter: Enter your desired parameter (see configuration options below)
5. Enable Location Access
When the widget runs for the first time, it will request location access
Choose "Allow While Using App" or "Allow Once"
For the widget to work on your home screen, you may need to grant "Always Allow" location access to Scriptable in Settings > Privacy & Security > Location Services
βοΈ Widget Parameters
Configure your widget by adding parameters in the widget settings. Multiple parameters can be combined with commas.
Available Parameters:
(empty)
Default AQI mode with auto theme
No parameter needed
temp
Switch to temperature mode
temp
light
Force light theme (colorful backgrounds)
light
dark
Force dark theme (dark backgrounds)
dark
temp,light
Temperature mode with light theme
temp,light
temp,dark
Temperature mode with dark theme
temp,dark
Parameter Examples:
Default AQI Mode: Leave parameter field empty
AQI with Light Theme:
lightAQI with Dark Theme:
darkTemperature Mode:
tempTemperature with Light Theme:
temp,lightTemperature with Dark Theme:
temp,dark
π AQI Color Coding
The widget follows US EPA Air Quality Index standards:
0-50
Good
π’ Green
Air quality is satisfactory
51-100
Moderate
π‘ Yellow
Acceptable for most people
101-150
Unhealthy for Sensitive Groups
π Orange
Sensitive individuals may experience problems
151-200
Unhealthy
π΄ Red
Everyone may experience problems
201-300
Very Unhealthy
π£ Purple
Health alert for everyone
301+
Hazardous
π€ Maroon
Emergency conditions
π‘οΈ Temperature Color Coding
Temperature mode uses different color schemes based on temperature ranges:
35Β°C+ (95Β°F+)
Red to Dark Red
Very Hot
25-34Β°C (77-93Β°F)
Orange
Warm
15-24Β°C (59-76Β°F)
Blue
Comfortable
Below 15Β°C (59Β°F)
Light Blue
Cool
π¨ Dark Mode vs Light Mode
Important Theme Information:
Auto Theme (Default)
Automatically adapts to your device's appearance setting
Light Mode: Shows colorful backgrounds as seen in examples
Dark Mode: Shows dark/black backgrounds with colored text
Force Light Theme
Add
lightparameter to always show colorful backgroundsRecommended if you prefer the colorful appearance regardless of your device theme
Example: Set parameter to
lightortemp,light
Force Dark Theme
Add
darkparameter to always show dark backgroundsText and accents will be colored, background remains dark
Example: Set parameter to
darkortemp,dark
π· Widget Examples
Note: All screenshots below show the widget in light mode with colorful backgrounds. If your device is in dark mode and you want these colorful backgrounds, add
"light"to your widget parameter.
π Air Quality Index (AQI) Mode
Hazardous (350 AQI)

Purple/Maroon background, shows severe air pollution
Moderate (51 AQI)

Yellow background, acceptable air quality
AQI Mode displays:
"AIR QUALITY" header
AQI level name (Good, Moderate, Unhealthy, etc.)
Numerical AQI value (large font)
City name
PM2.5 and PM10 values
Last updated time
SF Symbol icon indicating air quality level
π‘οΈ Temperature Mode
Cool Weather (23Β°C)

Blue background for comfortable temperatures
Temperature Mode displays:
Large current temperature
Daily high and low temperatures
Temperature difference from "feels like"
Daily temperature range
City name
π Widget Information Display
AQI Mode Layout:
Temperature Mode Layout:
π οΈ Troubleshooting
Common Issues:
1. Widget shows "Error" message:
Verify your API key is correct and active
Check internet connection
Ensure location services are enabled for Scriptable
2. Location not detected:
Go to Settings > Privacy & Security > Location Services
Find Scriptable and set to "While Using App" or "Always"
Try running the script manually in Scriptable first
3. Widget appears black (in dark mode):
This is normal behavior when your device is in dark mode
Add
lightparameter to force colorful backgroundsOr add
darkparameter for a consistent dark theme
4. Data not updating:
Widgets automatically refresh based on iOS system scheduling
Manually refresh by tapping the widget
Check if you've exceeded API rate limits (1,000 calls/day on free tier)
5. Wrong location displayed:
The widget uses your device's current location
Ensure location services are enabled and working
The script doesn't support manual location setting
API Rate Limits:
Free OpenWeatherMap accounts allow 1,000 API calls per day
Each widget refresh uses 2 API calls (1 for weather, 1 for AQI)
This allows approximately 500 widget refreshes per day
iOS typically refreshes widgets 10-20 times per day
π± iOS Compatibility
Requires: iOS 14+ (for widget support)
App: Scriptable (free on App Store)
Widget Size: Small (optimized for small widgets only)
Permissions: Location access required
π Data Sources
Air Quality Data: OpenWeatherMap Air Pollution API
Weather Data: OpenWeatherMap Current Weather API
AQI Calculation: Follows US EPA Air Quality Index standards
π Feedback & Support
Have questions, suggestions, or issues? Reach out:
Instagram: @the.tirth12
Email: rushiofficial1205@gmail.com
GitHub Issues: Create an issue in this repository
π License
This project is licensed under the MIT License. Feel free to fork, modify, and share with attribution.
Enjoy monitoring your air quality and weather! ππ‘οΈ ~ RP
Last updated