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.
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
### 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
|
||||
|
||||
| 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, ... | 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
|
||||
|
||||
| Channel Group ID | Channel ID | Item Type | Description |
|
||||
|
@ -35,7 +35,6 @@ public class OpenWeatherMapBindingConstants {
|
||||
// Thing
|
||||
public static final ThingTypeUID THING_TYPE_WEATHER_AND_FORECAST = new ThingTypeUID(BINDING_ID,
|
||||
"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");
|
||||
// One Call API forecast
|
||||
public static final ThingTypeUID THING_TYPE_ONECALL_WEATHER_AND_FORECAST = new ThingTypeUID(BINDING_ID, "onecall");
|
||||
@ -53,8 +52,6 @@ public class OpenWeatherMapBindingConstants {
|
||||
"hourlyForecast");
|
||||
public static final ChannelGroupTypeUID CHANNEL_GROUP_TYPE_DAILY_FORECAST = new ChannelGroupTypeUID(BINDING_ID,
|
||||
"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(
|
||||
BINDING_ID, "airPollutionForecast");
|
||||
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_FORECAST_TODAY = "forecastToday";
|
||||
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_ONECALL_CURRENT = "current";
|
||||
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.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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.OpenWeatherMapJsonDailyForecastData;
|
||||
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.OpenWeatherMapOneCallAPIData;
|
||||
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";
|
||||
// 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";
|
||||
// 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)
|
||||
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";
|
||||
@ -181,46 +176,6 @@ public class OpenWeatherMapConnection {
|
||||
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).
|
||||
*
|
||||
|
@ -16,8 +16,8 @@ import org.openhab.binding.openweathermap.internal.dto.airpollution.List;
|
||||
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
|
||||
* request.
|
||||
* Holds the data from the deserialised JSON response of the <a href="https://openweathermap.org/api/air-pollution">Air
|
||||
* Pollution API</a>.
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* The {@link OpenWeatherMapJsonDailyForecastData} is the Java class used to map the JSON response to an OpenWeatherMap
|
||||
* request.
|
||||
* Holds the data from the deserialised JSON response of the <a href="https://openweathermap.org/forecast16">Daily
|
||||
* Forecast 16 Days API</a>.
|
||||
*
|
||||
* @author Christoph Weitkamp - Initial contribution
|
||||
*/
|
||||
@ -32,39 +32,19 @@ public class OpenWeatherMapJsonDailyForecastData {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(City city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getCod() {
|
||||
return cod;
|
||||
}
|
||||
|
||||
public void setCod(String cod) {
|
||||
this.cod = cod;
|
||||
}
|
||||
|
||||
public Double getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(Double message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCnt() {
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public void setCnt(Integer cnt) {
|
||||
this.cnt = cnt;
|
||||
}
|
||||
|
||||
public java.util.List<List> getList() {
|
||||
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;
|
||||
|
||||
/**
|
||||
* The {@link OpenWeatherMapJsonHourlyForecastData} is the Java class used to map the JSON response to an OpenWeatherMap
|
||||
* request.
|
||||
* Holds the data from the deserialised JSON response of the
|
||||
* <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
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
* The {@link OpenWeatherMapJsonWeatherData} is the Java class used to map the JSON response to an OpenWeatherMap
|
||||
* request.
|
||||
* Holds the data from the deserialised JSON response of the <a href="https://openweathermap.org/current">Current
|
||||
* weather data API</a>
|
||||
*
|
||||
* @author Christoph Weitkamp - Initial contribution
|
||||
*/
|
||||
|
@ -24,12 +24,9 @@ import org.openhab.binding.openweathermap.internal.dto.onecall.Minutely;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the deserialised JSON response of the One Call APIs.
|
||||
* See <a href="https://openweathermap.org/api/one-call-3">One Call API 3.0.</a> and
|
||||
* <a href="https://openweathermap.org/api/one-call-api">One Call API 2.5</a>.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
* @author Christoph Weitkamp - Added weather alerts
|
||||
@ -51,63 +48,31 @@ public class OpenWeatherMapOneCallAPIData {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(String timezone) {
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public int getTimezoneOffset() {
|
||||
return timezoneOffset;
|
||||
}
|
||||
|
||||
public void setTimezoneOffset(int timezoneOffset) {
|
||||
this.timezoneOffset = timezoneOffset;
|
||||
}
|
||||
|
||||
public Current getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(Current current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public List<Minutely> getMinutely() {
|
||||
return minutely;
|
||||
}
|
||||
|
||||
public void setMinutely(List<Minutely> minutely) {
|
||||
this.minutely = minutely;
|
||||
}
|
||||
|
||||
public List<Hourly> getHourly() {
|
||||
return hourly;
|
||||
}
|
||||
|
||||
public void setHourly(List<Hourly> hourly) {
|
||||
this.hourly = hourly;
|
||||
}
|
||||
|
||||
public List<Daily> getDaily() {
|
||||
return daily;
|
||||
}
|
||||
|
||||
public void setDaily(List<Daily> daily) {
|
||||
this.daily = daily;
|
||||
}
|
||||
}
|
||||
|
@ -20,12 +20,9 @@ import org.openhab.binding.openweathermap.internal.dto.onecallhist.Hourly;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the historical data from the deserialised JSON response of the One Call APIs.
|
||||
* See <a href="https://openweathermap.org/api/one-call-3">One Call API 3.0.</a> and
|
||||
* <a href="https://openweathermap.org/api/one-call-api">One Call API 2.5</a>.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.airpollution;
|
||||
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
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.airpollution;
|
||||
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
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ package org.openhab.binding.openweathermap.internal.dto.airpollution;
|
||||
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
|
||||
*/
|
||||
|
@ -28,39 +28,19 @@ public class City {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Coord getCoord() {
|
||||
return coord;
|
||||
}
|
||||
|
||||
public void setCoord(Coord coord) {
|
||||
this.coord = coord;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public Integer getPopulation() {
|
||||
return population;
|
||||
}
|
||||
|
||||
public void setPopulation(Integer population) {
|
||||
this.population = population;
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,4 @@ public class Clouds {
|
||||
public Integer getAll() {
|
||||
return all;
|
||||
}
|
||||
|
||||
public void setAll(Integer all) {
|
||||
this.all = all;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
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
|
||||
*/
|
||||
@ -25,15 +25,7 @@ public class Coord {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(Double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
}
|
||||
|
@ -31,18 +31,10 @@ public class Precipitation {
|
||||
return oneHour;
|
||||
}
|
||||
|
||||
public void set1h(Double oneHour) {
|
||||
this.oneHour = oneHour;
|
||||
}
|
||||
|
||||
public @Nullable Double get3h() {
|
||||
return threeHours;
|
||||
}
|
||||
|
||||
public void set3h(Double threeHours) {
|
||||
this.threeHours = threeHours;
|
||||
}
|
||||
|
||||
public Double getVolume() {
|
||||
return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
|
||||
}
|
||||
|
@ -27,31 +27,15 @@ public class Weather {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMain() {
|
||||
return main;
|
||||
}
|
||||
|
||||
public void setMain(String main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
|
@ -28,23 +28,11 @@ public class Wind {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(Double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public Double getDeg() {
|
||||
return deg;
|
||||
}
|
||||
|
||||
public void setDeg(Double deg) {
|
||||
this.deg = deg;
|
||||
}
|
||||
|
||||
public @Nullable Double getGust() {
|
||||
return gust;
|
||||
}
|
||||
|
||||
public void setGust(Double gust) {
|
||||
this.gust = speed;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
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
|
||||
*/
|
||||
@ -27,31 +27,15 @@ public class FeelsLikeTemp {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(Double day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public Double getNight() {
|
||||
return night;
|
||||
}
|
||||
|
||||
public void setNight(Double night) {
|
||||
this.night = night;
|
||||
}
|
||||
|
||||
public Double getEve() {
|
||||
return eve;
|
||||
}
|
||||
|
||||
public void setEve(Double eve) {
|
||||
this.eve = eve;
|
||||
}
|
||||
|
||||
public Double getMorn() {
|
||||
return morn;
|
||||
}
|
||||
|
||||
public void setMorn(Double morn) {
|
||||
this.morn = morn;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import org.openhab.binding.openweathermap.internal.dto.base.Weather;
|
||||
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
|
||||
*/
|
||||
@ -44,119 +44,59 @@ public class List {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(Integer dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public @Nullable Integer getSunrise() {
|
||||
return sunrise;
|
||||
}
|
||||
|
||||
public void setSunrise(Integer sunrise) {
|
||||
this.sunrise = sunrise;
|
||||
}
|
||||
|
||||
public @Nullable Integer getSunset() {
|
||||
return sunset;
|
||||
}
|
||||
|
||||
public void setSunset(Integer sunset) {
|
||||
this.sunset = sunset;
|
||||
}
|
||||
|
||||
public Temp getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void setTemp(Temp temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public @Nullable FeelsLikeTemp getFeelsLike() {
|
||||
return feelsLikeTemp;
|
||||
}
|
||||
|
||||
public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
|
||||
this.feelsLikeTemp = feelsLikeTemp;
|
||||
}
|
||||
|
||||
public Double getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public void setPressure(Double pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public Integer getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(Integer humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public java.util.List<Weather> getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public void setWeather(java.util.List<Weather> weather) {
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
public Double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(Double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public Double getDeg() {
|
||||
return deg;
|
||||
}
|
||||
|
||||
public void setDeg(Double deg) {
|
||||
this.deg = deg;
|
||||
}
|
||||
|
||||
public @Nullable Double getGust() {
|
||||
return gust;
|
||||
}
|
||||
|
||||
public void setGust(Double gust) {
|
||||
this.gust = speed;
|
||||
}
|
||||
|
||||
public Integer getClouds() {
|
||||
return clouds;
|
||||
}
|
||||
|
||||
public void setClouds(Integer clouds) {
|
||||
this.clouds = clouds;
|
||||
}
|
||||
|
||||
public @Nullable Double getRain() {
|
||||
return rain;
|
||||
}
|
||||
|
||||
public void setRain(Double rain) {
|
||||
this.rain = rain;
|
||||
}
|
||||
|
||||
public @Nullable Double getSnow() {
|
||||
return snow;
|
||||
}
|
||||
|
||||
public void setSnow(Double snow) {
|
||||
this.snow = snow;
|
||||
}
|
||||
|
||||
public @Nullable Double getPop() {
|
||||
return pop;
|
||||
}
|
||||
|
||||
public void setPop(Double pop) {
|
||||
this.pop = pop;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
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
|
||||
*/
|
||||
@ -29,47 +29,23 @@ public class Temp {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(Double day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public Double getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(Double min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public Double getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(Double max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public Double getNight() {
|
||||
return night;
|
||||
}
|
||||
|
||||
public void setNight(Double night) {
|
||||
this.night = night;
|
||||
}
|
||||
|
||||
public Double getEve() {
|
||||
return eve;
|
||||
}
|
||||
|
||||
public void setEve(Double eve) {
|
||||
this.eve = eve;
|
||||
}
|
||||
|
||||
public Double getMorn() {
|
||||
return morn;
|
||||
}
|
||||
|
||||
public void setMorn(Double morn) {
|
||||
this.morn = morn;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ import org.openhab.binding.openweathermap.internal.dto.weather.Main;
|
||||
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
|
||||
*/
|
||||
@ -42,71 +43,35 @@ public class List {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(Integer dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public Main getMain() {
|
||||
return main;
|
||||
}
|
||||
|
||||
public void setMain(Main main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public java.util.List<Weather> getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public void setWeather(java.util.List<Weather> weather) {
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
public Clouds getClouds() {
|
||||
return clouds;
|
||||
}
|
||||
|
||||
public void setClouds(Clouds clouds) {
|
||||
this.clouds = clouds;
|
||||
}
|
||||
|
||||
public Wind getWind() {
|
||||
return wind;
|
||||
}
|
||||
|
||||
public void setWind(Wind wind) {
|
||||
this.wind = wind;
|
||||
}
|
||||
|
||||
public @Nullable Precipitation getRain() {
|
||||
return rain;
|
||||
}
|
||||
|
||||
public void setRain(Precipitation rain) {
|
||||
this.rain = rain;
|
||||
}
|
||||
|
||||
public @Nullable Precipitation getSnow() {
|
||||
return snow;
|
||||
}
|
||||
|
||||
public void setSnow(Precipitation snow) {
|
||||
this.snow = snow;
|
||||
}
|
||||
|
||||
public Sys getSys() {
|
||||
return sys;
|
||||
}
|
||||
|
||||
public void setSys(Sys sys) {
|
||||
this.sys = sys;
|
||||
}
|
||||
|
||||
public String getDtTxt() {
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -13,7 +13,8 @@
|
||||
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
|
||||
*/
|
||||
|
@ -15,15 +15,35 @@ package org.openhab.binding.openweathermap.internal.dto.onecall;
|
||||
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
|
||||
*/
|
||||
public class Alert {
|
||||
public String event;
|
||||
public int start;
|
||||
public int end;
|
||||
public String description;
|
||||
private String event;
|
||||
private int start;
|
||||
private int end;
|
||||
private String description;
|
||||
@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;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the <code>current</code> object of the JSON response of the One Call APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -54,135 +49,67 @@ public class Current {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(int dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public int getSunrise() {
|
||||
return sunrise;
|
||||
}
|
||||
|
||||
public void setSunrise(int sunrise) {
|
||||
this.sunrise = sunrise;
|
||||
}
|
||||
|
||||
public int getSunset() {
|
||||
return sunset;
|
||||
}
|
||||
|
||||
public void setSunset(int sunset) {
|
||||
this.sunset = sunset;
|
||||
}
|
||||
|
||||
public double getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void setTemp(double temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public double getFeelsLike() {
|
||||
return feelsLike;
|
||||
}
|
||||
|
||||
public void setFeelsLike(double feelsLike) {
|
||||
this.feelsLike = feelsLike;
|
||||
}
|
||||
|
||||
public int getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public void setPressure(int pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public int getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(int humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public double getDewPoint() {
|
||||
return dewPoint;
|
||||
}
|
||||
|
||||
public void setDewPoint(double dewPoint) {
|
||||
this.dewPoint = dewPoint;
|
||||
}
|
||||
|
||||
public double getUvi() {
|
||||
return uvi;
|
||||
}
|
||||
|
||||
public void setUvi(double uvi) {
|
||||
this.uvi = uvi;
|
||||
}
|
||||
|
||||
public int getClouds() {
|
||||
return clouds;
|
||||
}
|
||||
|
||||
public void setClouds(int clouds) {
|
||||
this.clouds = clouds;
|
||||
}
|
||||
|
||||
public int getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(int visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
public double getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
public void setWindSpeed(double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
public int getWindDeg() {
|
||||
return windDeg;
|
||||
}
|
||||
|
||||
public void setWindDeg(int windDeg) {
|
||||
this.windDeg = windDeg;
|
||||
}
|
||||
|
||||
public double getWindGust() {
|
||||
return windGust;
|
||||
}
|
||||
|
||||
public void setWindGust(double windGust) {
|
||||
this.windGust = windGust;
|
||||
}
|
||||
|
||||
public List<Weather> getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public void setWeather(List<Weather> weather) {
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
public Precipitation getRain() {
|
||||
return rain;
|
||||
}
|
||||
|
||||
public void setRain(Precipitation rain) {
|
||||
this.rain = rain;
|
||||
}
|
||||
|
||||
public Precipitation getSnow() {
|
||||
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;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the <code>daily</code> object of the JSON response of the One Call APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -58,143 +53,71 @@ public class Daily {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(int dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public int getSunrise() {
|
||||
return sunrise;
|
||||
}
|
||||
|
||||
public void setSunrise(int sunrise) {
|
||||
this.sunrise = sunrise;
|
||||
}
|
||||
|
||||
public int getSunset() {
|
||||
return sunset;
|
||||
}
|
||||
|
||||
public void setSunset(int sunset) {
|
||||
this.sunset = sunset;
|
||||
}
|
||||
|
||||
public Temp getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void setTemp(Temp temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public FeelsLikeTemp getFeelsLike() {
|
||||
return feelsLikeTemp;
|
||||
}
|
||||
|
||||
public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
|
||||
this.feelsLikeTemp = feelsLikeTemp;
|
||||
}
|
||||
|
||||
public int getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public void setPressure(int pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public int getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(int humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public double getDewPoint() {
|
||||
return dewPoint;
|
||||
}
|
||||
|
||||
public void setDewPoint(double dewPoint) {
|
||||
this.dewPoint = dewPoint;
|
||||
}
|
||||
|
||||
public double getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
public void setWindSpeed(double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
public int getWindDeg() {
|
||||
return windDeg;
|
||||
}
|
||||
|
||||
public void setWindDeg(int windDeg) {
|
||||
this.windDeg = windDeg;
|
||||
}
|
||||
|
||||
public double getWindGust() {
|
||||
return windGust;
|
||||
}
|
||||
|
||||
public void setWindGust(double windGust) {
|
||||
this.windGust = windGust;
|
||||
}
|
||||
|
||||
public List<Weather> getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public void setWeather(List<Weather> weather) {
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
public int getClouds() {
|
||||
return clouds;
|
||||
}
|
||||
|
||||
public void setClouds(int clouds) {
|
||||
this.clouds = clouds;
|
||||
}
|
||||
|
||||
public double getPop() {
|
||||
return pop;
|
||||
}
|
||||
|
||||
public void setPop(double pop) {
|
||||
this.pop = pop;
|
||||
}
|
||||
|
||||
public double getRain() {
|
||||
return rain;
|
||||
}
|
||||
|
||||
public void setRain(double rain) {
|
||||
this.rain = rain;
|
||||
}
|
||||
|
||||
public double getUvi() {
|
||||
return uvi;
|
||||
}
|
||||
|
||||
public void setUvi(double uvi) {
|
||||
this.uvi = uvi;
|
||||
}
|
||||
|
||||
public int getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(int visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
public double getSnow() {
|
||||
return snow;
|
||||
}
|
||||
|
||||
public void setSnow(double snow) {
|
||||
this.snow = snow;
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,7 @@ import java.util.List;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the <code>hourly</code> object of the JSON response of the One Call APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -52,119 +47,59 @@ public class Hourly {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(int dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public double getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void setTemp(double temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public double getFeelsLike() {
|
||||
return feelsLike;
|
||||
}
|
||||
|
||||
public void setFeelsLike(double feelsLike) {
|
||||
this.feelsLike = feelsLike;
|
||||
}
|
||||
|
||||
public int getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public void setPressure(int pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public int getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(int humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public double getDewPoint() {
|
||||
return dewPoint;
|
||||
}
|
||||
|
||||
public void setDewPoint(double dewPoint) {
|
||||
this.dewPoint = dewPoint;
|
||||
}
|
||||
|
||||
public int getClouds() {
|
||||
return clouds;
|
||||
}
|
||||
|
||||
public void setClouds(int clouds) {
|
||||
this.clouds = clouds;
|
||||
}
|
||||
|
||||
public int getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(int visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
public double getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
public void setWindSpeed(double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
public int getWindDeg() {
|
||||
return windDeg;
|
||||
}
|
||||
|
||||
public void setWindDeg(int windDeg) {
|
||||
this.windDeg = windDeg;
|
||||
}
|
||||
|
||||
public double getWindGust() {
|
||||
return windGust;
|
||||
}
|
||||
|
||||
public void setWindGust(double windGust) {
|
||||
this.windGust = windGust;
|
||||
}
|
||||
|
||||
public List<Weather> getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public void setWeather(List<Weather> weather) {
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
public double getPop() {
|
||||
return pop;
|
||||
}
|
||||
|
||||
public void setPop(double pop) {
|
||||
this.pop = pop;
|
||||
}
|
||||
|
||||
public Precipitation getRain() {
|
||||
return rain;
|
||||
}
|
||||
|
||||
public void setRain(Precipitation rain) {
|
||||
this.rain = rain;
|
||||
}
|
||||
|
||||
public Precipitation getSnow() {
|
||||
return snow;
|
||||
}
|
||||
|
||||
public void setSnow(Precipitation snow) {
|
||||
this.snow = snow;
|
||||
}
|
||||
}
|
||||
|
@ -13,12 +13,7 @@
|
||||
package org.openhab.binding.openweathermap.internal.dto.onecall;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the <code>minutely</code> object of the JSON response of the One Call APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -30,15 +25,7 @@ public class Minutely {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(int dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public double getPrecipitation() {
|
||||
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;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the <code>rain</code> and <code>snow</code> object of the JSON response of the One Call APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -31,8 +26,4 @@ public class Precipitation {
|
||||
public double get1h() {
|
||||
return oneHour;
|
||||
}
|
||||
|
||||
public void set1h(double oneHour) {
|
||||
this.oneHour = oneHour;
|
||||
}
|
||||
}
|
||||
|
@ -13,12 +13,7 @@
|
||||
package org.openhab.binding.openweathermap.internal.dto.onecall;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the <code>weather</code> object of the JSON response of the One Call APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -32,31 +27,15 @@ public class Weather {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMain() {
|
||||
return main;
|
||||
}
|
||||
|
||||
public void setMain(String main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
|
@ -20,12 +20,7 @@ import org.openhab.binding.openweathermap.internal.dto.onecall.Weather;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
|
||||
* Settings:
|
||||
* Annotation Style: GSON
|
||||
* Use primitive types
|
||||
* Use double numbers
|
||||
* allow additional properties
|
||||
* Holds the data from the JSON response of the One Call History APIs.
|
||||
*
|
||||
* @author Wolfgang Klimt - Initial contribution
|
||||
*/
|
||||
@ -54,111 +49,55 @@ public class Hourly {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(int dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public double getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void setTemp(double temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public double getFeelsLike() {
|
||||
return feelsLike;
|
||||
}
|
||||
|
||||
public void setFeelsLike(double feelsLike) {
|
||||
this.feelsLike = feelsLike;
|
||||
}
|
||||
|
||||
public int getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public void setPressure(int pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public int getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(int humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public double getDewPoint() {
|
||||
return dewPoint;
|
||||
}
|
||||
|
||||
public void setDewPoint(double dewPoint) {
|
||||
this.dewPoint = dewPoint;
|
||||
}
|
||||
|
||||
public int getClouds() {
|
||||
return clouds;
|
||||
}
|
||||
|
||||
public void setClouds(int clouds) {
|
||||
this.clouds = clouds;
|
||||
}
|
||||
|
||||
public int getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(int visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
public double getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
public void setWindSpeed(double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
public int getWindDeg() {
|
||||
return windDeg;
|
||||
}
|
||||
|
||||
public void setWindDeg(int windDeg) {
|
||||
this.windDeg = windDeg;
|
||||
}
|
||||
|
||||
public double getWindGust() {
|
||||
return windGust;
|
||||
}
|
||||
|
||||
public void setWindGust(double windGust) {
|
||||
this.windGust = windGust;
|
||||
}
|
||||
|
||||
public List<Weather> getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public void setWeather(List<Weather> weather) {
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
public Precipitation getRain() {
|
||||
return rain;
|
||||
}
|
||||
|
||||
public void setRain(Precipitation rain) {
|
||||
this.rain = rain;
|
||||
}
|
||||
|
||||
public Precipitation getSnow() {
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -36,47 +36,23 @@ public class Main {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void setTemp(Double temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
public @Nullable Double getFeelsLikeTemp() {
|
||||
return feelsLikeTemp;
|
||||
}
|
||||
|
||||
public void setFeelsLikeTemp(Double feelsLikeTemp) {
|
||||
this.feelsLikeTemp = feelsLikeTemp;
|
||||
}
|
||||
|
||||
public Double getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
public void setPressure(Double pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public Integer getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(Integer humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public Double getTempMin() {
|
||||
return tempMin;
|
||||
}
|
||||
|
||||
public void setTempMin(Double tempMin) {
|
||||
this.tempMin = tempMin;
|
||||
}
|
||||
|
||||
public Double getTempMax() {
|
||||
return tempMax;
|
||||
}
|
||||
|
||||
public void setTempMax(Double tempMax) {
|
||||
this.tempMax = tempMax;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
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
|
||||
*/
|
||||
@ -29,47 +29,23 @@ public class Sys {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Double getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(Double message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public Integer getSunrise() {
|
||||
return sunrise;
|
||||
}
|
||||
|
||||
public void setSunrise(Integer sunrise) {
|
||||
this.sunrise = sunrise;
|
||||
}
|
||||
|
||||
public Integer getSunset() {
|
||||
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.OpenWeatherMapOneCallHandler;
|
||||
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.core.config.discovery.DiscoveryService;
|
||||
import org.openhab.core.i18n.LocaleProvider;
|
||||
@ -100,8 +99,6 @@ public class OpenWeatherMapHandlerFactory extends BaseThingHandlerFactory {
|
||||
return handler;
|
||||
} else if (THING_TYPE_WEATHER_AND_FORECAST.equals(thingTypeUID)) {
|
||||
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)) {
|
||||
return new OpenWeatherMapAirPollutionHandler(thing, timeZoneProvider);
|
||||
} 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);
|
||||
|
||||
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_ONECALL_HISTORY);
|
||||
THING_TYPE_AIR_POLLUTION, THING_TYPE_ONECALL_WEATHER_AND_FORECAST, THING_TYPE_ONECALL_HISTORY);
|
||||
|
||||
private final TimeZoneProvider timeZoneProvider;
|
||||
|
||||
|
@ -809,19 +809,19 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
|
||||
Alert alert = alerts.get(count);
|
||||
switch (channelId) {
|
||||
case CHANNEL_ALERT_EVENT:
|
||||
state = getStringTypeState(alert.event);
|
||||
state = getStringTypeState(alert.getEvent());
|
||||
break;
|
||||
case CHANNEL_ALERT_DESCRIPTION:
|
||||
state = getStringTypeState(alert.description);
|
||||
state = getStringTypeState(alert.getDescription());
|
||||
break;
|
||||
case CHANNEL_ALERT_ONSET:
|
||||
state = getDateTimeTypeState(alert.start);
|
||||
state = getDateTimeTypeState(alert.getStart());
|
||||
break;
|
||||
case CHANNEL_ALERT_EXPIRES:
|
||||
state = getDateTimeTypeState(alert.end);
|
||||
state = getDateTimeTypeState(alert.getEnd());
|
||||
break;
|
||||
case CHANNEL_ALERT_SOURCE:
|
||||
state = getStringTypeState(alert.senderName);
|
||||
state = getStringTypeState(alert.getSenderName());
|
||||
break;
|
||||
}
|
||||
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.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.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.description = Provides current weather and forecast data from the OpenWeatherMap API.
|
||||
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.numberOfAlerts.label = Number of Alerts
|
||||
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.description = Number of days for daily forecast.
|
||||
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.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.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.description = This is the current weather.
|
||||
|
||||
|
@ -90,24 +90,6 @@
|
||||
</channels>
|
||||
</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">
|
||||
<label>Current Air Pollution</label>
|
||||
<description>This is the current air pollution.</description>
|
||||
|
@ -79,43 +79,6 @@
|
||||
<config-description-ref uri="thing-type:openweathermap:weather-and-forecast"/>
|
||||
</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">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="weather-api"/>
|
||||
|
Loading…
Reference in New Issue
Block a user