Skip to content

Commit f5fb875

Browse files
refactor: remove unused convertOpenWeatherIdToIcon function
The function was dead code - never called anywhere in the codebase. It converted numeric weather condition IDs (200-899) to icon names, which was needed for an older OpenWeather API approach. The module now uses icon codes ("01d", "10n") directly via convertWeatherType() instead. - Removed 68 lines of unused code
1 parent 9694c3c commit f5fb875

1 file changed

Lines changed: 0 additions & 58 deletions

File tree

MMM-OneCallWeather.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -738,64 +738,6 @@ Module.register("MMM-OneCallWeather", {
738738
return container;
739739
},
740740

741-
convertOpenWeatherIdToIcon(id, openweatherIcon) {
742-
if (id >= 200 && id < 300) {
743-
// Thunderstorm
744-
return "thunderstorm";
745-
}
746-
if (id >= 300 && id < 400) {
747-
// Drizzle
748-
return "rain";
749-
}
750-
if (id === 511) {
751-
// Rain - freezing rain
752-
return "sleet";
753-
}
754-
if (id >= 500 && id < 600) {
755-
// Rain
756-
return "rain";
757-
}
758-
if (id >= 610 && id < 620) {
759-
// Snow - sleet or with rain
760-
return "sleet";
761-
}
762-
if (id >= 600 && id < 700) {
763-
// Snow
764-
return "snow";
765-
}
766-
if (id === 781) {
767-
// Atmosphere - tornado
768-
return "tornado";
769-
}
770-
if (id >= 700 && id < 800) {
771-
// Atmosphere
772-
return "fog";
773-
}
774-
if (id >= 800 && id < 810) {
775-
const isDay = openweatherIcon.slice(-1) === "d";
776-
777-
if (id === 800) {
778-
// Clear
779-
if (isDay) {
780-
return "clear-day";
781-
}
782-
return "clear-night";
783-
}
784-
if (id === 801 || id === 802) {
785-
// Clouds - few or scattered
786-
if (isDay) {
787-
return "partly-cloudy-day";
788-
}
789-
return "partly-cloudy-night";
790-
}
791-
if (id === 803 || id === 804) {
792-
// Clouds - broken or overcast
793-
return "cloudy";
794-
}
795-
}
796-
return false;
797-
},
798-
799741
roundValue(temperature) {
800742
return this.utils.roundValue(temperature, this.config.roundTemp);
801743
},

0 commit comments

Comments
 (0)