Skip to content

Weather provider: weathergov missing function #3010

@dWoolridge

Description

@dWoolridge

The weather provider "weathergov.js" throws the following error:

weathergov.js:115 Could not load data ... TypeError: this.convertWindDirection is not a function
at Class.generateWeatherObjectsFromHourly (weathergov.js:182:33)
at weathergov.js:111:25

This functionality is needed for another module: MMM-WeatherHourlyByDay

The following function needs to be added back into the weathergov.js file:

/*
Convert the direction into Degrees
*/
convertWindDirection(windDirection) {
	const windCardinals = {
		N: 0,
		NNE: 22,
		NE: 45,
		ENE: 67,
		E: 90,
		ESE: 112,
		SE: 135,
		SSE: 157,
		S: 180,
		SSW: 202,
		SW: 225,
		WSW: 247,
		W: 270,
		WNW: 292,
		NW: 315,
		NNW: 337
	};

	return windCardinals.hasOwnProperty(windDirection) ? windCardinals[windDirection] : null;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions