-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
164 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,77 @@ | ||
package main | ||
|
||
// https://github.com/sarnau/Inside-The-Loxone-Miniserver/blob/master/Code/LoxoneWeather.py | ||
// | ||
// 1 Clear, cloudless sky (Loxone: Wolkenlos) | ||
// 2 Clear, few cirrus (Loxone: Wolkenlos) | ||
// 3 Clear with cirrus (Loxone: Heiter) | ||
// 4 Clear with few low clouds (Loxone: Heiter) | ||
// 5 Clear with few low clouds and few cirrus (Loxone: Heiter) | ||
// 6 Clear with few low clouds and cirrus (Loxone: Heiter) | ||
// 7 Partly cloudy (Loxone: Heiter) | ||
// 8 Partly cloudy and few cirrus (Loxone: Heiter) | ||
// 9 Partly cloudy and cirrus (Loxone: Wolkig) | ||
// | ||
// 10 Mixed with some thunderstorm clouds possible (Loxone: Wolkig) | ||
// 11 Mixed with few cirrus with some thunderstorm clouds possible (Loxone: Wolkig) | ||
// 12 Mixed with cirrus and some thunderstorm clouds possible (Loxone: Wolkig) | ||
// 13 Clear but hazy (Loxone: Wolkenlos) | ||
// 14 Clear but hazy with few cirrus (Loxone: Heiter) | ||
// 15 Clear but hazy with cirrus (Loxone: Heiter) | ||
// 16 Fog/low stratus clouds (Loxone: Nebel) | ||
// 17 Fog/low stratus clouds with few cirrus (Loxone: Nebel) | ||
// 18 Fog/low stratus clouds with cirrus (Loxone: Nebel) | ||
// 19 Mostly cloudy (Loxone: Stark bewölkt) | ||
// 20 Mostly cloudy and few cirrus (Loxone: Stark bewölkt) | ||
// 21 Mostly cloudy and cirrus (Loxone: Stark bewölkt) | ||
// 22 Overcast (Loxone: Bedeckt) | ||
// 23 Overcast with rain (Loxone: Regen) | ||
// 24 Overcast with snow (Loxone: Schneefall) | ||
// 25 Overcast with heavy rain (Loxone: Starker Regen) | ||
// 26 Overcast with heavy snow (Loxone: Starker Schneefall) | ||
// 27 Rain, thunderstorms likely (Loxone: Kräftiges Gewitter) | ||
// 28 Light rain, thunderstorms likely (Loxone: Gewitter) | ||
// 29 Storm with heavy snow (Loxone: Starker Schneeschauer) | ||
// 30 Heavy rain, thunderstorms likely (Loxone: Kräftiges Gewitter) | ||
// 31 Mixed with showers (Loxone: Leichter Regenschauer) | ||
// 32 Mixed with snow showers (Loxone: Leichter Schneeschauer) | ||
// 33 Overcast with light rain (Loxone: Leichter Regen) | ||
// 34 Overcast with light snow (Loxone: Leichter Schneeschauer) | ||
// 35 Overcast with mixture of snow and rain (Loxone: Schneeregen) | ||
const ( | ||
Clear = 1 | ||
ClearFewCirrus = 2 | ||
ClearWithCirrus = 3 | ||
PartlyCloud = 7 | ||
MostlyCloudy = 19 | ||
Overcast = 22 | ||
ClearSky = 1 | ||
ClearFewCirrus = 2 | ||
ClearWithCirrus = 3 | ||
ClearWithFewLowClouds = 4 | ||
ClearWithFewLowCloudsAndFewCirrus = 5 | ||
ClearWithFewLowCloudsAndCirrus = 6 | ||
PartlyCloudy = 7 | ||
PartlyCloudyAndFewCirrus = 8 | ||
PartlyCloudyAndCirrus = 9 | ||
MixedWithSomeThunderstormClouds = 10 | ||
MixedWithFewCirrusAndThunderstorm = 11 | ||
MixedWithCirrusAndThunderstorm = 12 | ||
ClearButHazy = 13 | ||
ClearButHazyWithFewCirrus = 14 | ||
ClearButHazyWithCirrus = 15 | ||
FogLowStratusClouds = 16 | ||
FogLowStratusCloudsWithFewCirrus = 17 | ||
FogLowStratusCloudsWithCirrus = 18 | ||
MostlyCloudy = 19 | ||
MostlyCloudyAndFewCirrus = 20 | ||
MostlyCloudyAndCirrus = 21 | ||
Overcast = 22 | ||
OvercastWithRain = 23 | ||
OvercastWithSnow = 24 | ||
OvercastWithHeavyRain = 25 | ||
OvercastWithHeavySnow = 26 | ||
RainThunderstormsLikely = 27 | ||
LightRainThunderstormsLikely = 28 | ||
StormWithHeavySnow = 29 | ||
HeavyRainThunderstormsLikely = 30 | ||
MixedWithShowers = 31 | ||
MixedWithSnowShowers = 32 | ||
OvercastWithLightRain = 33 | ||
OvercastWithLightSnow = 34 | ||
OvercastWithMixtureOfSnowAndRain = 35 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,82 @@ | ||
package main | ||
|
||
// 1 Clear, cloudless sky (Loxone: Wolkenlos) | ||
// 2 Clear, few cirrus (Loxone: Wolkenlos) | ||
// 3 Clear with cirrus (Loxone: Heiter) | ||
// 4 Clear with few low clouds (Loxone: Heiter) | ||
// 5 Clear with few low clouds and few cirrus (Loxone: Heiter) | ||
// 6 Clear with few low clouds and cirrus (Loxone: Heiter) | ||
// 7 Partly cloudy (Loxone: Heiter) | ||
// 8 Partly cloudy and few cirrus (Loxone: Heiter) | ||
// 9 Partly cloudy and cirrus (Loxone: Wolkig) | ||
// | ||
// 10 Mixed with some thunderstorm clouds possible (Loxone: Wolkig) | ||
// 11 Mixed with few cirrus with some thunderstorm clouds possible (Loxone: Wolkig) | ||
// 12 Mixed with cirrus and some thunderstorm clouds possible (Loxone: Wolkig) | ||
// 13 Clear but hazy (Loxone: Wolkenlos) | ||
// 14 Clear but hazy with few cirrus (Loxone: Heiter) | ||
// 15 Clear but hazy with cirrus (Loxone: Heiter) | ||
// 16 Fog/low stratus clouds (Loxone: Nebel) | ||
// 17 Fog/low stratus clouds with few cirrus (Loxone: Nebel) | ||
// 18 Fog/low stratus clouds with cirrus (Loxone: Nebel) | ||
// 19 Mostly cloudy (Loxone: Stark bewölkt) | ||
// 20 Mostly cloudy and few cirrus (Loxone: Stark bewölkt) | ||
// 21 Mostly cloudy and cirrus (Loxone: Stark bewölkt) | ||
// 22 Overcast (Loxone: Bedeckt) | ||
// 23 Overcast with rain (Loxone: Regen) | ||
// 24 Overcast with snow (Loxone: Schneefall) | ||
// 25 Overcast with heavy rain (Loxone: Starker Regen) | ||
// 26 Overcast with heavy snow (Loxone: Starker Schneefall) | ||
// 27 Rain, thunderstorms likely (Loxone: Kräftiges Gewitter) | ||
// 28 Light rain, thunderstorms likely (Loxone: Gewitter) | ||
// 29 Storm with heavy snow (Loxone: Starker Schneeschauer) | ||
// 30 Heavy rain, thunderstorms likely (Loxone: Kräftiges Gewitter) | ||
// 31 Mixed with showers (Loxone: Leichter Regenschauer) | ||
// 32 Mixed with snow showers (Loxone: Leichter Schneeschauer) | ||
// 33 Overcast with light rain (Loxone: Leichter Regen) | ||
// 34 Overcast with light snow (Loxone: Leichter Schneeschauer) | ||
// 35 Overcast with mixture of snow and rain (Loxone: Schneeregen) | ||
func fixTomorrow(report Tomorrow_Report) int { | ||
// https://docs.tomorrow.io/reference/data-layers-weather-codes | ||
//"0": "Unknown", | ||
// "1000": "Clear, Sunny", | ||
// "1100": "Mostly Clear", | ||
// "1101": "Partly Cloudy", | ||
// "1102": "Mostly Cloudy", | ||
// "1001": "Cloudy", | ||
// "2000": "Fog", | ||
// "2100": "Light Fog", | ||
// "4000": "Drizzle", | ||
// "4001": "Rain", | ||
// "4200": "Light Rain", | ||
// "4201": "Heavy Rain", | ||
// "5000": "Snow", | ||
// "5001": "Flurries", | ||
// "5100": "Light Snow", | ||
// "5101": "Heavy Snow", | ||
// "6000": "Freezing Drizzle", | ||
// "6001": "Freezing Rain", | ||
// "6200": "Light Freezing Rain", | ||
// "6201": "Heavy Freezing Rain", | ||
// "7000": "Ice Pellets", | ||
// "7101": "Heavy Ice Pellets", | ||
// "7102": "Light Ice Pellets", | ||
// "8000": "Thunderstorm" | ||
|
||
// https://docs.tomorrow.io/reference/data-layers-weather-codes | ||
switch report.Values.WeatherCode { | ||
func getWeatherCondition(code int) int { | ||
switch code { | ||
case 0: | ||
return 0 | ||
case 1000: | ||
return | ||
return ClearSky | ||
case 1100: | ||
return ClearSky | ||
case 1101: | ||
return PartlyCloudy | ||
case 1102: | ||
return MostlyCloudy | ||
case 1001: | ||
return MostlyCloudy | ||
case 2000: | ||
return FogLowStratusClouds | ||
case 2100: | ||
return FogLowStratusClouds | ||
case 4000: | ||
return OvercastWithRain | ||
case 4001: | ||
return OvercastWithRain | ||
case 4200: | ||
return LightRainThunderstormsLikely | ||
case 4201: | ||
return HeavyRainThunderstormsLikely | ||
case 5000: | ||
return MostlyCloudyAndCirrus | ||
case 5001: | ||
return OvercastWithRain | ||
case 5100: | ||
return OvercastWithSnow | ||
case 5101: | ||
return StormWithHeavySnow | ||
case 6000: | ||
return OvercastWithMixtureOfSnowAndRain | ||
case 6001: | ||
return OvercastWithMixtureOfSnowAndRain | ||
case 6200: | ||
return OvercastWithMixtureOfSnowAndRain | ||
case 6201: | ||
return MixedWithSnowShowers | ||
case 7000: | ||
return ClearButHazyWithCirrus | ||
case 7101: | ||
return ClearButHazyWithCirrus | ||
case 7102: | ||
return ClearButHazyWithCirrus | ||
case 8000: | ||
return HeavyRainThunderstormsLikely | ||
default: | ||
return 0 | ||
} | ||
var id = 0 | ||
//"0": "Unknown", | ||
// "1000": "Clear, Sunny", | ||
// "1100": "Mostly Clear", | ||
// "1101": "Partly Cloudy", | ||
// "1102": "Mostly Cloudy", | ||
// "1001": "Cloudy", | ||
// "2000": "Fog", | ||
// "2100": "Light Fog", | ||
// "4000": "Drizzle", | ||
// "4001": "Rain", | ||
// "4200": "Light Rain", | ||
// "4201": "Heavy Rain", | ||
// "5000": "Snow", | ||
// "5001": "Flurries", | ||
// "5100": "Light Snow", | ||
// "5101": "Heavy Snow", | ||
// "6000": "Freezing Drizzle", | ||
// "6001": "Freezing Rain", | ||
// "6200": "Light Freezing Rain", | ||
// "6201": "Heavy Freezing Rain", | ||
// "7000": "Ice Pellets", | ||
// "7101": "Heavy Ice Pellets", | ||
// "7102": "Light Ice Pellets", | ||
// "8000": "Thunderstorm" | ||
return id | ||
|
||
} |