ich speichere in der Variable "weatherstring" die Daten aus der One-Call-API der OpenWeatherMap ab. Absließend möchte ich einzelne Werte einigen Items zuweisen. Beispiel:
Code: Alles auswählen
postUpdate(LocalWeatherAndForecastForecastHours01SnowTest, transform("JSONPATH", "$.hourly.[1].snow.1h", weatherString))
Code: Alles auswählen
{"dt":1609938000,"temp":0,"feels_like":-5.2,"pressure":1009,"humidity":97,"dew_point":-0.37,"uvi":0.4,"clouds":75,"visibility":109,"wind_speed":4.5,"wind_deg":270,"weather":[{"id":601,"main":"Snow","description":"Schnee","icon":"13d"}],"pop":0.95,"snow":{"1h":0.54}},
Code: Alles auswählen
{"dt":1609992000,"temp":-2.24,"feels_like":-6.72,"pressure":1017,"humidity":98,"dew_point":-2.86,"uvi":0,"clouds":96,"visibility":624,"wind_speed":3.08,"wind_deg":253,"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"pop":0.64},
Code: Alles auswählen
2021-01-06 16:06:22.334 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert '{"lat":48.3994, >>vollständiger_Inhalt_der_Variable_weatherstring<< }]}' to a state type which item 'LocalWeatherAndForecastForecastHours01SnowTest' accepts: [DecimalType, QuantityType, UnDefType].
Viele Grüße
Martin