这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions bundles/binding/org.openhab.binding.weather/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ The Weather binding collects current and forecast weather data from different pr

![](https://farm4.staticflickr.com/3946/15407522168_7ea34d51e1_o.png)

There is also a binding specifically openHAB 2 [here](https://www.openhab.org/addons/bindings/yahooweather/) for Yahoo! Weather.

## Table of Contents

<!-- MarkdownTOC -->
Expand Down Expand Up @@ -42,7 +40,6 @@ Before you can use a weather provider, you need to register a free apikey on the
The apikey for the different weather providers, at least one must be specified.

> [Hamweather](http://hamweather.com) has two apikeys (client_id, secret_id).
> [Yahoo](https://weather.yahoo.com) does not need an apikey.

| Property | Description |
|---------------------------|-------------|
Expand All @@ -63,9 +60,8 @@ You can specify multiple locations by repeating these properties with different
| Property | Description |
|----------------------------------------|-------------|
| location.`<locationId>`.name | the name of the location, useful for displaying in html layouts (optional) |
| location.`<locationId>`.latitude | the latitude the weather is retrieved from (not required for Yahoo) |
| location.`<locationId>`.longitude | the longitude the weather is retrieved from (not required for Yahoo) |
| location.`<locationId>`.woeid | required for Yahoo, the numeric Where On Earth ID, found at end of your weather.yahoo.com URL |
| location.`<locationId>`.latitude | the latitude the weather is retrieved from |
| location.`<locationId>`.longitude | the longitude the weather is retrieved from |
| location.`<locationId>`.provider | reference to a provider name |
| location.`<locationId>`.language | the language of the weather condition text (see provider homepage for supported languages) |
| location.`<locationId>`.updateInterval | the interval in minutes the weather is retrieved |
Expand All @@ -75,13 +71,13 @@ You can specify multiple locations by repeating these properties with different

### Configuration Example

Let's display the current temperature and humidity in Salzburg (AT) from Yahoo.
Let's display the current temperature and humidity in Salzburg (AT).

services/weather.cfg

```
location.home.woeid=547826
location.home.provider=Yahoo
location.home.provider=ForecastIo
location.home.language=de
location.home.updateInterval=10
```
Expand All @@ -93,8 +89,6 @@ Number Temperature "Temperature [%.2f °C]" {weather="locationId=home, typ
Number Humidity "Humidity [%d %%]" {weather="locationId=home, type=atmosphere, property=humidity"}
```

For Yahoo, you don't need an apikey, but you do need a woeid (which you can find as the numeric digits at the end of your weather.yahoo.com URL). The location has the locationId *home* and updates the weather data every 10 minutes.

In the items file, you reference the `<locationId>` and the type and property to display (see below for more).

Let's say you want to switch to another provider, ForecastIo. All you have to do is register your apikey, configure it, supply your latitude and longitude, and change the provider in your location:
Expand Down Expand Up @@ -308,7 +302,6 @@ Each provider sends different forecast days.
- WorldWeatherOnline: 5 days (0-4)
- Wunderground: 10 days (0-9)
- Hamweather: 5 days (0-4)
- Yahoo: 10 days (0-9)

**Note:** If you omit the forecast property, the *current* conditions are shown, if you specify forecast=0, the forecast for *today* is shown.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,7 @@ public boolean isValid() {
return false;
}

if (providerName == ProviderName.YAHOO) {
return woeid != null;
} else {
return latitude != null && longitude != null;
}
return latitude != null && longitude != null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@
* #weather:apikey2.Hamweather=
*
* # location configuration, you can specify multiple locations
* #weather:location.<locationId1>.latitude= (not required for Yahoo provider)
* #weather:location.<locationId1>.longitude= (not required for Yahoo provider)
* #weather:location.<locationId1>.latitude=
* #weather:location.<locationId1>.longitude=
* #weather:location.<locationId1>.provider=
* #weather:location.<locationId1>.woeid= (required for Yahoo provider)
* #weather:location.<locationId1>.language=
* #weather:location.<locationId1>.updateInterval= (optional, defaults to 240)
* #weather:location.<locationId1>.units= (optional; defaults to "si")
*
* #weather:location.<locationId2>.latitude= (not required for Yahoo provider)
* #weather:location.<locationId2>.longitude= (not required for Yahoo provider)
* #weather:location.<locationId2>.latitude=
* #weather:location.<locationId2>.longitude=
* #weather:location.<locationId2>.provider=
* #weather:location.<locationId2>.woeid= (required for Yahoo provider)
* #weather:location.<locationId2>.language=
* #weather:location.<locationId2>.updateInterval= (optional, defaults to 240)
* #weather:location.<locationId2>.units= (optional; defaults to "si")
Expand Down Expand Up @@ -100,7 +98,7 @@ public void parse(Dictionary<String, ?> properties) throws ConfigurationExceptio
"Incomplete location config for locationId '" + lc.getLocationId() + "'. Check openhab.cfg.");
}

if (lc.getProviderName() != ProviderName.YAHOO && !providerConfigs.containsKey(lc.getProviderName())) {
if (!providerConfigs.containsKey(lc.getProviderName())) {
parseCompleted = true;
logger.warn("No apikey found for provider '{}'. Check openhab.cfg.", lc.getProviderName());
throw new ConfigurationException("weather",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class Atmosphere {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "humidity"),
@Provider(name = ProviderName.FORECASTIO, property = "humidity", converter = ConverterType.FRACTION_INTEGER),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "humidity"),
@Provider(name = ProviderName.YAHOO, property = "atmosphere.humidity"),
@Provider(name = ProviderName.HAMWEATHER, property = "humidity"),
@Provider(name = ProviderName.METEOBLUE, property = "relative_humidity_avg") })
private Integer humidity;
Expand All @@ -37,7 +36,6 @@ public class Atmosphere {
@Provider(name = ProviderName.WUNDERGROUND, property = "current_observation.visibility_km"),
@Provider(name = ProviderName.FORECASTIO, property = "visibility"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "visibility"),
@Provider(name = ProviderName.YAHOO, property = "atmosphere.visibility"),
@Provider(name = ProviderName.HAMWEATHER, property = "visibilityKM") })
private Double visibility;

Expand All @@ -46,7 +44,6 @@ public class Atmosphere {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "pressure"),
@Provider(name = ProviderName.FORECASTIO, property = "pressure"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "pressure"),
@Provider(name = ProviderName.YAHOO, property = "atmosphere.pressure"),
@Provider(name = ProviderName.HAMWEATHER, property = "pressureMB"),
@Provider(name = ProviderName.METEOBLUE, property = "pressure_hpa") })
private Double pressure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class Condition {
@Provider(name = ProviderName.FORECASTIO, property = "currently.summary"),
@Provider(name = ProviderName.FORECASTIO, property = "daily.data.summary"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "weatherDesc.value"),
@Provider(name = ProviderName.YAHOO, property = "text"),
@Provider(name = ProviderName.HAMWEATHER, property = "weather") })
private String text;

Expand All @@ -42,16 +41,13 @@ public class Condition {
@Provider(name = ProviderName.FORECASTIO, property = "time", converter = ConverterType.UNIX_DATE),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "localObsDateTime", converter = ConverterType.UTC_DATE),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "date", converter = ConverterType.DATE),
@Provider(name = ProviderName.YAHOO, property = "lastBuildDate", converter = ConverterType.FULL_UTC_DATE),
@Provider(name = ProviderName.YAHOO, property = "forecast.date", converter = ConverterType.SIMPLE_DATE),
@Provider(name = ProviderName.HAMWEATHER, property = "ob.timestamp", converter = ConverterType.UNIX_DATE),
@Provider(name = ProviderName.HAMWEATHER, property = "periods.timestamp", converter = ConverterType.UNIX_DATE),
@Provider(name = ProviderName.METEOBLUE, property = "last_model_update", converter = ConverterType.JSON_DATE) })
private Calendar observationTime;

@ProviderMappings({
@Provider(name = ProviderName.OPENWEATHERMAP, property = "weather.id"),
@Provider(name = ProviderName.YAHOO, property = "code"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "weatherCode"),
@Provider(name = ProviderName.HAMWEATHER, property = "weatherPrimaryCoded", converter = ConverterType.MULTI_ID),
@Provider(name = ProviderName.METEOBLUE, property = "pictocode"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public enum ProviderName {
OPENWEATHERMAP,
FORECASTIO,
WORLDWEATHERONLINE,
YAHOO,
HAMWEATHER,
METEOBLUE;

Expand All @@ -37,8 +36,6 @@ public static ProviderName parse(String name) {
return FORECASTIO;
} else if (WORLDWEATHERONLINE.toString().equalsIgnoreCase(name)) {
return WORLDWEATHERONLINE;
} else if (YAHOO.toString().equalsIgnoreCase(name)) {
return YAHOO;
} else if (HAMWEATHER.toString().equalsIgnoreCase(name)) {
return HAMWEATHER;
} else if (METEOBLUE.toString().equalsIgnoreCase(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class Temperature {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "temp.day"),
@Provider(name = ProviderName.FORECASTIO, property = "currently.temperature"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "temp_C"),
@Provider(name = ProviderName.YAHOO, property = "condition.temp"),
@Provider(name = ProviderName.HAMWEATHER, property = "tempC"),
@Provider(name = ProviderName.METEOBLUE, property = "temperature") })
private Double current;
Expand All @@ -38,7 +37,6 @@ public class Temperature {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "temp.min"),
@Provider(name = ProviderName.FORECASTIO, property = "temperatureMin"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "tempMinC"),
@Provider(name = ProviderName.YAHOO, property = "forecast.low"),
@Provider(name = ProviderName.HAMWEATHER, property = "minTempC"),
@Provider(name = ProviderName.METEOBLUE, property = "temperature_min") })
private Double min;
Expand All @@ -49,7 +47,6 @@ public class Temperature {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "temp.max"),
@Provider(name = ProviderName.FORECASTIO, property = "temperatureMax"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "tempMaxC"),
@Provider(name = ProviderName.YAHOO, property = "forecast.high"),
@Provider(name = ProviderName.HAMWEATHER, property = "maxTempC"),
@Provider(name = ProviderName.METEOBLUE, property = "temperature_max") })
private Double max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class Weather {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "message"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "data.error.msg"),
@Provider(name = ProviderName.WUNDERGROUND, property = "response.error.type"),
@Provider(name = ProviderName.YAHOO, property = "error.description"),
@Provider(name = ProviderName.METEOBLUE, property = "error_message") })
private String error;

Expand All @@ -58,7 +57,6 @@ public class Weather {
@Forecast(provider = ProviderName.WUNDERGROUND, property = "forecast.simpleforecast.forecastday"),
@Forecast(provider = ProviderName.FORECASTIO, property = "daily.data"),
@Forecast(provider = ProviderName.WORLDWEATHERONLINE, property = "data.weather"),
@Forecast(provider = ProviderName.YAHOO, property = "query.results.channel.item.forecast"),
@Forecast(provider = ProviderName.HAMWEATHER, property = "response.responses.response.periods"),
@Forecast(provider = ProviderName.METEOBLUE, property = "forecast") })
private List<org.openhab.binding.weather.internal.model.Forecast> forecast = new ArrayList<org.openhab.binding.weather.internal.model.Forecast>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class Wind {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "speed", converter = ConverterType.WIND_MPS),
@Provider(name = ProviderName.FORECASTIO, property = "windSpeed", converter = ConverterType.WIND_MPS),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "windspeedKmph"),
@Provider(name = ProviderName.YAHOO, property = "wind.speed"),
@Provider(name = ProviderName.HAMWEATHER, property = "windSpeedKPH"),
@Provider(name = ProviderName.METEOBLUE, property = "wind_speed"),
@Provider(name = ProviderName.METEOBLUE, property = "wind_speed_max") })
Expand All @@ -46,7 +45,6 @@ public class Wind {
@Provider(name = ProviderName.OPENWEATHERMAP, property = "deg"),
@Provider(name = ProviderName.FORECASTIO, property = "windBearing"),
@Provider(name = ProviderName.WORLDWEATHERONLINE, property = "winddirDegree"),
@Provider(name = ProviderName.YAHOO, property = "wind.direction"),
@Provider(name = ProviderName.HAMWEATHER, property = "windDirDEG") })
private Integer degree;

Expand All @@ -60,7 +58,6 @@ public class Wind {
private Double gust;

@ProviderMappings({
@Provider(name = ProviderName.YAHOO, property = "wind.chill"),
@Provider(name = ProviderName.WUNDERGROUND, property = "windchill_c"),
@Provider(name = ProviderName.HAMWEATHER, property = "windchillC") })
private Double chill;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class WeatherProviderFactory {
weatherProviders.put(ProviderName.OPENWEATHERMAP, OpenWeatherMapProvider.class);
weatherProviders.put(ProviderName.WORLDWEATHERONLINE, WorldWeatherOnlineProvider.class);
weatherProviders.put(ProviderName.WUNDERGROUND, WundergroundProvider.class);
weatherProviders.put(ProviderName.YAHOO, YahooProvider.class);
weatherProviders.put(ProviderName.METEOBLUE, MeteoBlueProvider.class);
}

Expand Down

This file was deleted.

Loading