From 152eeb159e7a89c06707150e364da2a2467e37fb Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Wed, 2 Jan 2019 19:31:01 +0100 Subject: [PATCH] Added channel for icon-id (#6771) Signed-off-by: Christoph Weitkamp --- .../ESH-INF/i18n/openweathermap_de.properties | 3 + .../ESH-INF/thing/channel-types.xml | 10 ++ .../README.md | 95 ++++++++++--------- .../OpenWeatherMapBindingConstants.java | 1 + ...enWeatherMapWeatherAndForecastHandler.java | 9 ++ 5 files changed, 72 insertions(+), 46 deletions(-) diff --git a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/i18n/openweathermap_de.properties b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/i18n/openweathermap_de.properties index 65f1886c2f5..855a97913f3 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/i18n/openweathermap_de.properties +++ b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/i18n/openweathermap_de.properties @@ -183,6 +183,9 @@ channel-type.openweathermap.condition-id.description = Zeigt die ID der Wetterla channel-type.openweathermap.condition-icon.label = Icon channel-type.openweathermap.condition-icon.description = Zeigt das Icon der Wetterlage an. +channel-type.openweathermap.condition-icon.label = Icon-ID +channel-type.openweathermap.condition-icon.description = Zeigt die ID für das Icon der Wetterlage an. + channel-type.openweathermap.forecasted-outdoor-temperature.label = Vorhergesagte Temperatur channel-type.openweathermap.forecasted-outdoor-temperature.description = Zeigt die vorhergesagte Außentemperatur an. diff --git a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/thing/channel-types.xml b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/thing/channel-types.xml index 915965cd0fc..ee667dcf3fb 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/thing/channel-types.xml +++ b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/ESH-INF/thing/channel-types.xml @@ -25,6 +25,7 @@ + @@ -45,6 +46,7 @@ + @@ -65,6 +67,7 @@ + @@ -165,6 +168,13 @@ + + String + + Id of the icon to create the URL. + + + Number:Temperature diff --git a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/README.md b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/README.md index 0a15638816f..e3f7addf4fa 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/README.md +++ b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/README.md @@ -79,58 +79,61 @@ Once the parameter `forecastDays` will be changed, the available channel groups ### Current Weather -| Channel Group ID | Channel ID | Item Type | Description | -|------------------|----------------|----------------------|---------------------------------------------------| -| current | time-stamp | DateTime | Time of data observation. | -| current | condition | String | Current weather condition. | -| current | condition-id | String | Id of the current weather condition. **Advanced** | -| current | icon | Image | Icon representing the current weather condition. | -| current | temperature | Number:Temperature | Current temperature. | -| current | pressure | Number:Pressure | Current barometric pressure. | -| current | humidity | Number:Dimensionless | Current atmospheric humidity. | -| current | wind-speed | Number:Speed | Current wind speed. | -| current | wind-direction | Number:Angle | Current wind direction. | -| current | gust-speed | Number:Speed | Current gust speed. **Advanced** | -| current | cloudiness | Number:Dimensionless | Current cloudiness. | -| current | rain | Number:Length | Rain volume for the last three hours. | -| current | snow | Number:Length | Snow volume for the last three hours. | +| Channel Group ID | Channel ID | Item Type | Description | +|------------------|----------------|----------------------|-------------------------------------------------------------------------| +| current | time-stamp | DateTime | Time of data observation. | +| current | condition | String | Current weather condition. | +| current | condition-id | String | Id of the current weather condition. **Advanced** | +| current | icon | Image | Icon representing the current weather condition. | +| current | icon-id | String | Id of the icon representing the current weather condition. **Advanced** | +| current | temperature | Number:Temperature | Current temperature. | +| current | pressure | Number:Pressure | Current barometric pressure. | +| current | humidity | Number:Dimensionless | Current atmospheric humidity. | +| current | wind-speed | Number:Speed | Current wind speed. | +| current | wind-direction | Number:Angle | Current wind direction. | +| current | gust-speed | Number:Speed | Current gust speed. **Advanced** | +| current | cloudiness | Number:Dimensionless | Current cloudiness. | +| current | rain | Number:Length | Rain volume for the last three hours. | +| current | snow | Number:Length | Snow volume for the last three hours. | ### 3 Hour Forecast -| Channel Group ID | Channel ID | Item Type | Description | -|--------------------------------------------------------|----------------|----------------------|------------------------------------------------------| -| forecastHours03, forecastHours06, ... forecastHours120 | time-stamp | DateTime | Time of data forecasted. | -| forecastHours03, forecastHours06, ... forecastHours120 | condition | String | Forecast weather condition. | -| forecastHours03, forecastHours06, ... forecastHours120 | condition-id | String | Id of the forecasted weather condition. **Advanced** | -| forecastHours03, forecastHours06, ... forecastHours120 | icon | Image | Icon representing the forecasted weather condition. | -| forecastHours03, forecastHours06, ... forecastHours120 | temperature | Number:Temperature | Forecasted temperature. | -| forecastHours03, forecastHours06, ... forecastHours120 | pressure | Number:Pressure | Forecasted barometric pressure. | -| forecastHours03, forecastHours06, ... forecastHours120 | humidity | Number:Dimensionless | Forecasted atmospheric humidity. | -| forecastHours03, forecastHours06, ... forecastHours120 | wind-speed | Number:Speed | Forecasted wind speed. | -| forecastHours03, forecastHours06, ... forecastHours120 | wind-direction | Number:Angle | Forecasted wind direction. | -| forecastHours03, forecastHours06, ... forecastHours120 | gust-speed | Number:Speed | Forecasted gust speed. **Advanced** | -| forecastHours03, forecastHours06, ... forecastHours120 | cloudiness | Number:Dimensionless | Forecasted cloudiness. | -| forecastHours03, forecastHours06, ... forecastHours120 | rain | Number:Length | Expected rain volume for the next 3 hours. | -| forecastHours03, forecastHours06, ... forecastHours120 | snow | Number:Length | Expected snow volume for the next 3 hours. | +| Channel Group ID | Channel ID | Item Type | Description | +|--------------------------------------------------------|----------------|----------------------|----------------------------------------------------------------------------| +| forecastHours03, forecastHours06, ... forecastHours120 | time-stamp | DateTime | Time of data forecasted. | +| forecastHours03, forecastHours06, ... forecastHours120 | condition | String | Forecast weather condition. | +| forecastHours03, forecastHours06, ... forecastHours120 | condition-id | String | Id of the forecasted weather condition. **Advanced** | +| forecastHours03, forecastHours06, ... forecastHours120 | icon | Image | Icon representing the forecasted weather condition. | +| forecastHours03, forecastHours06, ... forecastHours120 | icon-id | String | Id fo the icon representing the forecasted weather condition. **Advanced** | +| forecastHours03, forecastHours06, ... forecastHours120 | temperature | Number:Temperature | Forecasted temperature. | +| forecastHours03, forecastHours06, ... forecastHours120 | pressure | Number:Pressure | Forecasted barometric pressure. | +| forecastHours03, forecastHours06, ... forecastHours120 | humidity | Number:Dimensionless | Forecasted atmospheric humidity. | +| forecastHours03, forecastHours06, ... forecastHours120 | wind-speed | Number:Speed | Forecasted wind speed. | +| forecastHours03, forecastHours06, ... forecastHours120 | wind-direction | Number:Angle | Forecasted wind direction. | +| forecastHours03, forecastHours06, ... forecastHours120 | gust-speed | Number:Speed | Forecasted gust speed. **Advanced** | +| forecastHours03, forecastHours06, ... forecastHours120 | cloudiness | Number:Dimensionless | Forecasted cloudiness. | +| forecastHours03, forecastHours06, ... forecastHours120 | rain | Number:Length | Expected rain volume for the next 3 hours. | +| forecastHours03, forecastHours06, ... forecastHours120 | snow | Number:Length | Expected snow volume for the next 3 hours. | ### Daily Forecast -| Channel Group ID | Channel ID | Item Type | Description | -|------------------------------------------------------------------|-----------------|----------------------|------------------------------------------------------| -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | time-stamp | DateTime | Date of data forecasted. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | condition | String | Forecast weather condition. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | condition-id | String | Id of the forecasted weather condition. **Advanced** | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | icon | Image | Icon representing the forecasted weather condition. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | min-temperature | Number:Temperature | Minimum forecasted temperature of a day. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | max-temperature | Number:Temperature | Maximum forecasted temperature of a day. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | pressure | Number:Pressure | Forecasted barometric pressure. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | humidity | Number:Dimensionless | Forecasted atmospheric humidity. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | wind-speed | Number:Speed | Forecasted wind speed. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | wind-direction | Number:Angle | Forecasted wind direction. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | gust-speed | Number:Speed | Forecasted gust speed. **Advanced** | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | cloudiness | Number:Dimensionless | Forecasted cloudiness. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | rain | Number:Length | Expected rain volume of a day. | -| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | snow | Number:Length | Expected snow volume of a day. | +| Channel Group ID | Channel ID | Item Type | Description | +|------------------------------------------------------------------|-----------------|----------------------|----------------------------------------------------------------------------| +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | time-stamp | DateTime | Date of data forecasted. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | condition | String | Forecast weather condition. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | condition-id | String | Id of the forecasted weather condition. **Advanced** | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | icon | Image | Icon representing the forecasted weather condition. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | icon-id | String | Id of the icon representing the forecasted weather condition. **Advanced** | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | min-temperature | Number:Temperature | Minimum forecasted temperature of a day. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | max-temperature | Number:Temperature | Maximum forecasted temperature of a day. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | pressure | Number:Pressure | Forecasted barometric pressure. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | humidity | Number:Dimensionless | Forecasted atmospheric humidity. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | wind-speed | Number:Speed | Forecasted wind speed. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | wind-direction | Number:Angle | Forecasted wind direction. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | gust-speed | Number:Speed | Forecasted gust speed. **Advanced** | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | cloudiness | Number:Dimensionless | Forecasted cloudiness. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | rain | Number:Length | Expected rain volume of a day. | +| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | snow | Number:Length | Expected snow volume of a day. | ### UV Index diff --git a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/OpenWeatherMapBindingConstants.java b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/OpenWeatherMapBindingConstants.java index fd633ac6bac..b0576ab6e1d 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/OpenWeatherMapBindingConstants.java +++ b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/OpenWeatherMapBindingConstants.java @@ -65,6 +65,7 @@ public class OpenWeatherMapBindingConstants { public static final String CHANNEL_CONDITION = "condition"; public static final String CHANNEL_CONDITION_ID = "condition-id"; public static final String CHANNEL_CONDITION_ICON = "icon"; + public static final String CHANNEL_CONDITION_ICON_ID = "icon-id"; public static final String CHANNEL_TEMPERATURE = "temperature"; public static final String CHANNEL_MIN_TEMPERATURE = "min-temperature"; public static final String CHANNEL_MAX_TEMPERATURE = "max-temperature"; diff --git a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/handler/OpenWeatherMapWeatherAndForecastHandler.java b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/handler/OpenWeatherMapWeatherAndForecastHandler.java index ee963cf843a..f3c32e4503c 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/handler/OpenWeatherMapWeatherAndForecastHandler.java +++ b/extensions/binding/org.eclipse.smarthome.binding.openweathermap/src/main/java/org/eclipse/smarthome/binding/openweathermap/internal/handler/OpenWeatherMapWeatherAndForecastHandler.java @@ -259,6 +259,9 @@ private void updateCurrentChannel(ChannelUID channelUID) { state = getRawTypeState( OpenWeatherMapConnection.getWeatherIcon(weatherData.getWeather().get(0).getIcon())); break; + case CHANNEL_CONDITION_ICON_ID: + state = getStringTypeState(weatherData.getWeather().get(0).getIcon()); + break; case CHANNEL_TEMPERATURE: state = getQuantityTypeState(weatherData.getMain().getTemp(), CELSIUS); break; @@ -327,6 +330,9 @@ private void updateHourlyForecastChannel(ChannelUID channelUID, int count) { state = getRawTypeState( OpenWeatherMapConnection.getWeatherIcon(forecastData.getWeather().get(0).getIcon())); break; + case CHANNEL_CONDITION_ICON_ID: + state = getStringTypeState(forecastData.getWeather().get(0).getIcon()); + break; case CHANNEL_TEMPERATURE: state = getQuantityTypeState(forecastData.getMain().getTemp(), CELSIUS); break; @@ -395,6 +401,9 @@ private void updateDailyForecastChannel(ChannelUID channelUID, int count) { state = getRawTypeState( OpenWeatherMapConnection.getWeatherIcon(forecastData.getWeather().get(0).getIcon())); break; + case CHANNEL_CONDITION_ICON_ID: + state = getStringTypeState(forecastData.getWeather().get(0).getIcon()); + break; case CHANNEL_MIN_TEMPERATURE: state = getQuantityTypeState(forecastData.getTemp().getMin(), CELSIUS); break;