MagicMirrorOrg/MagicMirror · warning
Unknown weather data type: ${type}
Error message
Unknown weather data type: ${type} What it means
handleWeatherData dispatches incoming provider payloads by a `type` key ('current', 'forecast', 'hourly', ...). If the type matches no case, the default branch warns 'Unknown weather data type' and skips storing the data, though updateAvailable() still runs. It signals a provider/notification contract mismatch rather than a fatal fault.
Source
Thrown at defaultmodules/weather/weather.js:208
if (!data) {
return;
}
// Convert plain objects to WeatherObject instances
switch (type) {
case "current":
this.currentWeatherObject = this.createWeatherObject(data);
break;
case "forecast":
case "daily":
this.weatherForecastArray = data.map((d) => this.createWeatherObject(d));
break;
case "hourly":
this.weatherHourlyArray = data.map((d) => this.createWeatherObject(d));
break;
default:
Log.warn(`Unknown weather data type: ${type}`);
break;
}
this.updateAvailable();
},
createWeatherObject (data) {
const weather = new WeatherObject();
Object.assign(weather, {
...data,
// Convert to moment objects for template compatibility
date: data.date ? moment(data.date) : null,
sunrise: data.sunrise ? moment(data.sunrise) : null,
sunset: data.sunset ? moment(data.sunset) : null
});
return weather;
},
View on GitHub (pinned to 4b4a59534f)
Solutions
- Check the provider's fetchedData/notification code and ensure it emits a type matching 'current'/'forecast'/'hourly' as expected by this module version.
- Update both the weather module and the provider to matching versions.
- If writing a custom provider, add the new type case to handleWeatherData or map it to an existing one.
Example fix
// before (provider)
this.sendSocketNotification("WEATHER_DATA", { type: "daily", data });
// after
this.sendSocketNotification("WEATHER_DATA", { type: "forecast", data }); Defensive patterns
Strategy: type-guard
Validate before calling
const VALID_TYPES = ["current", "forecast", "hourly"];
if (!VALID_TYPES.includes(payload.type)) {
console.warn(`Provider sent unknown type: ${payload.type}`);
} Type guard
function isKnownWeatherType(t) {
return t === "current" || t === "forecast" || t === "hourly";
} Try / catch
// consumer side
try {
handleWeatherData(payload);
} catch (e) {
Log.error(`weather data dispatch failed: ${e.message}`);
} Prevention
- Keep provider notification types in sync with the module version you run.
- Centralize valid type names as shared constants between provider and module.
- Test custom providers against the stock weather module before deploying.
When it happens
Trigger: A weather provider (custom or third-party) sends a socket notification whose data type string is not one of the handled cases — e.g. typos like 'fetched' vs expected values, or a provider emitting an extra type like 'daily' not implemented in this module version.
Common situations: Using a community weather provider built against a different module version; editing provider code and misspelling the type; module/provider version skew after an upgrade.
Related errors
- Unknown weather type: ${this.config.type}
- apiKey is required
- Latitude and longitude are required
- Invalid API response
- Failed to fetch grid point: HTTP ${pointsResponse.status}
AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31).
Data as JSON: /api/errors/5b114138224c79e5.
Report an issue: GitHub.