A MagicMirror² module that displays real-time weather data from your Personal Weather Station at Weather Underground.
The provider can be used by the default weather module and other weather modules that support the weatherProvider configuration option.
Requires MagicMirror² v2.35.0+ for the weather provider (server-side provider API).
- Real-time weather data from Weather Underground Personal Weather Stations
- Provider can be used with the built-in weather module
- Comprehensive weather information including:
- Current temperature with feels-like temperature
- Dew point and wind chill
- Humidity and barometric pressure
- Wind speed, gusts, and direction (compass abbreviation)
- Precipitation rate and daily total
- UV Index and solar radiation (when available)
- Station location and elevation
- Last observation time
cd ~/MagicMirror/modules/
git clone https://github.com/msimon360/MMM-PWSWeather
cd MMM-PWSWeather
npm installWeather providers in MagicMirror² v2.35.0+ run as server-side Node.js classes. Copy the provider into MagicMirror's built-in weather providers directory:
cp ~/MagicMirror/modules/MMM-PWSWeather/pws.js \
~/MagicMirror/defaultmodules/weather/providers/Then configure the weather module:
{
module: "weather",
position: "top_right",
config: {
weatherProvider: "pws",
type: "current",
apiKey: "your-weather-underground-api-key",
stationId: "your-station-ID",
units: "imperial", // MagicMirror display units (metric|imperial)
// apiUnits: "m", // optional WU API units override: e|m|h
updateInterval: 300000 // 5 minutes
}
}Note: MagicMirror
units(metric/imperial) is for display only. This provider maps that to Weather Underground’se/mAPI codes automatically. Use optionalapiUnits(e|m|h) only if you need to force the API unit system. Values are always normalized to metric for the weather module.
Only type: "current" is supported (PWS current observations do not include forecasts).
To keep git from overwriting a custom provider on MagicMirror updates:
git -C ~/MagicMirror update-index --assume-unchanged \
defaultmodules/weather/providers/pws.jsAdd the module to your config/config.js file:
{
module: "MMM-PWSWeather",
position: "top_right",
config: {
apiKey: "your-weather-underground-api-key",
stationId: "your-station-ID",
updateInterval: 300000, // Update every 5 minutes (in milliseconds)
}
}| Option | Description | Default | Required |
|---|---|---|---|
apiKey |
Your Weather Underground API key | - | Yes |
stationId |
Your Weather Underground station ID | - | Yes |
updateInterval |
How often to fetch new data (milliseconds) | 300000 (5 min) |
No |
units |
MagicMirror display units (metric or imperial). Mapped to WU API units automatically when used as a weather provider. |
MagicMirror config | No |
apiUnits |
Optional Weather Underground API units override (e, m, or h) |
derived from units, else m |
No |
If you have a Personal Weather Station that reports to Weather Underground you can get an API key with your FREE account. You can also get an API key with a paid subscription to pull data from other Weather Stations.
- Go to Weather Underground
- Sign up or log in to your account
- Visit the API Keys page
- Create a new API key
- Copy the 32-character key into your config
Important: Make sure you copy all 32 characters of the API key. Missing even one character will cause a 401 authentication error.
- Go to Weather Underground
- Search for your location
- Find your chosen weather station on the map
- Click on it to see the Station ID (format:
KSSCCCCNNNwhere SS is state, CCCC is city, NNN is number)
This means your API key is invalid or incorrectly entered. Check that:
- Your API key is exactly 32 characters
- There are no extra spaces or quotes in the config
- Your API key is still active on Weather Underground
- Verify your station ID is correct
- Check that your station is actively reporting data
- Look at the console output with
npm startfor error messages - Ensure your Raspberry Pi has internet connectivity
- Confirm your station is online and reporting
- Try a different nearby station ID to test
- Check the MagicMirror logs for JavaScript errors
MagicMirror v2.35.0 removed the client-side WeatherProvider.register(...) API. Re-copy pws.js from this module (v2.0.0+) into defaultmodules/weather/providers/ and restart MagicMirror.
MIT License - feel free to use and modify as needed.
Developed for MagicMirror² using Weather Underground API.
Pull requests and suggestions are welcome!
