weather.openweathermap

class platypush.plugins.weather.openweathermap.WeatherOpenweathermapPlugin(token: str, location: Optional[str] = None, city_id: Optional[int] = None, lat: Optional[float] = None, long: Optional[float] = None, zip_code: Optional[str] = None, units: str = 'metric', **kwargs)[source]

OpenWeatherMap plugin. This is the advised plugin to use for weather forecasts since Darksky has officially shut down their API.

You’ll need an API token from OpenWeatherMap in order to use this API.

__init__(token: str, location: Optional[str] = None, city_id: Optional[int] = None, lat: Optional[float] = None, long: Optional[float] = None, zip_code: Optional[str] = None, units: str = 'metric', **kwargs)[source]
Parameters
  • token – OpenWeatherMap API token.

  • location – If set, then this location will be used by default for weather lookup. If multiple locations share the same name you can disambiguate by specifying the country code as well - e.g. London,GB.

  • city_id – If set, then this city ID will be used by default for weather lookup. The full list of city IDs is available here.

  • lat – If lat/long are set, then the weather by default will be retrieved for the specified geo location.

  • long – If lat/long are set, then the weather by default will be retrieved for the specified geo location.

  • zip_code – If set, then this ZIP code (should be in the form zip,country_code) will be used by default for weather lookup.

  • units – Supported: metric (default), standard and imperial.

get(url, **kwargs)[source]

Perform a GET request

Parameters
get_current_weather(*, location: Optional[str] = None, city_id: Optional[int] = None, lat: Optional[float] = None, long: Optional[float] = None, zip_code: Optional[str] = None, units: Optional[str] = None, **kwargs) dict[source]

Returns the current weather.

Parameters
  • location – Override the location configuration value.

  • city_id – Override the city_id configuration value.

  • lat – Override the lat configuration value.

  • long – Override the long configuration value.

  • zip_code – Override the zip_code configuration value.

  • units – Override the units configuration value.