mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[openweathermap] Code clean-up (#16369)
* [openweathermap] Remove UV Index Thing The UV Index API has been retired on 1st April 2021 and replaced by OneCall API 3.0. Therefore, this Thing is not working anymore and can be removed from the source code. * [openweathermap] Clean-Up DTOs - Improve class JavaDoc. - Remove setters as they are not needed. (All OWM APIs get required the data as query params.) Signed-off-by: Florian Hotze <florianh_dev@icloud.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
267063cffe
commit
15ac04e5cc
@ -21,17 +21,6 @@ You can add as many `weather-and-forecast` things for different locations to you
|
|||||||
The binding tries to request daily forecast data from the OpenWeatherMap API.
|
The binding tries to request daily forecast data from the OpenWeatherMap API.
|
||||||
If the request fails, all daily forecast channel groups will be removed from the thing and further request will be omitted.
|
If the request fails, all daily forecast channel groups will be removed from the thing and further request will be omitted.
|
||||||
|
|
||||||
### Current UV Index And Forecast
|
|
||||||
|
|
||||||
::: tip Note
|
|
||||||
The product will retire on 1st April 2021, please find UV data in the One Call API.
|
|
||||||
One Call API includes current, hourly forecast for 7 days and 5 days historical UV data.
|
|
||||||
:::
|
|
||||||
|
|
||||||
The third thing `uvindex` supports the [current UV Index](https://openweathermap.org/api/uvi#current) and [forecasted UV Index](https://openweathermap.org/api/uvi#forecast) for a specific location.
|
|
||||||
It requires coordinates of the location of your interest.
|
|
||||||
You can add as much `uvindex` things for different locations to your setup as you like to observe.
|
|
||||||
|
|
||||||
### Current And Forecasted Air Pollution
|
### Current And Forecasted Air Pollution
|
||||||
|
|
||||||
Another thing is the `air-pollution` which provides the [current air pollution](https://openweathermap.org/api/air-pollution) and [forecasted air pollution](https://openweathermap.org/api/air-pollution#forecast) for a specific location.
|
Another thing is the `air-pollution` which provides the [current air pollution](https://openweathermap.org/api/air-pollution) and [forecasted air pollution](https://openweathermap.org/api/air-pollution#forecast) for a specific location.
|
||||||
@ -84,15 +73,6 @@ Once the system location will be changed, the background discovery updates the c
|
|||||||
|
|
||||||
Once the parameters `forecastHours` or `forecastDays` will be changed, the available channel groups on the thing will be created or removed accordingly.
|
Once the parameters `forecastHours` or `forecastDays` will be changed, the available channel groups on the thing will be created or removed accordingly.
|
||||||
|
|
||||||
### Current UV Index And Forecast
|
|
||||||
|
|
||||||
| Parameter | Description |
|
|
||||||
|----------------|----------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| location | Location of weather in geographical coordinates (latitude/longitude/altitude). **Mandatory** |
|
|
||||||
| forecastDays | Number of days for UV Index forecast (including todays forecast). Optional, the default value is 6 (min="1", max="8", step="1"). |
|
|
||||||
|
|
||||||
Once the parameter `forecastDays` will be changed, the available channel groups on the thing will be created or removed accordingly.
|
|
||||||
|
|
||||||
### Current Air Pollution And Forecast
|
### Current Air Pollution And Forecast
|
||||||
|
|
||||||
| Parameter | Description |
|
| Parameter | Description |
|
||||||
@ -257,15 +237,6 @@ In a future release, the `forecastToday` to `forecastDay7` channel groups won't
|
|||||||
| alerts1, alerts2, ... | expires | DateTime | End Date and Time for which the warning is valid. |
|
| alerts1, alerts2, ... | expires | DateTime | End Date and Time for which the warning is valid. |
|
||||||
| alerts1, alerts2, ... | source | String | The source of the alert. **Advanced** |
|
| alerts1, alerts2, ... | source | String | The source of the alert. **Advanced** |
|
||||||
|
|
||||||
### UV Index
|
|
||||||
|
|
||||||
| Channel Group ID | Channel ID | Item Type | Description |
|
|
||||||
|-----------------------------------------------------------|------------|-----------|--------------------------------------|
|
|
||||||
| current, forecastTomorrow, forecastDay2, ... forecastDay7 | time-stamp | DateTime | Date of data observation / forecast. |
|
|
||||||
| current, forecastTomorrow, forecastDay2, ... forecastDay7 | uvindex | Number | Current or forecasted UV Index. |
|
|
||||||
|
|
||||||
The `uvindex` channel is also available in the current data and the daily forecast of the One Call API.
|
|
||||||
|
|
||||||
### Air Pollution
|
### Air Pollution
|
||||||
|
|
||||||
| Channel Group ID | Channel ID | Item Type | Description |
|
| Channel Group ID | Channel ID | Item Type | Description |
|
||||||
|
@ -35,7 +35,6 @@ public class OpenWeatherMapBindingConstants {
|
|||||||
// Thing
|
// Thing
|
||||||
public static final ThingTypeUID THING_TYPE_WEATHER_AND_FORECAST = new ThingTypeUID(BINDING_ID,
|
public static final ThingTypeUID THING_TYPE_WEATHER_AND_FORECAST = new ThingTypeUID(BINDING_ID,
|
||||||
"weather-and-forecast");
|
"weather-and-forecast");
|
||||||
public static final ThingTypeUID THING_TYPE_UVINDEX = new ThingTypeUID(BINDING_ID, "uvindex");
|
|
||||||
public static final ThingTypeUID THING_TYPE_AIR_POLLUTION = new ThingTypeUID(BINDING_ID, "air-pollution");
|
public static final ThingTypeUID THING_TYPE_AIR_POLLUTION = new ThingTypeUID(BINDING_ID, "air-pollution");
|
||||||
// One Call API forecast
|
// One Call API forecast
|
||||||
public static final ThingTypeUID THING_TYPE_ONECALL_WEATHER_AND_FORECAST = new ThingTypeUID(BINDING_ID, "onecall");
|
public static final ThingTypeUID THING_TYPE_ONECALL_WEATHER_AND_FORECAST = new ThingTypeUID(BINDING_ID, "onecall");
|
||||||
@ -53,8 +52,6 @@ public class OpenWeatherMapBindingConstants {
|
|||||||
"hourlyForecast");
|
"hourlyForecast");
|
||||||
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_DAILY_FORECAST = new ChannelGroupTypeUID(BINDING_ID,
|
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_DAILY_FORECAST = new ChannelGroupTypeUID(BINDING_ID,
|
||||||
"dailyForecast");
|
"dailyForecast");
|
||||||
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_UVINDEX_FORECAST = new ChannelGroupTypeUID(BINDING_ID,
|
|
||||||
"uvindexForecast");
|
|
||||||
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_AIR_POLLUTION_FORECAST = new ChannelGroupTypeUID(
|
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_AIR_POLLUTION_FORECAST = new ChannelGroupTypeUID(
|
||||||
BINDING_ID, "airPollutionForecast");
|
BINDING_ID, "airPollutionForecast");
|
||||||
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_ONECALL_MINUTELY_FORECAST = new ChannelGroupTypeUID(
|
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_ONECALL_MINUTELY_FORECAST = new ChannelGroupTypeUID(
|
||||||
@ -73,7 +70,6 @@ public class OpenWeatherMapBindingConstants {
|
|||||||
public static final String CHANNEL_GROUP_CURRENT_WEATHER = "current";
|
public static final String CHANNEL_GROUP_CURRENT_WEATHER = "current";
|
||||||
public static final String CHANNEL_GROUP_FORECAST_TODAY = "forecastToday";
|
public static final String CHANNEL_GROUP_FORECAST_TODAY = "forecastToday";
|
||||||
public static final String CHANNEL_GROUP_FORECAST_TOMORROW = "forecastTomorrow";
|
public static final String CHANNEL_GROUP_FORECAST_TOMORROW = "forecastTomorrow";
|
||||||
public static final String CHANNEL_GROUP_CURRENT_UVINDEX = "current";
|
|
||||||
public static final String CHANNEL_GROUP_CURRENT_AIR_POLLUTION = "current";
|
public static final String CHANNEL_GROUP_CURRENT_AIR_POLLUTION = "current";
|
||||||
public static final String CHANNEL_GROUP_ONECALL_CURRENT = "current";
|
public static final String CHANNEL_GROUP_ONECALL_CURRENT = "current";
|
||||||
public static final String CHANNEL_GROUP_ONECALL_HISTORY = "history";
|
public static final String CHANNEL_GROUP_ONECALL_HISTORY = "history";
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2024 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.config;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
|
||||||
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapUVIndexHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The {@link OpenWeatherMapUVIndexConfiguration} is the class used to match the
|
|
||||||
* {@link OpenWeatherMapUVIndexHandler}s configuration.
|
|
||||||
*
|
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
|
||||||
*/
|
|
||||||
@NonNullByDefault
|
|
||||||
public class OpenWeatherMapUVIndexConfiguration extends OpenWeatherMapLocationConfiguration {
|
|
||||||
public int forecastDays;
|
|
||||||
}
|
|
@ -20,7 +20,6 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -38,7 +37,6 @@ import org.openhab.binding.openweathermap.internal.config.OpenWeatherMapAPIConfi
|
|||||||
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonAirPollutionData;
|
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonAirPollutionData;
|
||||||
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonDailyForecastData;
|
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonDailyForecastData;
|
||||||
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonHourlyForecastData;
|
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.OpenWeatherMapJsonWeatherData;
|
||||||
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallAPIData;
|
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallAPIData;
|
||||||
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData;
|
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData;
|
||||||
@ -88,9 +86,6 @@ public class OpenWeatherMapConnection {
|
|||||||
private static final String THREE_HOUR_FORECAST_URL = "https://api.openweathermap.org/data/2.5/forecast";
|
private static final String THREE_HOUR_FORECAST_URL = "https://api.openweathermap.org/data/2.5/forecast";
|
||||||
// 16 day / daily forecast (see https://openweathermap.org/forecast16)
|
// 16 day / daily forecast (see https://openweathermap.org/forecast16)
|
||||||
private static final String DAILY_FORECAST_URL = "https://api.openweathermap.org/data/2.5/forecast/daily";
|
private static final String DAILY_FORECAST_URL = "https://api.openweathermap.org/data/2.5/forecast/daily";
|
||||||
// UV Index (see https://openweathermap.org/api/uvi)
|
|
||||||
private static final String UVINDEX_URL = "https://api.openweathermap.org/data/2.5/uvi";
|
|
||||||
private static final String UVINDEX_FORECAST_URL = "https://api.openweathermap.org/data/2.5/uvi/forecast";
|
|
||||||
// Air Pollution (see https://openweathermap.org/api/air-pollution)
|
// Air Pollution (see https://openweathermap.org/api/air-pollution)
|
||||||
private static final String AIR_POLLUTION_URL = "https://api.openweathermap.org/data/2.5/air_pollution";
|
private static final String AIR_POLLUTION_URL = "https://api.openweathermap.org/data/2.5/air_pollution";
|
||||||
private static final String AIR_POLLUTION_FORECAST_URL = "https://api.openweathermap.org/data/2.5/air_pollution/forecast";
|
private static final String AIR_POLLUTION_FORECAST_URL = "https://api.openweathermap.org/data/2.5/air_pollution/forecast";
|
||||||
@ -181,46 +176,6 @@ public class OpenWeatherMapConnection {
|
|||||||
OpenWeatherMapJsonDailyForecastData.class);
|
OpenWeatherMapJsonDailyForecastData.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Requests the UV Index data for the given location (see https://openweathermap.org/api/uvi).
|
|
||||||
*
|
|
||||||
* @param location location represented as {@link PointType}
|
|
||||||
* @return the UV Index data
|
|
||||||
* @throws JsonSyntaxException
|
|
||||||
* @throws CommunicationException
|
|
||||||
* @throws ConfigurationException
|
|
||||||
*/
|
|
||||||
public synchronized @Nullable OpenWeatherMapJsonUVIndexData getUVIndexData(@Nullable PointType location)
|
|
||||||
throws JsonSyntaxException, CommunicationException, ConfigurationException {
|
|
||||||
return gson.fromJson(
|
|
||||||
getResponseFromCache(
|
|
||||||
buildURL(UVINDEX_URL, getRequestParams(handler.getOpenWeatherMapAPIConfig(), location))),
|
|
||||||
OpenWeatherMapJsonUVIndexData.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Requests the UV Index forecast data for the given location (see https://openweathermap.org/api/uvi).
|
|
||||||
*
|
|
||||||
* @param location location represented as {@link PointType}
|
|
||||||
* @return the UV Index forecast data
|
|
||||||
* @throws JsonSyntaxException
|
|
||||||
* @throws CommunicationException
|
|
||||||
* @throws ConfigurationException
|
|
||||||
*/
|
|
||||||
public synchronized @Nullable List<OpenWeatherMapJsonUVIndexData> getUVIndexForecastData(
|
|
||||||
@Nullable PointType location, int count)
|
|
||||||
throws JsonSyntaxException, CommunicationException, ConfigurationException {
|
|
||||||
if (count <= 0) {
|
|
||||||
throw new ConfigurationException("@text/offline.conf-error-not-supported-uvindex-number-of-days");
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> params = getRequestParams(handler.getOpenWeatherMapAPIConfig(), location);
|
|
||||||
params.put(PARAM_FORECAST_CNT, Integer.toString(count));
|
|
||||||
|
|
||||||
return Arrays.asList(gson.fromJson(getResponseFromCache(buildURL(UVINDEX_FORECAST_URL, params)),
|
|
||||||
OpenWeatherMapJsonUVIndexData[].class));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests the Air Pollution data for the given location (see https://openweathermap.org/api/air-pollution).
|
* Requests the Air Pollution data for the given location (see https://openweathermap.org/api/air-pollution).
|
||||||
*
|
*
|
||||||
|
@ -16,8 +16,8 @@ import org.openhab.binding.openweathermap.internal.dto.airpollution.List;
|
|||||||
import org.openhab.binding.openweathermap.internal.dto.base.Coord;
|
import org.openhab.binding.openweathermap.internal.dto.base.Coord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link OpenWeatherMapJsonAirPollutionData} is the Java class used to map the JSON response to an OpenWeatherMap
|
* Holds the data from the deserialised JSON response of the <a href="https://openweathermap.org/api/air-pollution">Air
|
||||||
* request.
|
* Pollution API</a>.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -16,8 +16,8 @@ import org.openhab.binding.openweathermap.internal.dto.base.City;
|
|||||||
import org.openhab.binding.openweathermap.internal.dto.forecast.daily.List;
|
import org.openhab.binding.openweathermap.internal.dto.forecast.daily.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link OpenWeatherMapJsonDailyForecastData} is the Java class used to map the JSON response to an OpenWeatherMap
|
* Holds the data from the deserialised JSON response of the <a href="https://openweathermap.org/forecast16">Daily
|
||||||
* request.
|
* Forecast 16 Days API</a>.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -32,39 +32,19 @@ public class OpenWeatherMapJsonDailyForecastData {
|
|||||||
return city;
|
return city;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCity(City city) {
|
|
||||||
this.city = city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCod() {
|
public String getCod() {
|
||||||
return cod;
|
return cod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCod(String cod) {
|
|
||||||
this.cod = cod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMessage() {
|
public Double getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(Double message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getCnt() {
|
public Integer getCnt() {
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCnt(Integer cnt) {
|
|
||||||
this.cnt = cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List<List> getList() {
|
public java.util.List<List> getList() {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(java.util.List<List> list) {
|
|
||||||
this.list = list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,9 @@ import org.openhab.binding.openweathermap.internal.dto.base.City;
|
|||||||
import org.openhab.binding.openweathermap.internal.dto.forecast.hourly.List;
|
import org.openhab.binding.openweathermap.internal.dto.forecast.hourly.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link OpenWeatherMapJsonHourlyForecastData} is the Java class used to map the JSON response to an OpenWeatherMap
|
* Holds the data from the deserialised JSON response of the
|
||||||
* request.
|
* <a href="https://openweathermap.org/api/hourly-forecast">Hourly forecast API</a> and the
|
||||||
|
* <a href="https://openweathermap.org/forecast5">5 day weather forecast API</a>.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2024 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 com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The {@link OpenWeatherMapJsonUVIndexData} is the Java class used to map the JSON response to an OpenWeatherMap
|
|
||||||
* request.
|
|
||||||
*
|
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
|
||||||
*/
|
|
||||||
public class OpenWeatherMapJsonUVIndexData {
|
|
||||||
private Double lat;
|
|
||||||
private Double lon;
|
|
||||||
@SerializedName("date_iso")
|
|
||||||
private String dateIso;
|
|
||||||
private Integer date;
|
|
||||||
private Double value;
|
|
||||||
|
|
||||||
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 getDateIso() {
|
|
||||||
return dateIso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateIso(String dateIso) {
|
|
||||||
this.dateIso = dateIso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(Integer date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(Double value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -24,8 +24,8 @@ import org.openhab.binding.openweathermap.internal.dto.weather.Main;
|
|||||||
import org.openhab.binding.openweathermap.internal.dto.weather.Sys;
|
import org.openhab.binding.openweathermap.internal.dto.weather.Sys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link OpenWeatherMapJsonWeatherData} is the Java class used to map the JSON response to an OpenWeatherMap
|
* Holds the data from the deserialised JSON response of the <a href="https://openweathermap.org/current">Current
|
||||||
* request.
|
* weather data API</a>
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -24,12 +24,9 @@ import org.openhab.binding.openweathermap.internal.dto.onecall.Minutely;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the deserialised JSON response of the One Call APIs.
|
||||||
* Settings:
|
* See <a href="https://openweathermap.org/api/one-call-3">One Call API 3.0.</a> and
|
||||||
* Annotation Style: GSON
|
* <a href="https://openweathermap.org/api/one-call-api">One Call API 2.5</a>.
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
* @author Christoph Weitkamp - Added weather alerts
|
* @author Christoph Weitkamp - Added weather alerts
|
||||||
@ -51,63 +48,31 @@ public class OpenWeatherMapOneCallAPIData {
|
|||||||
return lat;
|
return lat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLat(double lat) {
|
|
||||||
this.lat = lat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLon() {
|
public double getLon() {
|
||||||
return lon;
|
return lon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLon(double lon) {
|
|
||||||
this.lon = lon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTimezone() {
|
public String getTimezone() {
|
||||||
return timezone;
|
return timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimezone(String timezone) {
|
|
||||||
this.timezone = timezone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTimezoneOffset() {
|
public int getTimezoneOffset() {
|
||||||
return timezoneOffset;
|
return timezoneOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimezoneOffset(int timezoneOffset) {
|
|
||||||
this.timezoneOffset = timezoneOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Current getCurrent() {
|
public Current getCurrent() {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrent(Current current) {
|
|
||||||
this.current = current;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Minutely> getMinutely() {
|
public List<Minutely> getMinutely() {
|
||||||
return minutely;
|
return minutely;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinutely(List<Minutely> minutely) {
|
|
||||||
this.minutely = minutely;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Hourly> getHourly() {
|
public List<Hourly> getHourly() {
|
||||||
return hourly;
|
return hourly;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHourly(List<Hourly> hourly) {
|
|
||||||
this.hourly = hourly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Daily> getDaily() {
|
public List<Daily> getDaily() {
|
||||||
return daily;
|
return daily;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDaily(List<Daily> daily) {
|
|
||||||
this.daily = daily;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,9 @@ import org.openhab.binding.openweathermap.internal.dto.onecallhist.Hourly;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the historical data from the deserialised JSON response of the One Call APIs.
|
||||||
* Settings:
|
* See <a href="https://openweathermap.org/api/one-call-3">One Call API 3.0.</a> and
|
||||||
* Annotation Style: GSON
|
* <a href="https://openweathermap.org/api/one-call-api">One Call API 2.5</a>.
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.airpollution;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Components} from JSON.
|
* Holds the data from the <code>components</code> object of the JSON response of the Air Pollution API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.airpollution;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link List} from JSON.
|
* Holds the data from the <code>list</code> object of the JSON response of the Air Pollution API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.airpollution;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Main} from JSON.
|
* Holds the data from the <code>main</code> object of the JSON response of the Air Pollution API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -28,39 +28,19 @@ public class City {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coord getCoord() {
|
public Coord getCoord() {
|
||||||
return coord;
|
return coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCoord(Coord coord) {
|
|
||||||
this.coord = coord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountry() {
|
public String getCountry() {
|
||||||
return country;
|
return country;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCountry(String country) {
|
|
||||||
this.country = country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPopulation() {
|
public Integer getPopulation() {
|
||||||
return population;
|
return population;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPopulation(Integer population) {
|
|
||||||
this.population = population;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,4 @@ public class Clouds {
|
|||||||
public Integer getAll() {
|
public Integer getAll() {
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAll(Integer all) {
|
|
||||||
this.all = all;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.base;
|
package org.openhab.binding.openweathermap.internal.dto.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Coord} from JSON.
|
* Holds the data from the <code>coord</code> object of the JSON response.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -25,15 +25,7 @@ public class Coord {
|
|||||||
return lon;
|
return lon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLon(Double lon) {
|
|
||||||
this.lon = lon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getLat() {
|
public Double getLat() {
|
||||||
return lat;
|
return lat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLat(Double lat) {
|
|
||||||
this.lat = lat;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,18 +31,10 @@ public class Precipitation {
|
|||||||
return oneHour;
|
return oneHour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set1h(Double oneHour) {
|
|
||||||
this.oneHour = oneHour;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double get3h() {
|
public @Nullable Double get3h() {
|
||||||
return threeHours;
|
return threeHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set3h(Double threeHours) {
|
|
||||||
this.threeHours = threeHours;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getVolume() {
|
public Double getVolume() {
|
||||||
return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
|
return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
|
||||||
}
|
}
|
||||||
|
@ -27,31 +27,15 @@ public class Weather {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMain() {
|
public String getMain() {
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMain(String main) {
|
|
||||||
this.main = main;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIcon() {
|
public String getIcon() {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIcon(String icon) {
|
|
||||||
this.icon = icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,23 +28,11 @@ public class Wind {
|
|||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpeed(Double speed) {
|
|
||||||
this.speed = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getDeg() {
|
public Double getDeg() {
|
||||||
return deg;
|
return deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeg(Double deg) {
|
|
||||||
this.deg = deg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double getGust() {
|
public @Nullable Double getGust() {
|
||||||
return gust;
|
return gust;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGust(Double gust) {
|
|
||||||
this.gust = speed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.forecast.daily;
|
package org.openhab.binding.openweathermap.internal.dto.forecast.daily;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link FeelsLikeTemp} from JSON.
|
* Holds the data from the <code>feels_like</code> object of the JSON response of the Daily Forecast 16 Days API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -27,31 +27,15 @@ public class FeelsLikeTemp {
|
|||||||
return day;
|
return day;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDay(Double day) {
|
|
||||||
this.day = day;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getNight() {
|
public Double getNight() {
|
||||||
return night;
|
return night;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNight(Double night) {
|
|
||||||
this.night = night;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getEve() {
|
public Double getEve() {
|
||||||
return eve;
|
return eve;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEve(Double eve) {
|
|
||||||
this.eve = eve;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMorn() {
|
public Double getMorn() {
|
||||||
return morn;
|
return morn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMorn(Double morn) {
|
|
||||||
this.morn = morn;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import org.openhab.binding.openweathermap.internal.dto.base.Weather;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link List} from JSON.
|
* Holds the data from the <code>list</code> object of the JSON response of the Daily Forecast 16 Days API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -44,119 +44,59 @@ public class List {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(Integer dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Integer getSunrise() {
|
public @Nullable Integer getSunrise() {
|
||||||
return sunrise;
|
return sunrise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunrise(Integer sunrise) {
|
|
||||||
this.sunrise = sunrise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Integer getSunset() {
|
public @Nullable Integer getSunset() {
|
||||||
return sunset;
|
return sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunset(Integer sunset) {
|
|
||||||
this.sunset = sunset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Temp getTemp() {
|
public Temp getTemp() {
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemp(Temp temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable FeelsLikeTemp getFeelsLike() {
|
public @Nullable FeelsLikeTemp getFeelsLike() {
|
||||||
return feelsLikeTemp;
|
return feelsLikeTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
|
|
||||||
this.feelsLikeTemp = feelsLikeTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getPressure() {
|
public Double getPressure() {
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPressure(Double pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHumidity() {
|
public Integer getHumidity() {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumidity(Integer humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List<Weather> getWeather() {
|
public java.util.List<Weather> getWeather() {
|
||||||
return weather;
|
return weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(java.util.List<Weather> weather) {
|
|
||||||
this.weather = weather;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getSpeed() {
|
public Double getSpeed() {
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpeed(Double speed) {
|
|
||||||
this.speed = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getDeg() {
|
public Double getDeg() {
|
||||||
return deg;
|
return deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeg(Double deg) {
|
|
||||||
this.deg = deg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double getGust() {
|
public @Nullable Double getGust() {
|
||||||
return gust;
|
return gust;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGust(Double gust) {
|
|
||||||
this.gust = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getClouds() {
|
public Integer getClouds() {
|
||||||
return clouds;
|
return clouds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClouds(Integer clouds) {
|
|
||||||
this.clouds = clouds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double getRain() {
|
public @Nullable Double getRain() {
|
||||||
return rain;
|
return rain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRain(Double rain) {
|
|
||||||
this.rain = rain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double getSnow() {
|
public @Nullable Double getSnow() {
|
||||||
return snow;
|
return snow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnow(Double snow) {
|
|
||||||
this.snow = snow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double getPop() {
|
public @Nullable Double getPop() {
|
||||||
return pop;
|
return pop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPop(Double pop) {
|
|
||||||
this.pop = pop;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.forecast.daily;
|
package org.openhab.binding.openweathermap.internal.dto.forecast.daily;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Temp} from JSON.
|
* Holds the data from the <code>temp</code> object of the JSON response of the Daily Forecast 16 Days API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -29,47 +29,23 @@ public class Temp {
|
|||||||
return day;
|
return day;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDay(Double day) {
|
|
||||||
this.day = day;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMin() {
|
public Double getMin() {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMin(Double min) {
|
|
||||||
this.min = min;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMax() {
|
public Double getMax() {
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMax(Double max) {
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getNight() {
|
public Double getNight() {
|
||||||
return night;
|
return night;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNight(Double night) {
|
|
||||||
this.night = night;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getEve() {
|
public Double getEve() {
|
||||||
return eve;
|
return eve;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEve(Double eve) {
|
|
||||||
this.eve = eve;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMorn() {
|
public Double getMorn() {
|
||||||
return morn;
|
return morn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMorn(Double morn) {
|
|
||||||
this.morn = morn;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ import org.openhab.binding.openweathermap.internal.dto.weather.Main;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link List} from JSON.
|
* Holds the data from the <code>list</code> object of the JSON response of the Hourly forecast API and the 5 day
|
||||||
|
* weather forecast API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -42,71 +43,35 @@ public class List {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(Integer dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Main getMain() {
|
public Main getMain() {
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMain(Main main) {
|
|
||||||
this.main = main;
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List<Weather> getWeather() {
|
public java.util.List<Weather> getWeather() {
|
||||||
return weather;
|
return weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(java.util.List<Weather> weather) {
|
|
||||||
this.weather = weather;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clouds getClouds() {
|
public Clouds getClouds() {
|
||||||
return clouds;
|
return clouds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClouds(Clouds clouds) {
|
|
||||||
this.clouds = clouds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Wind getWind() {
|
public Wind getWind() {
|
||||||
return wind;
|
return wind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWind(Wind wind) {
|
|
||||||
this.wind = wind;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Precipitation getRain() {
|
public @Nullable Precipitation getRain() {
|
||||||
return rain;
|
return rain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRain(Precipitation rain) {
|
|
||||||
this.rain = rain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Precipitation getSnow() {
|
public @Nullable Precipitation getSnow() {
|
||||||
return snow;
|
return snow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnow(Precipitation snow) {
|
|
||||||
this.snow = snow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sys getSys() {
|
public Sys getSys() {
|
||||||
return sys;
|
return sys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSys(Sys sys) {
|
|
||||||
this.sys = sys;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDtTxt() {
|
public String getDtTxt() {
|
||||||
return dtTxt;
|
return dtTxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDtTxt(String dtTxt) {
|
|
||||||
this.dtTxt = dtTxt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Main} from JSON.
|
* Holds the data from the <code>main</code> object of the JSON response of the Hourly forecast API and the 5 day
|
||||||
|
* weather forecast API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.forecast.hourly;
|
package org.openhab.binding.openweathermap.internal.dto.forecast.hourly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Sys} from JSON.
|
* Holds the data from the <code>pod</code> object of the JSON response of the Hourly forecast API and the 5 day weather
|
||||||
|
* forecast API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -15,15 +15,35 @@ package org.openhab.binding.openweathermap.internal.dto.onecall;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Alert} from JSON.
|
* Holds the data from the <code>alerts</code> object of the JSON response of the One Call APIs.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
public class Alert {
|
public class Alert {
|
||||||
public String event;
|
private String event;
|
||||||
public int start;
|
private int start;
|
||||||
public int end;
|
private int end;
|
||||||
public String description;
|
private String description;
|
||||||
@SerializedName("sender_name")
|
@SerializedName("sender_name")
|
||||||
public String senderName;
|
private String senderName;
|
||||||
|
|
||||||
|
public String getEvent() {
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSenderName() {
|
||||||
|
return senderName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,7 @@ import java.util.List;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the <code>current</code> object of the JSON response of the One Call APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -54,135 +49,67 @@ public class Current {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(int dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSunrise() {
|
public int getSunrise() {
|
||||||
return sunrise;
|
return sunrise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunrise(int sunrise) {
|
|
||||||
this.sunrise = sunrise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSunset() {
|
public int getSunset() {
|
||||||
return sunset;
|
return sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunset(int sunset) {
|
|
||||||
this.sunset = sunset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTemp() {
|
public double getTemp() {
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemp(double temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getFeelsLike() {
|
public double getFeelsLike() {
|
||||||
return feelsLike;
|
return feelsLike;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeelsLike(double feelsLike) {
|
|
||||||
this.feelsLike = feelsLike;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPressure() {
|
public int getPressure() {
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPressure(int pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHumidity() {
|
public int getHumidity() {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumidity(int humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDewPoint() {
|
public double getDewPoint() {
|
||||||
return dewPoint;
|
return dewPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDewPoint(double dewPoint) {
|
|
||||||
this.dewPoint = dewPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getUvi() {
|
public double getUvi() {
|
||||||
return uvi;
|
return uvi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUvi(double uvi) {
|
|
||||||
this.uvi = uvi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClouds() {
|
public int getClouds() {
|
||||||
return clouds;
|
return clouds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClouds(int clouds) {
|
|
||||||
this.clouds = clouds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibility(int visibility) {
|
|
||||||
this.visibility = visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindSpeed() {
|
public double getWindSpeed() {
|
||||||
return windSpeed;
|
return windSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindSpeed(double windSpeed) {
|
|
||||||
this.windSpeed = windSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWindDeg() {
|
public int getWindDeg() {
|
||||||
return windDeg;
|
return windDeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindDeg(int windDeg) {
|
|
||||||
this.windDeg = windDeg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindGust() {
|
public double getWindGust() {
|
||||||
return windGust;
|
return windGust;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindGust(double windGust) {
|
|
||||||
this.windGust = windGust;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Weather> getWeather() {
|
public List<Weather> getWeather() {
|
||||||
return weather;
|
return weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(List<Weather> weather) {
|
|
||||||
this.weather = weather;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Precipitation getRain() {
|
public Precipitation getRain() {
|
||||||
return rain;
|
return rain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRain(Precipitation rain) {
|
|
||||||
this.rain = rain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Precipitation getSnow() {
|
public Precipitation getSnow() {
|
||||||
return snow;
|
return snow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnow(Precipitation snow) {
|
|
||||||
this.snow = snow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,7 @@ import org.openhab.binding.openweathermap.internal.dto.forecast.daily.Temp;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the <code>daily</code> object of the JSON response of the One Call APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -58,143 +53,71 @@ public class Daily {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(int dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSunrise() {
|
public int getSunrise() {
|
||||||
return sunrise;
|
return sunrise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunrise(int sunrise) {
|
|
||||||
this.sunrise = sunrise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSunset() {
|
public int getSunset() {
|
||||||
return sunset;
|
return sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunset(int sunset) {
|
|
||||||
this.sunset = sunset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Temp getTemp() {
|
public Temp getTemp() {
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemp(Temp temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FeelsLikeTemp getFeelsLike() {
|
public FeelsLikeTemp getFeelsLike() {
|
||||||
return feelsLikeTemp;
|
return feelsLikeTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
|
|
||||||
this.feelsLikeTemp = feelsLikeTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPressure() {
|
public int getPressure() {
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPressure(int pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHumidity() {
|
public int getHumidity() {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumidity(int humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDewPoint() {
|
public double getDewPoint() {
|
||||||
return dewPoint;
|
return dewPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDewPoint(double dewPoint) {
|
|
||||||
this.dewPoint = dewPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindSpeed() {
|
public double getWindSpeed() {
|
||||||
return windSpeed;
|
return windSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindSpeed(double windSpeed) {
|
|
||||||
this.windSpeed = windSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWindDeg() {
|
public int getWindDeg() {
|
||||||
return windDeg;
|
return windDeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindDeg(int windDeg) {
|
|
||||||
this.windDeg = windDeg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindGust() {
|
public double getWindGust() {
|
||||||
return windGust;
|
return windGust;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindGust(double windGust) {
|
|
||||||
this.windGust = windGust;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Weather> getWeather() {
|
public List<Weather> getWeather() {
|
||||||
return weather;
|
return weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(List<Weather> weather) {
|
|
||||||
this.weather = weather;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClouds() {
|
public int getClouds() {
|
||||||
return clouds;
|
return clouds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClouds(int clouds) {
|
|
||||||
this.clouds = clouds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPop() {
|
public double getPop() {
|
||||||
return pop;
|
return pop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPop(double pop) {
|
|
||||||
this.pop = pop;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRain() {
|
public double getRain() {
|
||||||
return rain;
|
return rain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRain(double rain) {
|
|
||||||
this.rain = rain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getUvi() {
|
public double getUvi() {
|
||||||
return uvi;
|
return uvi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUvi(double uvi) {
|
|
||||||
this.uvi = uvi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibility(int visibility) {
|
|
||||||
this.visibility = visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getSnow() {
|
public double getSnow() {
|
||||||
return snow;
|
return snow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnow(double snow) {
|
|
||||||
this.snow = snow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,7 @@ import java.util.List;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the <code>hourly</code> object of the JSON response of the One Call APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -52,119 +47,59 @@ public class Hourly {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(int dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTemp() {
|
public double getTemp() {
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemp(double temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getFeelsLike() {
|
public double getFeelsLike() {
|
||||||
return feelsLike;
|
return feelsLike;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeelsLike(double feelsLike) {
|
|
||||||
this.feelsLike = feelsLike;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPressure() {
|
public int getPressure() {
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPressure(int pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHumidity() {
|
public int getHumidity() {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumidity(int humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDewPoint() {
|
public double getDewPoint() {
|
||||||
return dewPoint;
|
return dewPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDewPoint(double dewPoint) {
|
|
||||||
this.dewPoint = dewPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClouds() {
|
public int getClouds() {
|
||||||
return clouds;
|
return clouds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClouds(int clouds) {
|
|
||||||
this.clouds = clouds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibility(int visibility) {
|
|
||||||
this.visibility = visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindSpeed() {
|
public double getWindSpeed() {
|
||||||
return windSpeed;
|
return windSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindSpeed(double windSpeed) {
|
|
||||||
this.windSpeed = windSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWindDeg() {
|
public int getWindDeg() {
|
||||||
return windDeg;
|
return windDeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindDeg(int windDeg) {
|
|
||||||
this.windDeg = windDeg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindGust() {
|
public double getWindGust() {
|
||||||
return windGust;
|
return windGust;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindGust(double windGust) {
|
|
||||||
this.windGust = windGust;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Weather> getWeather() {
|
public List<Weather> getWeather() {
|
||||||
return weather;
|
return weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(List<Weather> weather) {
|
|
||||||
this.weather = weather;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPop() {
|
public double getPop() {
|
||||||
return pop;
|
return pop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPop(double pop) {
|
|
||||||
this.pop = pop;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Precipitation getRain() {
|
public Precipitation getRain() {
|
||||||
return rain;
|
return rain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRain(Precipitation rain) {
|
|
||||||
this.rain = rain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Precipitation getSnow() {
|
public Precipitation getSnow() {
|
||||||
return snow;
|
return snow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnow(Precipitation snow) {
|
|
||||||
this.snow = snow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,7 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.onecall;
|
package org.openhab.binding.openweathermap.internal.dto.onecall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the <code>minutely</code> object of the JSON response of the One Call APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -30,15 +25,7 @@ public class Minutely {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(int dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPrecipitation() {
|
public double getPrecipitation() {
|
||||||
return precipitation;
|
return precipitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrecipitation(double precipitation) {
|
|
||||||
this.precipitation = precipitation;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.onecall;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the <code>rain</code> and <code>snow</code> object of the JSON response of the One Call APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -31,8 +26,4 @@ public class Precipitation {
|
|||||||
public double get1h() {
|
public double get1h() {
|
||||||
return oneHour;
|
return oneHour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set1h(double oneHour) {
|
|
||||||
this.oneHour = oneHour;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,7 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.onecall;
|
package org.openhab.binding.openweathermap.internal.dto.onecall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the <code>weather</code> object of the JSON response of the One Call APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -32,31 +27,15 @@ public class Weather {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMain() {
|
public String getMain() {
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMain(String main) {
|
|
||||||
this.main = main;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIcon() {
|
public String getIcon() {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIcon(String icon) {
|
|
||||||
this.icon = icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,7 @@ import org.openhab.binding.openweathermap.internal.dto.onecall.Weather;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
* Holds the data from the JSON response of the One Call History APIs.
|
||||||
* Settings:
|
|
||||||
* Annotation Style: GSON
|
|
||||||
* Use primitive types
|
|
||||||
* Use double numbers
|
|
||||||
* allow additional properties
|
|
||||||
*
|
*
|
||||||
* @author Wolfgang Klimt - Initial contribution
|
* @author Wolfgang Klimt - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -54,111 +49,55 @@ public class Hourly {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDt(int dt) {
|
|
||||||
this.dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTemp() {
|
public double getTemp() {
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemp(double temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getFeelsLike() {
|
public double getFeelsLike() {
|
||||||
return feelsLike;
|
return feelsLike;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeelsLike(double feelsLike) {
|
|
||||||
this.feelsLike = feelsLike;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPressure() {
|
public int getPressure() {
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPressure(int pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHumidity() {
|
public int getHumidity() {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumidity(int humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDewPoint() {
|
public double getDewPoint() {
|
||||||
return dewPoint;
|
return dewPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDewPoint(double dewPoint) {
|
|
||||||
this.dewPoint = dewPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClouds() {
|
public int getClouds() {
|
||||||
return clouds;
|
return clouds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClouds(int clouds) {
|
|
||||||
this.clouds = clouds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibility(int visibility) {
|
|
||||||
this.visibility = visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindSpeed() {
|
public double getWindSpeed() {
|
||||||
return windSpeed;
|
return windSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindSpeed(double windSpeed) {
|
|
||||||
this.windSpeed = windSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWindDeg() {
|
public int getWindDeg() {
|
||||||
return windDeg;
|
return windDeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindDeg(int windDeg) {
|
|
||||||
this.windDeg = windDeg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWindGust() {
|
public double getWindGust() {
|
||||||
return windGust;
|
return windGust;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindGust(double windGust) {
|
|
||||||
this.windGust = windGust;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Weather> getWeather() {
|
public List<Weather> getWeather() {
|
||||||
return weather;
|
return weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(List<Weather> weather) {
|
|
||||||
this.weather = weather;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Precipitation getRain() {
|
public Precipitation getRain() {
|
||||||
return rain;
|
return rain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRain(Precipitation rain) {
|
|
||||||
this.rain = rain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Precipitation getSnow() {
|
public Precipitation getSnow() {
|
||||||
return snow;
|
return snow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnow(Precipitation snow) {
|
|
||||||
this.snow = snow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Main} from JSON.
|
* Holds the data from the <code>main</code> object of the JSON response of the Current weather data API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -36,47 +36,23 @@ public class Main {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemp(Double temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Double getFeelsLikeTemp() {
|
public @Nullable Double getFeelsLikeTemp() {
|
||||||
return feelsLikeTemp;
|
return feelsLikeTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeelsLikeTemp(Double feelsLikeTemp) {
|
|
||||||
this.feelsLikeTemp = feelsLikeTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getPressure() {
|
public Double getPressure() {
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPressure(Double pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHumidity() {
|
public Integer getHumidity() {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumidity(Integer humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getTempMin() {
|
public Double getTempMin() {
|
||||||
return tempMin;
|
return tempMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTempMin(Double tempMin) {
|
|
||||||
this.tempMin = tempMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getTempMax() {
|
public Double getTempMax() {
|
||||||
return tempMax;
|
return tempMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTempMax(Double tempMax) {
|
|
||||||
this.tempMax = tempMax;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
package org.openhab.binding.openweathermap.internal.dto.weather;
|
package org.openhab.binding.openweathermap.internal.dto.weather;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Plain Old Java Objects class for {@link Sys} from JSON.
|
* Holds the data from the <code>sys</code> object of the JSON response of the Current weather data API.
|
||||||
*
|
*
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
* @author Christoph Weitkamp - Initial contribution
|
||||||
*/
|
*/
|
||||||
@ -29,47 +29,23 @@ public class Sys {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(Integer type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMessage() {
|
public Double getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(Double message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountry() {
|
public String getCountry() {
|
||||||
return country;
|
return country;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCountry(String country) {
|
|
||||||
this.country = country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSunrise() {
|
public Integer getSunrise() {
|
||||||
return sunrise;
|
return sunrise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunrise(Integer sunrise) {
|
|
||||||
this.sunrise = sunrise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSunset() {
|
public Integer getSunset() {
|
||||||
return sunset;
|
return sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSunset(Integer sunset) {
|
|
||||||
this.sunset = sunset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHand
|
|||||||
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAirPollutionHandler;
|
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAirPollutionHandler;
|
||||||
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHandler;
|
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHandler;
|
||||||
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHistoryHandler;
|
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHistoryHandler;
|
||||||
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapUVIndexHandler;
|
|
||||||
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapWeatherAndForecastHandler;
|
import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapWeatherAndForecastHandler;
|
||||||
import org.openhab.core.config.discovery.DiscoveryService;
|
import org.openhab.core.config.discovery.DiscoveryService;
|
||||||
import org.openhab.core.i18n.LocaleProvider;
|
import org.openhab.core.i18n.LocaleProvider;
|
||||||
@ -100,8 +99,6 @@ public class OpenWeatherMapHandlerFactory extends BaseThingHandlerFactory {
|
|||||||
return handler;
|
return handler;
|
||||||
} else if (THING_TYPE_WEATHER_AND_FORECAST.equals(thingTypeUID)) {
|
} else if (THING_TYPE_WEATHER_AND_FORECAST.equals(thingTypeUID)) {
|
||||||
return new OpenWeatherMapWeatherAndForecastHandler(thing, timeZoneProvider);
|
return new OpenWeatherMapWeatherAndForecastHandler(thing, timeZoneProvider);
|
||||||
} else if (THING_TYPE_UVINDEX.equals(thingTypeUID)) {
|
|
||||||
return new OpenWeatherMapUVIndexHandler(thing, timeZoneProvider);
|
|
||||||
} else if (THING_TYPE_AIR_POLLUTION.equals(thingTypeUID)) {
|
} else if (THING_TYPE_AIR_POLLUTION.equals(thingTypeUID)) {
|
||||||
return new OpenWeatherMapAirPollutionHandler(thing, timeZoneProvider);
|
return new OpenWeatherMapAirPollutionHandler(thing, timeZoneProvider);
|
||||||
} else if (THING_TYPE_ONECALL_WEATHER_AND_FORECAST.equals(thingTypeUID)) {
|
} else if (THING_TYPE_ONECALL_WEATHER_AND_FORECAST.equals(thingTypeUID)) {
|
||||||
|
@ -67,8 +67,7 @@ public abstract class AbstractOpenWeatherMapHandler extends BaseThingHandler {
|
|||||||
private final Logger logger = LoggerFactory.getLogger(AbstractOpenWeatherMapHandler.class);
|
private final Logger logger = LoggerFactory.getLogger(AbstractOpenWeatherMapHandler.class);
|
||||||
|
|
||||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_WEATHER_AND_FORECAST,
|
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_WEATHER_AND_FORECAST,
|
||||||
THING_TYPE_UVINDEX, THING_TYPE_AIR_POLLUTION, THING_TYPE_ONECALL_WEATHER_AND_FORECAST,
|
THING_TYPE_AIR_POLLUTION, THING_TYPE_ONECALL_WEATHER_AND_FORECAST, THING_TYPE_ONECALL_HISTORY);
|
||||||
THING_TYPE_ONECALL_HISTORY);
|
|
||||||
|
|
||||||
private final TimeZoneProvider timeZoneProvider;
|
private final TimeZoneProvider timeZoneProvider;
|
||||||
|
|
||||||
|
@ -809,19 +809,19 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
|
|||||||
Alert alert = alerts.get(count);
|
Alert alert = alerts.get(count);
|
||||||
switch (channelId) {
|
switch (channelId) {
|
||||||
case CHANNEL_ALERT_EVENT:
|
case CHANNEL_ALERT_EVENT:
|
||||||
state = getStringTypeState(alert.event);
|
state = getStringTypeState(alert.getEvent());
|
||||||
break;
|
break;
|
||||||
case CHANNEL_ALERT_DESCRIPTION:
|
case CHANNEL_ALERT_DESCRIPTION:
|
||||||
state = getStringTypeState(alert.description);
|
state = getStringTypeState(alert.getDescription());
|
||||||
break;
|
break;
|
||||||
case CHANNEL_ALERT_ONSET:
|
case CHANNEL_ALERT_ONSET:
|
||||||
state = getDateTimeTypeState(alert.start);
|
state = getDateTimeTypeState(alert.getStart());
|
||||||
break;
|
break;
|
||||||
case CHANNEL_ALERT_EXPIRES:
|
case CHANNEL_ALERT_EXPIRES:
|
||||||
state = getDateTimeTypeState(alert.end);
|
state = getDateTimeTypeState(alert.getEnd());
|
||||||
break;
|
break;
|
||||||
case CHANNEL_ALERT_SOURCE:
|
case CHANNEL_ALERT_SOURCE:
|
||||||
state = getStringTypeState(alert.senderName);
|
state = getStringTypeState(alert.getSenderName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger.debug("Update channel '{}' of group '{}' with new state '{}'.", channelId, channelGroupId, state);
|
logger.debug("Update channel '{}' of group '{}' with new state '{}'.", channelId, channelGroupId, state);
|
||||||
|
@ -1,205 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2024 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.handler;
|
|
||||||
|
|
||||||
import static org.openhab.binding.openweathermap.internal.OpenWeatherMapBindingConstants.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
import org.openhab.binding.openweathermap.internal.config.OpenWeatherMapUVIndexConfiguration;
|
|
||||||
import org.openhab.binding.openweathermap.internal.connection.OpenWeatherMapConnection;
|
|
||||||
import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonUVIndexData;
|
|
||||||
import org.openhab.core.i18n.CommunicationException;
|
|
||||||
import org.openhab.core.i18n.ConfigurationException;
|
|
||||||
import org.openhab.core.i18n.TimeZoneProvider;
|
|
||||||
import org.openhab.core.thing.Channel;
|
|
||||||
import org.openhab.core.thing.ChannelUID;
|
|
||||||
import org.openhab.core.thing.Thing;
|
|
||||||
import org.openhab.core.thing.ThingStatus;
|
|
||||||
import org.openhab.core.thing.ThingStatusDetail;
|
|
||||||
import org.openhab.core.thing.binding.builder.ThingBuilder;
|
|
||||||
import org.openhab.core.types.State;
|
|
||||||
import org.openhab.core.types.UnDefType;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.google.gson.JsonSyntaxException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The {@link OpenWeatherMapUVIndexHandler} is responsible for handling commands, which are sent to one of the
|
|
||||||
* channels.
|
|
||||||
*
|
|
||||||
* @author Christoph Weitkamp - Initial contribution
|
|
||||||
*/
|
|
||||||
@NonNullByDefault
|
|
||||||
public class OpenWeatherMapUVIndexHandler extends AbstractOpenWeatherMapHandler {
|
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(OpenWeatherMapUVIndexHandler.class);
|
|
||||||
|
|
||||||
private static final String CHANNEL_GROUP_FORECAST_PREFIX = "forecastDay";
|
|
||||||
private static final Pattern CHANNEL_GROUP_FORECAST_PREFIX_PATTERN = Pattern
|
|
||||||
.compile(CHANNEL_GROUP_FORECAST_PREFIX + "([0-9]*)");
|
|
||||||
|
|
||||||
// keeps track of the parsed count
|
|
||||||
private int forecastDays = 6;
|
|
||||||
|
|
||||||
private @Nullable OpenWeatherMapJsonUVIndexData uvindexData;
|
|
||||||
private @Nullable List<OpenWeatherMapJsonUVIndexData> uvindexForecastData;
|
|
||||||
|
|
||||||
public OpenWeatherMapUVIndexHandler(Thing thing, final TimeZoneProvider timeZoneProvider) {
|
|
||||||
super(thing, timeZoneProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize() {
|
|
||||||
super.initialize();
|
|
||||||
logger.debug("Initialize OpenWeatherMapUVIndexHandler handler '{}'.", getThing().getUID());
|
|
||||||
OpenWeatherMapUVIndexConfiguration config = getConfigAs(OpenWeatherMapUVIndexConfiguration.class);
|
|
||||||
|
|
||||||
boolean configValid = true;
|
|
||||||
int newForecastDays = config.forecastDays;
|
|
||||||
if (newForecastDays < 1 || newForecastDays > 8) {
|
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
|
||||||
"@text/offline.conf-error-not-supported-uvindex-number-of-days");
|
|
||||||
configValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configValid) {
|
|
||||||
logger.debug("Rebuilding thing '{}'.", getThing().getUID());
|
|
||||||
List<Channel> toBeAddedChannels = new ArrayList<>();
|
|
||||||
List<Channel> toBeRemovedChannels = new ArrayList<>();
|
|
||||||
if (forecastDays != newForecastDays) {
|
|
||||||
logger.debug("Rebuilding UV index channel groups.");
|
|
||||||
if (forecastDays > newForecastDays) {
|
|
||||||
if (newForecastDays < 2) {
|
|
||||||
toBeRemovedChannels.addAll(removeChannelsOfGroup(CHANNEL_GROUP_FORECAST_TOMORROW));
|
|
||||||
}
|
|
||||||
for (int i = newForecastDays; i < forecastDays; ++i) {
|
|
||||||
toBeRemovedChannels
|
|
||||||
.addAll(removeChannelsOfGroup(CHANNEL_GROUP_FORECAST_PREFIX + Integer.toString(i)));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (forecastDays <= 1 && newForecastDays > 1) {
|
|
||||||
toBeAddedChannels.addAll(createChannelsForGroup(CHANNEL_GROUP_FORECAST_TOMORROW,
|
|
||||||
CHANNEL_GROUP_TYPE_UVINDEX_FORECAST));
|
|
||||||
}
|
|
||||||
for (int i = (forecastDays < 2) ? 2 : forecastDays; i < newForecastDays; ++i) {
|
|
||||||
toBeAddedChannels
|
|
||||||
.addAll(createChannelsForGroup(CHANNEL_GROUP_FORECAST_PREFIX + Integer.toString(i),
|
|
||||||
CHANNEL_GROUP_TYPE_UVINDEX_FORECAST));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
forecastDays = newForecastDays;
|
|
||||||
}
|
|
||||||
ThingBuilder builder = editThing().withoutChannels(toBeRemovedChannels);
|
|
||||||
for (Channel channel : toBeAddedChannels) {
|
|
||||||
builder.withChannel(channel);
|
|
||||||
}
|
|
||||||
updateThing(builder.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean requestData(OpenWeatherMapConnection connection)
|
|
||||||
throws CommunicationException, ConfigurationException {
|
|
||||||
logger.debug("Update UV Index data of thing '{}'.", getThing().getUID());
|
|
||||||
try {
|
|
||||||
uvindexData = connection.getUVIndexData(location);
|
|
||||||
if (forecastDays > 0) {
|
|
||||||
uvindexForecastData = connection.getUVIndexForecastData(location, forecastDays);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (JsonSyntaxException e) {
|
|
||||||
logger.debug("JsonSyntaxException occurred during execution: {}", e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void updateChannel(ChannelUID channelUID) {
|
|
||||||
switch (channelUID.getGroupId()) {
|
|
||||||
case CHANNEL_GROUP_CURRENT_UVINDEX:
|
|
||||||
updateUVIndexChannel(channelUID);
|
|
||||||
break;
|
|
||||||
case CHANNEL_GROUP_FORECAST_TOMORROW:
|
|
||||||
updateUVIndexForecastChannel(channelUID, 1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Matcher m = CHANNEL_GROUP_FORECAST_PREFIX_PATTERN.matcher(channelUID.getGroupId());
|
|
||||||
int i;
|
|
||||||
if (m.find() && (i = Integer.parseInt(m.group(1))) > 1 && i <= 8) {
|
|
||||||
updateUVIndexForecastChannel(channelUID, i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the channel from the last OpenWeatherMap data retrieved.
|
|
||||||
*
|
|
||||||
* @param channelUID the id identifying the channel to be updated
|
|
||||||
*/
|
|
||||||
private void updateUVIndexChannel(ChannelUID channelUID) {
|
|
||||||
String channelId = channelUID.getIdWithoutGroup();
|
|
||||||
String channelGroupId = channelUID.getGroupId();
|
|
||||||
OpenWeatherMapJsonUVIndexData localUVIndexData = uvindexData;
|
|
||||||
if (localUVIndexData != null) {
|
|
||||||
State state = UnDefType.UNDEF;
|
|
||||||
switch (channelId) {
|
|
||||||
case CHANNEL_TIME_STAMP:
|
|
||||||
state = getDateTimeTypeState(localUVIndexData.getDate());
|
|
||||||
break;
|
|
||||||
case CHANNEL_UVINDEX:
|
|
||||||
state = getDecimalTypeState(localUVIndexData.getValue());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
logger.debug("Update channel '{}' of group '{}' with new state '{}'.", channelId, channelGroupId, state);
|
|
||||||
updateState(channelUID, state);
|
|
||||||
} else {
|
|
||||||
logger.debug("No UV Index data available to update channel '{}' of group '{}'.", channelId, channelGroupId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the channel from the last OpenWeatherMap data retrieved.
|
|
||||||
*
|
|
||||||
* @param channelUID the id identifying the channel to be updated
|
|
||||||
* @param count
|
|
||||||
*/
|
|
||||||
private void updateUVIndexForecastChannel(ChannelUID channelUID, int count) {
|
|
||||||
String channelId = channelUID.getIdWithoutGroup();
|
|
||||||
String channelGroupId = channelUID.getGroupId();
|
|
||||||
List<OpenWeatherMapJsonUVIndexData> localUVIndexForecastData = uvindexForecastData;
|
|
||||||
if (localUVIndexForecastData != null && localUVIndexForecastData.size() >= count) {
|
|
||||||
OpenWeatherMapJsonUVIndexData forecastData = localUVIndexForecastData.get(count - 1);
|
|
||||||
State state = UnDefType.UNDEF;
|
|
||||||
switch (channelId) {
|
|
||||||
case CHANNEL_TIME_STAMP:
|
|
||||||
state = getDateTimeTypeState(forecastData.getDate());
|
|
||||||
break;
|
|
||||||
case CHANNEL_UVINDEX:
|
|
||||||
state = getDecimalTypeState(forecastData.getValue());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
logger.debug("Update channel '{}' of group '{}' with new state '{}'.", channelId, channelGroupId, state);
|
|
||||||
updateState(channelUID, state);
|
|
||||||
} else {
|
|
||||||
logger.debug("No UV Index data available to update channel '{}' of group '{}'.", channelId, channelGroupId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,18 +27,6 @@ thing-type.openweathermap.onecall.group.forecastToday.label = One Call API Today
|
|||||||
thing-type.openweathermap.onecall.group.forecastToday.description = This is the weather forecast for today from the one call API.
|
thing-type.openweathermap.onecall.group.forecastToday.description = This is the weather forecast for today from the one call API.
|
||||||
thing-type.openweathermap.onecall.group.forecastTomorrow.label = One Call API Tomorrows Forecast
|
thing-type.openweathermap.onecall.group.forecastTomorrow.label = One Call API Tomorrows Forecast
|
||||||
thing-type.openweathermap.onecall.group.forecastTomorrow.description = This is the weather forecast for tomorrow from the one call API.
|
thing-type.openweathermap.onecall.group.forecastTomorrow.description = This is the weather forecast for tomorrow from the one call API.
|
||||||
thing-type.openweathermap.uvindex.label = UV Index
|
|
||||||
thing-type.openweathermap.uvindex.description = Provides UV Index data from the OpenWeatherMap API.
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay2.label = 2 Day Forecast
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay2.description = This is the UV Index forecast in two days.
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay3.label = 3 Day Forecast
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay3.description = This is the UV Index forecast in three days.
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay4.label = 4 Day Forecast
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay4.description = This is the UV Index forecast in four days.
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay5.label = 5 Day Forecast
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastDay5.description = This is the UV Index forecast in five days.
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastTomorrow.label = Tomorrows Forecast
|
|
||||||
thing-type.openweathermap.uvindex.group.forecastTomorrow.description = This is the UV Index forecast for tomorrow.
|
|
||||||
thing-type.openweathermap.weather-and-forecast.label = Weather and Forecast
|
thing-type.openweathermap.weather-and-forecast.label = Weather and Forecast
|
||||||
thing-type.openweathermap.weather-and-forecast.description = Provides current weather and forecast data from the OpenWeatherMap API.
|
thing-type.openweathermap.weather-and-forecast.description = Provides current weather and forecast data from the OpenWeatherMap API.
|
||||||
thing-type.openweathermap.weather-and-forecast.group.forecastDay2.label = 2 Day Forecast
|
thing-type.openweathermap.weather-and-forecast.group.forecastDay2.label = 2 Day Forecast
|
||||||
@ -146,10 +134,6 @@ thing-type.config.openweathermap.onecall.location.label = Location of Weather
|
|||||||
thing-type.config.openweathermap.onecall.location.description = Location of weather in geographical coordinates (latitude/longitude/altitude).
|
thing-type.config.openweathermap.onecall.location.description = Location of weather in geographical coordinates (latitude/longitude/altitude).
|
||||||
thing-type.config.openweathermap.onecall.numberOfAlerts.label = Number of Alerts
|
thing-type.config.openweathermap.onecall.numberOfAlerts.label = Number of Alerts
|
||||||
thing-type.config.openweathermap.onecall.numberOfAlerts.description = Number of alerts to be shown.
|
thing-type.config.openweathermap.onecall.numberOfAlerts.description = Number of alerts to be shown.
|
||||||
thing-type.config.openweathermap.uvindex.forecastDays.label = Number of Days
|
|
||||||
thing-type.config.openweathermap.uvindex.forecastDays.description = Number of days for UV Index forecast.
|
|
||||||
thing-type.config.openweathermap.uvindex.location.label = Location of Weather
|
|
||||||
thing-type.config.openweathermap.uvindex.location.description = Location of weather in geographical coordinates (latitude/longitude/altitude).
|
|
||||||
thing-type.config.openweathermap.weather-and-forecast.forecastDays.label = Number of Days
|
thing-type.config.openweathermap.weather-and-forecast.forecastDays.label = Number of Days
|
||||||
thing-type.config.openweathermap.weather-and-forecast.forecastDays.description = Number of days for daily forecast.
|
thing-type.config.openweathermap.weather-and-forecast.forecastDays.description = Number of days for daily forecast.
|
||||||
thing-type.config.openweathermap.weather-and-forecast.forecastHours.label = Number of Hours
|
thing-type.config.openweathermap.weather-and-forecast.forecastHours.label = Number of Hours
|
||||||
@ -190,10 +174,6 @@ channel-group-type.openweathermap.oneCallMinutelyTimeSeries.description = Minute
|
|||||||
channel-group-type.openweathermap.station.label = Weather Station
|
channel-group-type.openweathermap.station.label = Weather Station
|
||||||
channel-group-type.openweathermap.station.description = This is a weather station.
|
channel-group-type.openweathermap.station.description = This is a weather station.
|
||||||
channel-group-type.openweathermap.station.channel.location.description = Location of the weather station or the city.
|
channel-group-type.openweathermap.station.channel.location.description = Location of the weather station or the city.
|
||||||
channel-group-type.openweathermap.uvindex.label = Current UV Index
|
|
||||||
channel-group-type.openweathermap.uvindex.description = This is the current UV Index.
|
|
||||||
channel-group-type.openweathermap.uvindexForecast.label = Forecasted UV Index
|
|
||||||
channel-group-type.openweathermap.uvindexForecast.description = This is the forecasted UV Index.
|
|
||||||
channel-group-type.openweathermap.weather.label = Current Weather
|
channel-group-type.openweathermap.weather.label = Current Weather
|
||||||
channel-group-type.openweathermap.weather.description = This is the current weather.
|
channel-group-type.openweathermap.weather.description = This is the current weather.
|
||||||
|
|
||||||
|
@ -90,24 +90,6 @@
|
|||||||
</channels>
|
</channels>
|
||||||
</channel-group-type>
|
</channel-group-type>
|
||||||
|
|
||||||
<channel-group-type id="uvindex">
|
|
||||||
<label>Current UV Index</label>
|
|
||||||
<description>This is the current UV Index.</description>
|
|
||||||
<channels>
|
|
||||||
<channel id="time-stamp" typeId="daily-forecast-time-stamp"/>
|
|
||||||
<channel id="uvindex" typeId="uvindex"/>
|
|
||||||
</channels>
|
|
||||||
</channel-group-type>
|
|
||||||
|
|
||||||
<channel-group-type id="uvindexForecast">
|
|
||||||
<label>Forecasted UV Index</label>
|
|
||||||
<description>This is the forecasted UV Index.</description>
|
|
||||||
<channels>
|
|
||||||
<channel id="time-stamp" typeId="daily-forecast-time-stamp"/>
|
|
||||||
<channel id="uvindex" typeId="forecasted-uvindex"/>
|
|
||||||
</channels>
|
|
||||||
</channel-group-type>
|
|
||||||
|
|
||||||
<channel-group-type id="airPollution">
|
<channel-group-type id="airPollution">
|
||||||
<label>Current Air Pollution</label>
|
<label>Current Air Pollution</label>
|
||||||
<description>This is the current air pollution.</description>
|
<description>This is the current air pollution.</description>
|
||||||
|
@ -79,43 +79,6 @@
|
|||||||
<config-description-ref uri="thing-type:openweathermap:weather-and-forecast"/>
|
<config-description-ref uri="thing-type:openweathermap:weather-and-forecast"/>
|
||||||
</thing-type>
|
</thing-type>
|
||||||
|
|
||||||
<thing-type id="uvindex">
|
|
||||||
<supported-bridge-type-refs>
|
|
||||||
<bridge-type-ref id="weather-api"/>
|
|
||||||
</supported-bridge-type-refs>
|
|
||||||
|
|
||||||
<label>UV Index</label>
|
|
||||||
<description>Provides UV Index data from the OpenWeatherMap API.</description>
|
|
||||||
|
|
||||||
<channel-groups>
|
|
||||||
<channel-group id="current" typeId="uvindex"/>
|
|
||||||
<channel-group id="forecastTomorrow" typeId="uvindexForecast">
|
|
||||||
<label>Tomorrows Forecast</label>
|
|
||||||
<description>This is the UV Index forecast for tomorrow.</description>
|
|
||||||
</channel-group>
|
|
||||||
<channel-group id="forecastDay2" typeId="uvindexForecast">
|
|
||||||
<label>2 Day Forecast</label>
|
|
||||||
<description>This is the UV Index forecast in two days.</description>
|
|
||||||
</channel-group>
|
|
||||||
<channel-group id="forecastDay3" typeId="uvindexForecast">
|
|
||||||
<label>3 Day Forecast</label>
|
|
||||||
<description>This is the UV Index forecast in three days.</description>
|
|
||||||
</channel-group>
|
|
||||||
<channel-group id="forecastDay4" typeId="uvindexForecast">
|
|
||||||
<label>4 Day Forecast</label>
|
|
||||||
<description>This is the UV Index forecast in four days.</description>
|
|
||||||
</channel-group>
|
|
||||||
<channel-group id="forecastDay5" typeId="uvindexForecast">
|
|
||||||
<label>5 Day Forecast</label>
|
|
||||||
<description>This is the UV Index forecast in five days.</description>
|
|
||||||
</channel-group>
|
|
||||||
</channel-groups>
|
|
||||||
|
|
||||||
<representation-property>location</representation-property>
|
|
||||||
|
|
||||||
<config-description-ref uri="thing-type:openweathermap:uvindex"/>
|
|
||||||
</thing-type>
|
|
||||||
|
|
||||||
<thing-type id="air-pollution">
|
<thing-type id="air-pollution">
|
||||||
<supported-bridge-type-refs>
|
<supported-bridge-type-refs>
|
||||||
<bridge-type-ref id="weather-api"/>
|
<bridge-type-ref id="weather-api"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user