mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[openweathermap] Added hint about deprecation of UV Index API (#10326)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
279e87851c
commit
04da89cc4f
@ -29,6 +29,11 @@ If the request fails, all daily forecast channel groups will be removed from the
|
|||||||
|
|
||||||
### Current UV Index And Forecast
|
### 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.
|
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.
|
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.
|
You can add as much `uvindex` things for different locations to your setup as you like to observe.
|
||||||
@ -48,7 +53,7 @@ For every day in history you have to create a different thing.
|
|||||||
|
|
||||||
## Discovery
|
## Discovery
|
||||||
|
|
||||||
If a system location is set, a "Local Weather And Forecast" (`weather-and-forecast`) thing and "Local UV Index" (`uvindex`) thing will be automatically discovered for this location.
|
If a system location is set, a "Local Weather And Forecast" (`weather-and-forecast`) thing will be automatically discovered for this location.
|
||||||
Once the system location will be changed, the background discovery updates the configuration of both things accordingly.
|
Once the system location will be changed, the background discovery updates the configuration of both things accordingly.
|
||||||
|
|
||||||
## Thing Configuration
|
## Thing Configuration
|
||||||
@ -133,7 +138,6 @@ These channels are not supported in the One Call API
|
|||||||
| current | visibility | Number:Length | Current visibility. |
|
| current | visibility | Number:Length | Current visibility. |
|
||||||
| current | uvindex | Number | Current UV Index. Only available in the One Call API |
|
| current | uvindex | Number | Current UV Index. Only available in the One Call API |
|
||||||
|
|
||||||
|
|
||||||
**Attention**: Rain item is showing "1h" in the case when data are received from weather stations directly.
|
**Attention**: Rain item is showing "1h" in the case when data are received from weather stations directly.
|
||||||
The fact is that some METAR stations do not have precipitation indicators or do not measure precipitation conditions due to some other technical reasons.
|
The fact is that some METAR stations do not have precipitation indicators or do not measure precipitation conditions due to some other technical reasons.
|
||||||
In this case, we use model data.
|
In this case, we use model data.
|
||||||
@ -182,7 +186,7 @@ See above for a description of the available channels.
|
|||||||
### Daily Forecast
|
### Daily Forecast
|
||||||
|
|
||||||
| Channel Group ID | Channel ID | Item Type | Description |
|
| Channel Group ID | Channel ID | Item Type | Description |
|
||||||
|------------------------------------------------------------------|----------------------|----------------------|----------------------------------------------------------------------------|
|
|------------------------------------------------------------------|----------------------|----------------------|-----------------------------------------------------------------------------------|
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | time-stamp | DateTime | Date of data forecasted. |
|
| 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 | String | Forecast weather condition. |
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | condition-id | String | Id of the forecasted weather condition. **Advanced** |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | condition-id | String | Id of the forecasted weather condition. **Advanced** |
|
||||||
@ -201,7 +205,6 @@ See above for a description of the available channels.
|
|||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | snow | Number:Length | Expected snow volume of a day. |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay16 | snow | Number:Length | Expected snow volume of a day. |
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | dew-point | Number:Temperature | Expected dew-point. Only available in the One Call API |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | dew-point | Number:Temperature | Expected dew-point. Only available in the One Call API |
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | uvindex | Number | Forecasted Midday UV Index. Only available in the One Call API |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | uvindex | Number | Forecasted Midday UV Index. Only available in the One Call API |
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | precip-probability | Number:Dimensionless | Precipitation probability. Only available in the One Call API |
|
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | morning-temperature | Number:Temperature | Expected morning temperature. Only available in the One Call API |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | morning-temperature | Number:Temperature | Expected morning temperature. Only available in the One Call API |
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | day-temperature | Number:Temperature | Expected day-temperature. Only available in the One Call API |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | day-temperature | Number:Temperature | Expected day-temperature. Only available in the One Call API |
|
||||||
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | evening-temperature | Number:Temperature | Expected evening-temperature. Only available in the One Call API |
|
| forecastToday, forecastTomorrow, forecastDay2, ... forecastDay7 | evening-temperature | Number:Temperature | Expected evening-temperature. Only available in the One Call API |
|
||||||
@ -230,11 +233,10 @@ demo.things
|
|||||||
Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="AAA", refreshInterval=30, language="de"] {
|
Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="AAA", refreshInterval=30, language="de"] {
|
||||||
Thing weather-and-forecast local "Local Weather And Forecast" [location="XXX,YYY", forecastHours=0, forecastDays=7]
|
Thing weather-and-forecast local "Local Weather And Forecast" [location="XXX,YYY", forecastHours=0, forecastDays=7]
|
||||||
Thing weather-and-forecast miami "Weather And Forecast In Miami" [location="25.782403,-80.264563", forecastHours=24, forecastDays=0]
|
Thing weather-and-forecast miami "Weather And Forecast In Miami" [location="25.782403,-80.264563", forecastHours=24, forecastDays=0]
|
||||||
Thing uvindex local "Local UV Index" [location="XXX,YYY", forecastDays=7]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### One Call API version
|
#### One Call API Version
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="Add your API key", refreshInterval=60, language="de"] {
|
Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="Add your API key", refreshInterval=60, language="de"] {
|
||||||
@ -306,16 +308,9 @@ String miamiHourlyForecast06Condition "Condition in Miami for hours 3 to 6 [%s]"
|
|||||||
Image miamiHourlyForecast06ConditionIcon "Icon" { channel="openweathermap:weather-and-forecast:api:miami:forecastHours06#icon" }
|
Image miamiHourlyForecast06ConditionIcon "Icon" { channel="openweathermap:weather-and-forecast:api:miami:forecastHours06#icon" }
|
||||||
Number:Temperature miamiHourlyForecast06Temperature "Temperature in Miami for hours 3 to 6 [%.1f %unit%]" <temperature> { channel="openweathermap:weather-and-forecast:api:miami:forecastHours06#temperature" }
|
Number:Temperature miamiHourlyForecast06Temperature "Temperature in Miami for hours 3 to 6 [%.1f %unit%]" <temperature> { channel="openweathermap:weather-and-forecast:api:miami:forecastHours06#temperature" }
|
||||||
...
|
...
|
||||||
|
|
||||||
DateTime localCurrentUVIndexTimestamp "Timestamp of last measurement [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:api:local:current#time-stamp" }
|
|
||||||
Number localCurrentUVIndex "Current UV Index [%d]" { channel="openweathermap:uvindex:api:local:current#uvindex" }
|
|
||||||
|
|
||||||
DateTime localForecastTomorrowUVIndexTimestamp "Timestamp of forecast [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:api:local:forecastTomorrow#time-stamp" }
|
|
||||||
Number localForecastTomorrowUVIndex "UV Index for tomorrow [%d]" { channel="openweathermap:uvindex:api:local:forecastTomorrow#uvindex" }
|
|
||||||
...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### One Call API version
|
#### One Call API Version
|
||||||
|
|
||||||
```java
|
```java
|
||||||
DateTime localLastMeasurement "Timestamp of Last Measurement [%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS]" <time> { channel="openweathermap:onecall:api:local:current#time-stamp" }
|
DateTime localLastMeasurement "Timestamp of Last Measurement [%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS]" <time> { channel="openweathermap:onecall:api:local:current#time-stamp" }
|
||||||
@ -585,17 +580,10 @@ sitemap demo label="OpenWeatherMap" {
|
|||||||
Text item=miamiHourlyForecast06Temperature
|
Text item=miamiHourlyForecast06Temperature
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
Frame label="UV Index" {
|
|
||||||
Text item=localCurrentUVIndexTimestamp
|
|
||||||
Text item=localCurrentUVIndex
|
|
||||||
Text item=localForecastTomorrowUVIndexTimestamp
|
|
||||||
Text item=localForecastTomorrowUVIndex
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### One Call API version
|
#### One Call API Version
|
||||||
|
|
||||||
Please note that this sitemap does not cover all items of the example above.
|
Please note that this sitemap does not cover all items of the example above.
|
||||||
|
|
||||||
@ -727,6 +715,5 @@ sitemap demo label="OpenWeatherMapOneCall" {
|
|||||||
Text item=localHistory1SnowVolume
|
Text item=localHistory1SnowVolume
|
||||||
Text item=localHistory1Visibility
|
Text item=localHistory1Visibility
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -90,10 +90,11 @@ public class OpenWeatherMapDiscoveryService extends AbstractDiscoveryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startBackgroundDiscovery() {
|
protected void startBackgroundDiscovery() {
|
||||||
if (discoveryJob == null || discoveryJob.isCancelled()) {
|
ScheduledFuture<?> localDiscoveryJob = discoveryJob;
|
||||||
|
if (localDiscoveryJob == null || localDiscoveryJob.isCancelled()) {
|
||||||
logger.debug("Start OpenWeatherMap Location background discovery job at interval {} s.",
|
logger.debug("Start OpenWeatherMap Location background discovery job at interval {} s.",
|
||||||
DISCOVERY_INTERVAL_SECONDS);
|
DISCOVERY_INTERVAL_SECONDS);
|
||||||
discoveryJob = scheduler.scheduleWithFixedDelay(() -> {
|
localDiscoveryJob = scheduler.scheduleWithFixedDelay(() -> {
|
||||||
scanForNewLocation(true);
|
scanForNewLocation(true);
|
||||||
}, 0, DISCOVERY_INTERVAL_SECONDS, TimeUnit.SECONDS);
|
}, 0, DISCOVERY_INTERVAL_SECONDS, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
@ -101,9 +102,10 @@ public class OpenWeatherMapDiscoveryService extends AbstractDiscoveryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void stopBackgroundDiscovery() {
|
protected void stopBackgroundDiscovery() {
|
||||||
if (discoveryJob != null && !discoveryJob.isCancelled()) {
|
ScheduledFuture<?> localDiscoveryJob = discoveryJob;
|
||||||
|
if (localDiscoveryJob != null && !localDiscoveryJob.isCancelled()) {
|
||||||
logger.debug("Stop OpenWeatherMap Location background discovery job.");
|
logger.debug("Stop OpenWeatherMap Location background discovery job.");
|
||||||
if (discoveryJob.cancel(true)) {
|
if (localDiscoveryJob.cancel(true)) {
|
||||||
discoveryJob = null;
|
discoveryJob = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,7 +129,6 @@ public class OpenWeatherMapDiscoveryService extends AbstractDiscoveryService {
|
|||||||
String locationString = location.toFullString();
|
String locationString = location.toFullString();
|
||||||
ThingUID bridgeUID = bridgeHandler.getThing().getUID();
|
ThingUID bridgeUID = bridgeHandler.getThing().getUID();
|
||||||
createWeatherAndForecastResult(locationString, bridgeUID);
|
createWeatherAndForecastResult(locationString, bridgeUID);
|
||||||
createUVIndexResult(locationString, bridgeUID);
|
|
||||||
createOneCallResult(locationString, bridgeUID);
|
createOneCallResult(locationString, bridgeUID);
|
||||||
createOneCallHistoryResult(locationString, bridgeUID);
|
createOneCallHistoryResult(locationString, bridgeUID);
|
||||||
}
|
}
|
||||||
@ -138,12 +139,6 @@ public class OpenWeatherMapDiscoveryService extends AbstractDiscoveryService {
|
|||||||
.withRepresentationProperty(CONFIG_LOCATION).withBridge(bridgeUID).build());
|
.withRepresentationProperty(CONFIG_LOCATION).withBridge(bridgeUID).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createUVIndexResult(String location, ThingUID bridgeUID) {
|
|
||||||
thingDiscovered(DiscoveryResultBuilder.create(new ThingUID(THING_TYPE_UVINDEX, bridgeUID, LOCAL))
|
|
||||||
.withLabel("Local UV Index").withProperty(CONFIG_LOCATION, location)
|
|
||||||
.withRepresentationProperty(CONFIG_LOCATION).withBridge(bridgeUID).build());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createOneCallResult(String location, ThingUID bridgeUID) {
|
private void createOneCallResult(String location, ThingUID bridgeUID) {
|
||||||
thingDiscovered(
|
thingDiscovered(
|
||||||
DiscoveryResultBuilder.create(new ThingUID(THING_TYPE_ONECALL_WEATHER_AND_FORECAST, bridgeUID, LOCAL))
|
DiscoveryResultBuilder.create(new ThingUID(THING_TYPE_ONECALL_WEATHER_AND_FORECAST, bridgeUID, LOCAL))
|
||||||
|
Loading…
Reference in New Issue
Block a user