Zitat von jentz1986
Beitrag anzeigen
ich würde es gut finden, wenn Du es so umsetzen würdest. Zusätzlich könnte man noch ein Warnung is Log schreiben, dass das erste Element verwendet wurde.
Noch eine andere Frage:
Wie stellst Du dir das struct vor? Ähnlich dem für das darksky-Plugin? Dort gibt es ein vollständiges, aber auch riesiges struct.
Da die verfügbaren Elemente/Werte im Forecast ja immer gleich sind, könnte man sich auch einen Trennung des Matchstrings vorstellen.
d.h. man könnte den ersten Teil des Matchstrings bspw "day/1" weiter oben im Itembaum definieren und dann vererben. Dann könnte man kleinere structs nur für die verfügbaren Werte machen.
Hier mal ein Beispiel:
Code:
forecast_daily1: # day after tomorrow (max index 4 = 5 days ahead) owm_matchstring@home: forecast/daily/1 time: type: num owm_matchstring@home: dt temp: type: num owm_matchstring@home: main/temp temp_min: type: num owm_matchstring@home: main/temp_min temp_max: type: num owm_matchstring@home: main/temp_max pressure: type: num owm_matchstring@home: main/pressure grnd_level: type: num owm_matchstring@home: main/grnd_level sea_level: type: num owm_matchstring@home: main/sea_level humidity: type: num owm_matchstring@home: main/humidity wind_speed: type: num owm_matchstring@home: wind/speed wind_deg: type: num owm_matchstring@home: wind/deg clouds: type: num owm_matchstring@home: clouds/all
Code:
forecast_daily1: # day after tomorrow (max index 4 = 5 days ahead) owm_matchstring@home: forecast/daily/1 struct: forecast_daily forecast_daily2: owm_matchstring@home: forecast/daily/2 struct: forecast_daily
Code:
struct forecast_daily: time: type: num owm_matchstring@home: dt temp: type: num owm_matchstring@home: main/temp temp_min: type: num owm_matchstring@home: main/temp_min temp_max: type: num owm_matchstring@home: main/temp_max pressure: type: num owm_matchstring@home: main/pressure grnd_level: type: num owm_matchstring@home: main/grnd_level sea_level: type: num owm_matchstring@home: main/sea_level humidity: type: num owm_matchstring@home: main/humidity wind_speed: type: num owm_matchstring@home: wind/speed wind_deg: type: num owm_matchstring@home: wind/deg clouds: type: num owm_matchstring@home: clouds/all
Kommentar