Hallo zusammen,
in der Commandref von 59_Weather (https://fhem.de/commandref_DE.html#Weather) steht:
ZitatGet
...
code: Code für die aktuellen Wetterverhältnisse
...
Als API verwende ich
OpenWeatherMapAPI.
Laut der Dokumentation der API "5 Day / 3 Hour Forecast" (https://openweathermap.org/weather-conditions) sind die Weather condition codes
3-stellig. Diese Gruppen gibt es:
- 2xx: Thunderstorm
- 3xx: Drizzle
- 5xx: Rain
- 6xx: Snow
- 7xx: Atmosphere
- 800: Clear
- 80x: Clouds
Bei mir kommen allerdings nur
2-stellige Codes an, z.B. aktuell:
Zitatcode: 35
Hier mal die List-Ausgabe von hier, ohne hfc-Readings und anonymisiert:
Internals:
API OpenWeatherMapAPI
APIKEY 123...
APIOPTIONS cachemaxage:600
DEF API=OpenWeatherMapAPI,cachemaxage:600 apikey=123... location=49....,8.... interval=3600 lang=de
FUUID 616abce4-f33f-eaf8-0d2c-605b2becf3ba602a
FVERSION 59_Weather.pm:v2.2.22-s27146/2023-01-29
INTERVAL 3600
LANG de
MODEL OpenWeatherMapAPI
NAME MeinWetter
NOTIFYDEV global
NR 1310
NTFY_ORDER 50-MeinWetter
STATE T: 32 °C F: 43 % W: 4 km/h P: 1008 hPa
TYPE Weather
VERSION v2.2.22
eventCount 250
OLDREADINGS:
READINGS:
2023-06-20 19:08:29 apiMaintainer Marko Oldenburg <fhemdevelopment@cooltux.net>
2023-06-20 19:08:29 apiVersion v3.2.7-stable
2023-02-02 18:47:10 city Hier
2023-06-20 19:08:29 cloudCover 83
2023-06-20 19:08:29 code 35
2023-06-20 19:08:29 condition Leichter Regen
2023-02-02 18:47:10 country DE
2023-06-20 19:08:29 current_date_time Di, 20 Jun 2023 19:08
2023-06-20 19:08:29 high_c 33
2023-06-20 19:08:29 humidity 43
2023-06-20 19:08:29 icon heavyrain
2023-06-20 19:08:29 iconAPI 10d
2023-06-20 19:08:29 lastError
2023-06-20 19:08:29 lat 49....
2023-06-20 19:08:29 long 8....
2023-06-20 19:08:29 low_c 30
2023-06-20 19:08:29 pressure 1008
2023-06-20 19:08:29 pubDate Di, 20 Jun 2023 19:08
2023-06-20 19:08:29 state T: 32 °C F: 43 % W: 4 km/h P: 1008 hPa
2023-06-20 19:08:29 status ok
2023-06-20 19:08:29 sunriseTime Di, 20 Jun 2023 05:21
2023-06-20 19:08:29 sunsetTime Di, 20 Jun 2023 21:33
2023-06-20 19:08:29 tempFeelsLike_c 32
2023-06-20 19:08:29 tempHigh 33
2023-06-20 19:08:29 tempLow 30
2023-06-20 19:08:29 temp_c 32
2023-06-20 19:08:29 temperature 32
2023-06-20 19:08:29 validity up-to-date
2023-06-20 19:08:29 visibility 10000
2023-06-20 19:08:29 wind 4
2023-06-20 19:08:29 wind_condition Wind: SW 4 km/h
2023-06-20 19:08:29 wind_direction 223
2023-06-20 19:08:29 wind_gust 9
2023-06-20 19:08:29 wind_speed 4
fhem:
LOCATION 49....,8....
allowCache 1
interfaces temperature;humidity;wind
readings:
Attributes:
alias Wetter
forecast hourly
forecastLimit 48
room 96_Wettervorhersage
verbose 0
Ich hätte statt des 2-stelligen Codes 35 den 3-stelligen Code 803 erwartet.
Gibt es eine Übersicht über die Module-internen 2-stelligen Codes?
Danke und viele Grüße,
Rigge
Das Modul Weather wurde ursprünglich mal ausschließlich für Yahoo Weather geschrieben, da war alles 2 stellig. Die später hinzugekommenen neuen Weather Quellen wurden dann als API Modul eingearbeitet. Hierzu werden nun einige Daten der neuen Quellen auf die alten Werte von Yahoo gemappt. So auch die Kondition Codes.
Ok, ich habe gefunden, wonach ich gesucht habe!
Im Quellcode von 59_Weather findet man in der Datei OpenWeatherMapAPI.pm (https://github.com/fhem/Weather/blob/dev/lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm) ab Zeile 126 die "Übersetzung" der OpenWeatherMapAPI Condition Codes in the früheren Yahoo Condition Codes:
my %codes = (
200 => 45,
201 => 45,
202 => 45,
210 => 4,
211 => 4,
212 => 3,
221 => 4,
230 => 45,
231 => 45,
232 => 45,
300 => 9,
301 => 9,
302 => 9,
310 => 9,
311 => 9,
312 => 9,
313 => 9,
314 => 9,
321 => 9,
500 => 35,
501 => 35,
502 => 35,
503 => 35,
504 => 35,
511 => 35,
520 => 35,
521 => 35,
522 => 35,
531 => 35,
600 => 14,
601 => 16,
602 => 13,
611 => 46,
612 => 46,
613 => 46,
615 => 5,
616 => 5,
620 => 14,
621 => 46,
622 => 42,
701 => 19,
711 => 22,
721 => 19,
731 => 23,
741 => 20,
751 => 23,
761 => 19,
762 => 3200,
771 => 1,
781 => 0,
800 => 32,
801 => 30,
802 => 26,
803 => 26,
804 => 28,
);
U.a. hier gibt es die Auflistung der Yahoo Weather Condition Codes (https://gist.github.com/bzerangue/805520) (Jul 23, 2017).
Code Description
0 tornado
1 tropical storm
2 hurricane
3 severe thunderstorms
4 thunderstorms
5 mixed rain and snow
6 mixed rain and sleet
7 mixed snow and sleet
8 freezing drizzle
9 drizzle
10 freezing rain
11 showers
12 showers
13 snow flurries
14 light snow showers
15 blowing snow
16 snow
17 hail
18 sleet
19 dust
20 foggy
21 haze
22 smoky
23 blustery
24 windy
25 cold
26 cloudy
27 mostly cloudy (night)
28 mostly cloudy (day)
29 partly cloudy (night)
30 partly cloudy (day)
31 clear (night)
32 sunny
33 fair (night)
34 fair (day)
35 mixed rain and hail
36 hot
37 isolated thunderstorms
38 scattered thunderstorms
39 scattered thunderstorms
40 scattered showers
41 heavy snow
42 scattered snow showers
43 heavy snow
44 partly cloudy
45 thundershowers
46 snow showers
47 isolated thundershowers
3200 not available
Danke und viele Grüße,
Rigge