import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonHourlyForecastData;
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonUVIndexData;
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonWeatherData;
-import org.openhab.binding.openweathermap.internal.dto.onecall.OpenWeatherMapOneCallAPIData;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.OpenWeatherMapOneCallHistAPIData;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallAPIData;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData;
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler;
import org.openhab.core.cache.ByteArrayFileCache;
import org.openhab.core.cache.ExpiringCacheMap;
*/
package org.openhab.binding.openweathermap.internal.dto;
+import org.openhab.binding.openweathermap.internal.dto.airpollution.List;
import org.openhab.binding.openweathermap.internal.dto.base.Coord;
/**
*/
public class OpenWeatherMapJsonAirPollutionData {
public Coord coord;
- public java.util.List<org.openhab.binding.openweathermap.internal.dto.airpollution.List> list;
+ public java.util.List<List> list;
}
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.openweathermap.internal.dto.base.Clouds;
import org.openhab.binding.openweathermap.internal.dto.base.Coord;
-import org.openhab.binding.openweathermap.internal.dto.base.Rain;
-import org.openhab.binding.openweathermap.internal.dto.base.Snow;
+import org.openhab.binding.openweathermap.internal.dto.base.Precipitation;
import org.openhab.binding.openweathermap.internal.dto.base.Weather;
import org.openhab.binding.openweathermap.internal.dto.base.Wind;
import org.openhab.binding.openweathermap.internal.dto.weather.Main;
private @Nullable Integer visibility;
private Wind wind;
private Clouds clouds;
- private @Nullable Rain rain;
- private @Nullable Snow snow;
+ private @Nullable Precipitation rain;
+ private @Nullable Precipitation snow;
private Integer dt;
private Sys sys;
private Integer id;
this.clouds = clouds;
}
- public @Nullable Rain getRain() {
+ public @Nullable Precipitation getRain() {
return rain;
}
- public void setRain(Rain rain) {
+ public void setRain(Precipitation rain) {
this.rain = rain;
}
- public @Nullable Snow getSnow() {
+ public @Nullable Precipitation getSnow() {
return snow;
}
- public void setSnow(Snow snow) {
+ public void setSnow(Precipitation snow) {
this.snow = snow;
}
--- /dev/null
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Alert;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Current;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Daily;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Hourly;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Minutely;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
+ * Settings:
+ * Annotation Style: GSON
+ * Use primitive types
+ * Use double numbers
+ * allow additional properties
+ *
+ * @author Wolfgang Klimt - Initial contribution
+ * @author Christoph Weitkamp - Added weather alerts
+ */
+public class OpenWeatherMapOneCallAPIData {
+ private double lat;
+ private double lon;
+ private String timezone;
+ @SerializedName("timezone_offset")
+ private int timezoneOffset;
+ private Current current;
+ private List<Minutely> minutely;
+ private List<Hourly> hourly;
+ private List<Daily> daily;
+
+ public @Nullable List<Alert> alerts;
+
+ public double getLat() {
+ return lat;
+ }
+
+ public void setLat(double lat) {
+ this.lat = lat;
+ }
+
+ public double getLon() {
+ return lon;
+ }
+
+ public void setLon(double lon) {
+ this.lon = lon;
+ }
+
+ public String getTimezone() {
+ return timezone;
+ }
+
+ public void setTimezone(String timezone) {
+ this.timezone = timezone;
+ }
+
+ public int getTimezoneOffset() {
+ return timezoneOffset;
+ }
+
+ public void setTimezoneOffset(int timezoneOffset) {
+ this.timezoneOffset = timezoneOffset;
+ }
+
+ public Current getCurrent() {
+ return current;
+ }
+
+ public void setCurrent(Current current) {
+ this.current = current;
+ }
+
+ public List<Minutely> getMinutely() {
+ return minutely;
+ }
+
+ public void setMinutely(List<Minutely> minutely) {
+ this.minutely = minutely;
+ }
+
+ public List<Hourly> getHourly() {
+ return hourly;
+ }
+
+ public void setHourly(List<Hourly> hourly) {
+ this.hourly = hourly;
+ }
+
+ public List<Daily> getDaily() {
+ return daily;
+ }
+
+ public void setDaily(List<Daily> daily) {
+ this.daily = daily;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto;
+
+import java.util.List;
+
+import org.openhab.binding.openweathermap.internal.dto.onecall.Current;
+import org.openhab.binding.openweathermap.internal.dto.onecallhist.Hourly;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
+ * Settings:
+ * Annotation Style: GSON
+ * Use primitive types
+ * Use double numbers
+ * allow additional properties
+ *
+ * @author Wolfgang Klimt - Initial contribution
+ */
+public class OpenWeatherMapOneCallHistAPIData {
+ private double lat;
+ private double lon;
+ private String timezone;
+ @SerializedName("timezone_offset")
+ private int timezoneOffset;
+ private Current current;
+ private List<Hourly> hourly = null;
+
+ public double getLat() {
+ return lat;
+ }
+
+ public void setLat(double lat) {
+ this.lat = lat;
+ }
+
+ public double getLon() {
+ return lon;
+ }
+
+ public void setLon(double lon) {
+ this.lon = lon;
+ }
+
+ public String getTimezone() {
+ return timezone;
+ }
+
+ public void setTimezone(String timezone) {
+ this.timezone = timezone;
+ }
+
+ public int getTimezoneOffset() {
+ return timezoneOffset;
+ }
+
+ public void setTimezoneOffset(int timezoneOffset) {
+ this.timezoneOffset = timezoneOffset;
+ }
+
+ public Current getCurrent() {
+ return current;
+ }
+
+ public void setCurrent(Current current) {
+ this.current = current;
+ }
+
+ public List<Hourly> getHourly() {
+ return hourly;
+ }
+
+ public void setHourly(List<Hourly> hourly) {
+ this.hourly = hourly;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto.base;
+
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Generated Plain Old Java Objects class for {@link Precipitation} from JSON.
+ *
+ * @author Christoph Weitkamp - Initial contribution
+ */
+public class Precipitation {
+ @SerializedName("1h")
+ private @Nullable Double oneHour;
+ @SerializedName("3h")
+ private @Nullable Double threeHours;
+
+ public @Nullable Double get1h() {
+ return oneHour;
+ }
+
+ public void set1h(Double oneHour) {
+ this.oneHour = oneHour;
+ }
+
+ public @Nullable Double get3h() {
+ return threeHours;
+ }
+
+ public void set3h(Double threeHours) {
+ this.threeHours = threeHours;
+ }
+
+ public Double getVolume() {
+ return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
+ }
+}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.base;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Generated Plain Old Java Objects class for {@link Rain} from JSON.
- *
- * @author Christoph Weitkamp - Initial contribution
- */
-public class Rain {
- @SerializedName("1h")
- private @Nullable Double oneHour;
- @SerializedName("3h")
- private @Nullable Double threeHours;
-
- public @Nullable Double get1h() {
- return oneHour;
- }
-
- public void set1h(Double oneHour) {
- this.oneHour = oneHour;
- }
-
- public @Nullable Double get3h() {
- return threeHours;
- }
-
- public void set3h(Double threeHours) {
- this.threeHours = threeHours;
- }
-
- public Double getVolume() {
- return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.base;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Generated Plain Old Java Objects class for {@link Snow} from JSON.
- *
- * @author Christoph Weitkamp - Initial contribution
- */
-public class Snow {
- @SerializedName("1h")
- private @Nullable Double oneHour;
- @SerializedName("3h")
- private @Nullable Double threeHours;
-
- public @Nullable Double get1h() {
- return oneHour;
- }
-
- public void set1h(Double oneHour) {
- this.oneHour = oneHour;
- }
-
- public @Nullable Double get3h() {
- return threeHours;
- }
-
- public void set3h(Double threeHours) {
- this.threeHours = threeHours;
- }
-
- public Double getVolume() {
- return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
- }
-}
this.temp = temp;
}
- public @Nullable FeelsLikeTemp getFeelsLikeTemp() {
+ public @Nullable FeelsLikeTemp getFeelsLike() {
return feelsLikeTemp;
}
- public void setFeelsLikeTemp(FeelsLikeTemp feelsLikeTemp) {
+ public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
this.feelsLikeTemp = feelsLikeTemp;
}
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.openweathermap.internal.dto.base.Clouds;
-import org.openhab.binding.openweathermap.internal.dto.base.Rain;
-import org.openhab.binding.openweathermap.internal.dto.base.Snow;
+import org.openhab.binding.openweathermap.internal.dto.base.Precipitation;
import org.openhab.binding.openweathermap.internal.dto.base.Weather;
import org.openhab.binding.openweathermap.internal.dto.base.Wind;
import org.openhab.binding.openweathermap.internal.dto.weather.Main;
private java.util.List<Weather> weather;
private Clouds clouds;
private Wind wind;
- private @Nullable Rain rain;
- private @Nullable Snow snow;
+ private @Nullable Precipitation rain;
+ private @Nullable Precipitation snow;
private Sys sys;
@SerializedName("dt_txt")
private String dtTxt;
this.wind = wind;
}
- public @Nullable Rain getRain() {
+ public @Nullable Precipitation getRain() {
return rain;
}
- public void setRain(Rain rain) {
+ public void setRain(Precipitation rain) {
this.rain = rain;
}
- public @Nullable Snow getSnow() {
+ public @Nullable Precipitation getSnow() {
return snow;
}
- public void setSnow(Snow snow) {
+ public void setSnow(Precipitation snow) {
this.snow = snow;
}
import java.util.List;
-import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* @author Wolfgang Klimt - Initial contribution
*/
public class Current {
-
- @SerializedName("dt")
- @Expose
private int dt;
- @SerializedName("sunrise")
- @Expose
private int sunrise;
- @SerializedName("sunset")
- @Expose
private int sunset;
- @SerializedName("temp")
- @Expose
private double temp;
@SerializedName("feels_like")
- @Expose
private double feelsLike;
- @SerializedName("pressure")
- @Expose
private int pressure;
- @SerializedName("humidity")
- @Expose
private int humidity;
@SerializedName("dew_point")
- @Expose
private double dewPoint;
- @SerializedName("uvi")
- @Expose
private double uvi;
- @SerializedName("clouds")
- @Expose
private int clouds;
- @SerializedName("visibility")
- @Expose
private int visibility;
@SerializedName("wind_speed")
- @Expose
private double windSpeed;
@SerializedName("wind_deg")
- @Expose
private int windDeg;
@SerializedName("wind_gust")
- @Expose
private double windGust;
- @SerializedName("weather")
- @Expose
private List<Weather> weather = null;
- @SerializedName("rain")
- @Expose
- private Rain rain;
- @SerializedName("snow")
- @Expose
- private Snow snow;
+ private Precipitation rain;
+ private Precipitation snow;
public int getDt() {
return dt;
this.weather = weather;
}
- public Rain getRain() {
+ public Precipitation getRain() {
return rain;
}
- public void setRain(Rain rain) {
+ public void setRain(Precipitation rain) {
this.rain = rain;
}
- public Snow getSnow() {
+ public Precipitation getSnow() {
return snow;
}
- public void setSnow(Snow snow) {
+ public void setSnow(Precipitation snow) {
this.snow = snow;
}
}
import java.util.List;
-import com.google.gson.annotations.Expose;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.FeelsLikeTemp;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.Temp;
+
import com.google.gson.annotations.SerializedName;
/**
* @author Wolfgang Klimt - Initial contribution
*/
public class Daily {
-
- @SerializedName("dt")
- @Expose
private int dt;
- @SerializedName("sunrise")
- @Expose
private int sunrise;
- @SerializedName("sunset")
- @Expose
private int sunset;
- @SerializedName("temp")
- @Expose
private Temp temp;
@SerializedName("feels_like")
- @Expose
- private FeelsLike feelsLike;
- @SerializedName("pressure")
- @Expose
+ private FeelsLikeTemp feelsLikeTemp;
private int pressure;
- @SerializedName("humidity")
- @Expose
private int humidity;
@SerializedName("dew_point")
- @Expose
private double dewPoint;
@SerializedName("wind_speed")
- @Expose
private double windSpeed;
@SerializedName("wind_deg")
- @Expose
private int windDeg;
@SerializedName("wind_gust")
- @Expose
private double windGust;
- @SerializedName("weather")
- @Expose
private List<Weather> weather = null;
- @SerializedName("clouds")
- @Expose
private int clouds;
- @SerializedName("pop")
- @Expose
private double pop;
- @SerializedName("visibility")
- @Expose
private int visibility;
- @SerializedName("rain")
- @Expose
private double rain;
- @SerializedName("snow")
- @Expose
private double snow;
- @SerializedName("uvi")
- @Expose
private double uvi;
public int getDt() {
this.temp = temp;
}
- public FeelsLike getFeelsLike() {
- return feelsLike;
+ public FeelsLikeTemp getFeelsLike() {
+ return feelsLikeTemp;
}
- public void setFeelsLike(FeelsLike feelsLike) {
- this.feelsLike = feelsLike;
+ public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
+ this.feelsLikeTemp = feelsLikeTemp;
}
public int getPressure() {
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class FeelsLike {
-
- @SerializedName("day")
- @Expose
- private double day;
- @SerializedName("night")
- @Expose
- private double night;
- @SerializedName("eve")
- @Expose
- private double eve;
- @SerializedName("morn")
- @Expose
- private double morn;
-
- public double getDay() {
- return day;
- }
-
- public void setDay(double day) {
- this.day = day;
- }
-
- public double getNight() {
- return night;
- }
-
- public void setNight(double night) {
- this.night = night;
- }
-
- public double getEve() {
- return eve;
- }
-
- public void setEve(double eve) {
- this.eve = eve;
- }
-
- public double getMorn() {
- return morn;
- }
-
- public void setMorn(double morn) {
- this.morn = morn;
- }
-}
import java.util.List;
-import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* @author Wolfgang Klimt - Initial contribution
*/
public class Hourly {
-
- @SerializedName("dt")
- @Expose
private int dt;
- @SerializedName("temp")
- @Expose
private double temp;
@SerializedName("feels_like")
- @Expose
private double feelsLike;
- @SerializedName("pressure")
- @Expose
private int pressure;
- @SerializedName("humidity")
- @Expose
private int humidity;
@SerializedName("dew_point")
- @Expose
private double dewPoint;
- @SerializedName("clouds")
- @Expose
private int clouds;
- @SerializedName("visibility")
- @Expose
private int visibility;
@SerializedName("wind_speed")
- @Expose
private double windSpeed;
@SerializedName("wind_deg")
- @Expose
private int windDeg;
@SerializedName("wind_gust")
- @Expose
private double windGust;
- @SerializedName("weather")
- @Expose
private List<Weather> weather = null;
- @SerializedName("pop")
- @Expose
private double pop;
- @SerializedName("rain")
- @Expose
- private Rain rain;
- @SerializedName("snow")
- @Expose
- private Snow snow;
+ private Precipitation rain;
+ private Precipitation snow;
public int getDt() {
return dt;
this.pop = pop;
}
- public Rain getRain() {
+ public Precipitation getRain() {
return rain;
}
- public void setRain(Rain rain) {
+ public void setRain(Precipitation rain) {
this.rain = rain;
}
- public Snow getSnow() {
+ public Precipitation getSnow() {
return snow;
}
- public void setSnow(Snow snow) {
+ public void setSnow(Precipitation snow) {
this.snow = snow;
}
}
*/
package org.openhab.binding.openweathermap.internal.dto.onecall;
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
/**
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
* Settings:
* @author Wolfgang Klimt - Initial contribution
*/
public class Minutely {
-
- @SerializedName("dt")
- @Expose
private int dt;
- @SerializedName("precipitation")
- @Expose
private double precipitation;
public int getDt() {
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- * @author Christoph Weitkamp - Added weather alerts
- */
-public class OpenWeatherMapOneCallAPIData {
-
- private double lat;
- private double lon;
- private String timezone;
- @SerializedName("timezone_offset")
- private int timezoneOffset;
- private Current current;
- private List<Minutely> minutely;
- private List<Hourly> hourly;
- private List<Daily> daily;
-
- public @Nullable List<Alert> alerts;
-
- public double getLat() {
- return lat;
- }
-
- public void setLat(double lat) {
- this.lat = lat;
- }
-
- public double getLon() {
- return lon;
- }
-
- public void setLon(double lon) {
- this.lon = lon;
- }
-
- public String getTimezone() {
- return timezone;
- }
-
- public void setTimezone(String timezone) {
- this.timezone = timezone;
- }
-
- public int getTimezoneOffset() {
- return timezoneOffset;
- }
-
- public void setTimezoneOffset(int timezoneOffset) {
- this.timezoneOffset = timezoneOffset;
- }
-
- public Current getCurrent() {
- return current;
- }
-
- public void setCurrent(Current current) {
- this.current = current;
- }
-
- public List<Minutely> getMinutely() {
- return minutely;
- }
-
- public void setMinutely(List<Minutely> minutely) {
- this.minutely = minutely;
- }
-
- public List<Hourly> getHourly() {
- return hourly;
- }
-
- public void setHourly(List<Hourly> hourly) {
- this.hourly = hourly;
- }
-
- public List<Daily> getDaily() {
- return daily;
- }
-
- public void setDaily(List<Daily> daily) {
- this.daily = daily;
- }
-}
--- /dev/null
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto.onecall;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
+ * Settings:
+ * Annotation Style: GSON
+ * Use primitive types
+ * Use double numbers
+ * allow additional properties
+ *
+ * @author Wolfgang Klimt - Initial contribution
+ */
+public class Precipitation {
+ @SerializedName("1h")
+ private double oneHour;
+
+ public double get1h() {
+ return oneHour;
+ }
+
+ public void set1h(double oneHour) {
+ this.oneHour = oneHour;
+ }
+}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Rain {
-
- @SerializedName("1h")
- @Expose
- private double _1h;
-
- public double get1h() {
- return _1h;
- }
-
- public void set1h(double _1h) {
- this._1h = _1h;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Snow {
-
- @SerializedName("1h")
- @Expose
- private double _1h;
-
- public double get1h() {
- return _1h;
- }
-
- public void set1h(double _1h) {
- this._1h = _1h;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Temp {
-
- @SerializedName("day")
- @Expose
- private double day;
- @SerializedName("min")
- @Expose
- private double min;
- @SerializedName("max")
- @Expose
- private double max;
- @SerializedName("night")
- @Expose
- private double night;
- @SerializedName("eve")
- @Expose
- private double eve;
- @SerializedName("morn")
- @Expose
- private double morn;
-
- public double getDay() {
- return day;
- }
-
- public void setDay(double day) {
- this.day = day;
- }
-
- public double getMin() {
- return min;
- }
-
- public void setMin(double min) {
- this.min = min;
- }
-
- public double getMax() {
- return max;
- }
-
- public void setMax(double max) {
- this.max = max;
- }
-
- public double getNight() {
- return night;
- }
-
- public void setNight(double night) {
- this.night = night;
- }
-
- public double getEve() {
- return eve;
- }
-
- public void setEve(double eve) {
- this.eve = eve;
- }
-
- public double getMorn() {
- return morn;
- }
-
- public void setMorn(double morn) {
- this.morn = morn;
- }
-}
*/
package org.openhab.binding.openweathermap.internal.dto.onecall;
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
/**
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
* Settings:
* @author Wolfgang Klimt - Initial contribution
*/
public class Weather {
-
- @SerializedName("id")
- @Expose
private int id;
- @SerializedName("main")
- @Expose
private String main;
- @SerializedName("description")
- @Expose
private String description;
- @SerializedName("icon")
- @Expose
private String icon;
public int getId() {
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import java.util.List;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Current {
-
- @SerializedName("dt")
- @Expose
- private int dt;
- @SerializedName("sunrise")
- @Expose
- private int sunrise;
- @SerializedName("sunset")
- @Expose
- private int sunset;
- @SerializedName("temp")
- @Expose
- private double temp;
- @SerializedName("feels_like")
- @Expose
- private double feelsLike;
- @SerializedName("pressure")
- @Expose
- private int pressure;
- @SerializedName("humidity")
- @Expose
- private int humidity;
- @SerializedName("dew_point")
- @Expose
- private double dewPoint;
- @SerializedName("uvi")
- @Expose
- private double uvi;
- @SerializedName("clouds")
- @Expose
- private int clouds;
- @SerializedName("visibility")
- @Expose
- private int visibility;
- @SerializedName("wind_speed")
- @Expose
- private double windSpeed;
- @SerializedName("wind_deg")
- @Expose
- private int windDeg;
- @SerializedName("wind_gust")
- @Expose
- private double windGust;
- @SerializedName("weather")
- @Expose
- private List<Weather> weather = null;
- @SerializedName("rain")
- @Expose
- private Rain rain;
- @SerializedName("snow")
- @Expose
- private Snow snow;
-
- public int getDt() {
- return dt;
- }
-
- public void setDt(int dt) {
- this.dt = dt;
- }
-
- public int getSunrise() {
- return sunrise;
- }
-
- public void setSunrise(int sunrise) {
- this.sunrise = sunrise;
- }
-
- public int getSunset() {
- return sunset;
- }
-
- public void setSunset(int sunset) {
- this.sunset = sunset;
- }
-
- public double getTemp() {
- return temp;
- }
-
- public void setTemp(double temp) {
- this.temp = temp;
- }
-
- public double getFeelsLike() {
- return feelsLike;
- }
-
- public void setFeelsLike(double feelsLike) {
- this.feelsLike = feelsLike;
- }
-
- public int getPressure() {
- return pressure;
- }
-
- public void setPressure(int pressure) {
- this.pressure = pressure;
- }
-
- public int getHumidity() {
- return humidity;
- }
-
- public void setHumidity(int humidity) {
- this.humidity = humidity;
- }
-
- public double getDewPoint() {
- return dewPoint;
- }
-
- public void setDewPoint(double dewPoint) {
- this.dewPoint = dewPoint;
- }
-
- public double getUvi() {
- return uvi;
- }
-
- public void setUvi(double uvi) {
- this.uvi = uvi;
- }
-
- public int getClouds() {
- return clouds;
- }
-
- public void setClouds(int clouds) {
- this.clouds = clouds;
- }
-
- public int getVisibility() {
- return visibility;
- }
-
- public void setVisibility(int visibility) {
- this.visibility = visibility;
- }
-
- public double getWindSpeed() {
- return windSpeed;
- }
-
- public void setWindSpeed(double windSpeed) {
- this.windSpeed = windSpeed;
- }
-
- public int getWindDeg() {
- return windDeg;
- }
-
- public void setWindDeg(int windDeg) {
- this.windDeg = windDeg;
- }
-
- public double getWindGust() {
- return windGust;
- }
-
- public void setWindGust(double windGust) {
- this.windGust = windGust;
- }
-
- public List<Weather> getWeather() {
- return weather;
- }
-
- public void setWeather(List<Weather> weather) {
- this.weather = weather;
- }
-
- public Rain getRain() {
- return rain;
- }
-
- public void setRain(Rain rain) {
- this.rain = rain;
- }
-
- public Snow getSnow() {
- return snow;
- }
-
- public void setSnow(Snow snow) {
- this.snow = snow;
- }
-}
import java.util.List;
-import com.google.gson.annotations.Expose;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Precipitation;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Weather;
+
import com.google.gson.annotations.SerializedName;
/**
* @author Wolfgang Klimt - Initial contribution
*/
public class Hourly {
-
- @SerializedName("dt")
- @Expose
private int dt;
- @SerializedName("temp")
- @Expose
private double temp;
@SerializedName("feels_like")
- @Expose
private double feelsLike;
- @SerializedName("pressure")
- @Expose
private int pressure;
- @SerializedName("humidity")
- @Expose
private int humidity;
@SerializedName("dew_point")
- @Expose
private double dewPoint;
- @SerializedName("clouds")
- @Expose
private int clouds;
- @SerializedName("visibility")
- @Expose
private int visibility;
@SerializedName("wind_speed")
- @Expose
private double windSpeed;
@SerializedName("wind_deg")
- @Expose
private int windDeg;
@SerializedName("wind_gust")
- @Expose
private double windGust;
- @SerializedName("weather")
- @Expose
private List<Weather> weather = null;
- @SerializedName("rain")
- @Expose
- private Rain rain;
- @SerializedName("snow")
- @Expose
- private Snow snow;
+ private Precipitation rain;
+ private Precipitation snow;
public int getDt() {
return dt;
this.weather = weather;
}
- public Rain getRain() {
+ public Precipitation getRain() {
return rain;
}
- public void setRain(Rain rain) {
+ public void setRain(Precipitation rain) {
this.rain = rain;
}
- public Snow getSnow() {
+ public Precipitation getSnow() {
return snow;
}
- public void setSnow(Snow snow) {
+ public void setSnow(Precipitation snow) {
this.snow = snow;
}
}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import java.util.List;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class OpenWeatherMapOneCallHistAPIData {
-
- @SerializedName("lat")
- @Expose
- private double lat;
- @SerializedName("lon")
- @Expose
- private double lon;
- @SerializedName("timezone")
- @Expose
- private String timezone;
- @SerializedName("timezone_offset")
- @Expose
- private int timezoneOffset;
- @SerializedName("current")
- @Expose
- private Current current;
- @SerializedName("hourly")
- @Expose
- private List<Hourly> hourly = null;
-
- public double getLat() {
- return lat;
- }
-
- public void setLat(double lat) {
- this.lat = lat;
- }
-
- public double getLon() {
- return lon;
- }
-
- public void setLon(double lon) {
- this.lon = lon;
- }
-
- public String getTimezone() {
- return timezone;
- }
-
- public void setTimezone(String timezone) {
- this.timezone = timezone;
- }
-
- public int getTimezoneOffset() {
- return timezoneOffset;
- }
-
- public void setTimezoneOffset(int timezoneOffset) {
- this.timezoneOffset = timezoneOffset;
- }
-
- public Current getCurrent() {
- return current;
- }
-
- public void setCurrent(Current current) {
- this.current = current;
- }
-
- public List<Hourly> getHourly() {
- return hourly;
- }
-
- public void setHourly(List<Hourly> hourly) {
- this.hourly = hourly;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Rain {
-
- @SerializedName("1h")
- @Expose
- private double _1h;
-
- public double get1h() {
- return _1h;
- }
-
- public void set1h(double _1h) {
- this._1h = _1h;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Snow {
-
- @SerializedName("1h")
- @Expose
- private double _1h;
-
- public double get1h() {
- return _1h;
- }
-
- public void set1h(double _1h) {
- this._1h = _1h;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Weather {
-
- @SerializedName("id")
- @Expose
- private int id;
- @SerializedName("main")
- @Expose
- private String main;
- @SerializedName("description")
- @Expose
- private String description;
- @SerializedName("icon")
- @Expose
- private String icon;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getMain() {
- return main;
- }
-
- public void setMain(String main) {
- this.main = main;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-}
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.openweathermap.internal.config.OpenWeatherMapOneCallConfiguration;
import org.openhab.binding.openweathermap.internal.connection.OpenWeatherMapConnection;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallAPIData;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.FeelsLikeTemp;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.Temp;
import org.openhab.binding.openweathermap.internal.dto.onecall.Alert;
-import org.openhab.binding.openweathermap.internal.dto.onecall.FeelsLike;
-import org.openhab.binding.openweathermap.internal.dto.onecall.OpenWeatherMapOneCallAPIData;
-import org.openhab.binding.openweathermap.internal.dto.onecall.Rain;
-import org.openhab.binding.openweathermap.internal.dto.onecall.Snow;
-import org.openhab.binding.openweathermap.internal.dto.onecall.Temp;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Precipitation;
import org.openhab.core.i18n.CommunicationException;
import org.openhab.core.i18n.ConfigurationException;
import org.openhab.core.i18n.TimeZoneProvider;
state = getDecimalTypeState(localWeatherData.getCurrent().getUvi());
break;
case CHANNEL_RAIN:
- Rain rain = localWeatherData.getCurrent().getRain();
+ Precipitation rain = localWeatherData.getCurrent().getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
break;
case CHANNEL_SNOW:
- Snow snow = localWeatherData.getCurrent().getSnow();
+ Precipitation snow = localWeatherData.getCurrent().getSnow();
state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
break;
case CHANNEL_VISIBILITY:
state = getQuantityTypeState(forecastData.getPop() * 100.0, PERCENT);
break;
case CHANNEL_RAIN:
- Rain rain = forecastData.getRain();
+ Precipitation rain = forecastData.getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
break;
case CHANNEL_SNOW:
- Snow snow = forecastData.getSnow();
+ Precipitation snow = forecastData.getSnow();
state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
break;
default:
.get(count);
State state = UnDefType.UNDEF;
Temp temp;
- FeelsLike feelsLike;
+ FeelsLikeTemp feelsLike;
switch (channelId) {
case CHANNEL_TIME_STAMP:
state = getDateTimeTypeState(forecastData.getDt());
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.openweathermap.internal.config.OpenWeatherMapOneCallHistoryConfiguration;
import org.openhab.binding.openweathermap.internal.connection.OpenWeatherMapConnection;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Precipitation;
import org.openhab.binding.openweathermap.internal.dto.onecallhist.Hourly;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.OpenWeatherMapOneCallHistAPIData;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.Rain;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.Snow;
import org.openhab.core.i18n.CommunicationException;
import org.openhab.core.i18n.ConfigurationException;
import org.openhab.core.i18n.TimeZoneProvider;
state = getDecimalTypeState(localWeatherData.getCurrent().getUvi());
break;
case CHANNEL_RAIN:
- Rain rain = localWeatherData.getCurrent().getRain();
+ Precipitation rain = localWeatherData.getCurrent().getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
break;
case CHANNEL_SNOW:
- Snow snow = localWeatherData.getCurrent().getSnow();
+ Precipitation snow = localWeatherData.getCurrent().getSnow();
state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
break;
case CHANNEL_VISIBILITY:
State tempstate = new QuantityType<>(historyData.getVisibility(), METRE).toUnit(KILO(METRE));
state = (tempstate == null ? state : tempstate);
case CHANNEL_RAIN:
- Rain rain = historyData.getRain();
+ Precipitation rain = historyData.getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
break;
case CHANNEL_SNOW:
- Snow snow = historyData.getSnow();
+ Precipitation snow = historyData.getSnow();
state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
break;
default:
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonDailyForecastData;
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonHourlyForecastData;
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonWeatherData;
-import org.openhab.binding.openweathermap.internal.dto.base.Rain;
-import org.openhab.binding.openweathermap.internal.dto.base.Snow;
+import org.openhab.binding.openweathermap.internal.dto.base.Precipitation;
import org.openhab.binding.openweathermap.internal.dto.forecast.daily.FeelsLikeTemp;
import org.openhab.core.config.core.Configuration;
import org.openhab.core.i18n.CommunicationException;
state = getQuantityTypeState(localWeatherData.getClouds().getAll(), PERCENT);
break;
case CHANNEL_RAIN:
- Rain rain = localWeatherData.getRain();
+ Precipitation rain = localWeatherData.getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.getVolume(), MILLI(METRE));
break;
case CHANNEL_SNOW:
- Snow snow = localWeatherData.getSnow();
+ Precipitation snow = localWeatherData.getSnow();
state = getQuantityTypeState(snow == null ? 0 : snow.getVolume(), MILLI(METRE));
break;
case CHANNEL_VISIBILITY:
state = getQuantityTypeState(forecastData.getClouds().getAll(), PERCENT);
break;
case CHANNEL_RAIN:
- Rain rain = forecastData.getRain();
+ Precipitation rain = forecastData.getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.getVolume(), MILLI(METRE));
break;
case CHANNEL_SNOW:
- Snow snow = forecastData.getSnow();
+ Precipitation snow = forecastData.getSnow();
state = getQuantityTypeState(snow == null ? 0 : snow.getVolume(), MILLI(METRE));
break;
}
state = getQuantityTypeState(forecastData.getTemp().getMax(), CELSIUS);
break;
case CHANNEL_APPARENT_TEMPERATURE:
- FeelsLikeTemp feelsLikeTemp = forecastData.getFeelsLikeTemp();
+ FeelsLikeTemp feelsLikeTemp = forecastData.getFeelsLike();
if (feelsLikeTemp != null) {
state = getQuantityTypeState(feelsLikeTemp.getDay(), CELSIUS);
}