weather.buienradar#

Description#

Plugin for getting weather updates through Buienradar - a Dutch weather app.

Configuration#

weather.buienradar:
  # [Required]
  # Default latitude.
  lat:   # type=float

  # [Required]
  # Default longitude.
  long:   # type=float

  # [Optional]
  # Default number of minutes to look ahead for
  # precipitation forecast.
  # time_frame: 120  # type=int

  # [Optional]
  # How often the `WeatherPlugin.loop <https://docs.platypush.tech/platypush/plugins/weather.html#platypush.plugins.weather.WeatherPlugin.loop>`_ function should be
  # executed (default: 15 seconds). *NOTE*: For back-compatibility
  # reasons, the `poll_seconds` argument is also supported, but it's
  # deprecated.
  # poll_interval: 120  # type=Optional[float]

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=Optional[float]

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Dependencies#

pip

pip install buienradar

Triggered events#

Actions#

Module reference#

class platypush.plugins.weather.buienradar.WeatherBuienradarPlugin(*_, **__)[source]#

Bases: WeatherPlugin

Plugin for getting weather updates through Buienradar - a Dutch weather app.

__init__(lat: float, long: float, time_frame: int = 120, **kwargs)[source]#
Parameters:
  • lat – Default latitude.

  • long – Default longitude.

  • time_frame – Default number of minutes to look ahead for precipitation forecast.

get_current_weather(*args, lat: float | None = None, long: float | None = None, units: str | None = None, **kwargs) dict#

Returns the current weather.

Parameters:
  • lat – Override the lat configuration value.

  • long – Override the long configuration value.

  • units – Override the units configuration value.

Returns:

{
  "apparent_temperature": 9.0,
  "cloud_cover": 0.5,
  "humidity": 30,
  "icon": "cloudy",
  "precip_intensity": "Intensity of the precipitation",
  "precip_type": "rain",
  "pressure": 1000.0,
  "summary": "Cloudy",
  "sunrise": "2020-01-01T06:00:00+00:00",
  "sunset": "2020-01-01T18:00:00+00:00",
  "temperature": 10.0,
  "time": "2020-01-01T12:00:00+00:00",
  "units": "metric",
  "visibility": 2000.0,
  "wind_direction": 180.0,
  "wind_gust": 15.0,
  "wind_speed": 10.0
}

get_forecast(*args, lat: float | None = None, long: float | None = None, units: str | None = None, **kwargs) List[dict]#

Returns the weather forecast for the upcoming hours/days.

Parameters:
  • lat – Override the lat configuration value.

  • long – Override the long configuration value.

  • units – Override the units configuration value.

Returns:

[
  {
    "apparent_temperature": 9.0,
    "cloud_cover": 0.5,
    "humidity": 30,
    "icon": "cloudy",
    "precip_intensity": "Intensity of the precipitation",
    "precip_type": "rain",
    "pressure": 1000.0,
    "summary": "Cloudy",
    "sunrise": "2020-01-01T06:00:00+00:00",
    "sunset": "2020-01-01T18:00:00+00:00",
    "temperature": 10.0,
    "time": "2020-01-01T12:00:00+00:00",
    "units": "metric",
    "visibility": 2000.0,
    "wind_direction": 180.0,
    "wind_gust": 15.0,
    "wind_speed": 10.0
  }
]

get_precipitation(lat: float | None = None, long: float | None = None, time_frame: int | None = None)[source]#

Get the precipitation forecast for the specified time frame.

Parameters:
  • lat – Weather latitude (default: configured latitude)

  • long – Weather longitude (default: configured longitude)

  • time_frame – Time frame for the forecast in minutes (default: configured time_frame)

main()#

Implementation of the main loop of the plugin.

publish_entities(entities: Collection[Any] | None, callback: Callable[[Entity], Any] | None = None, **kwargs) Collection[Entity]#

Publishes a list of entities. The downstream consumers include:

It also accepts an optional callback that will be called when each of the entities in the set is flushed to the database.

You usually don’t need to override this class (but you may want to extend transform_entities() instead if your extension doesn’t natively handle Entity objects).

start()#

Start the plugin.

status(*args, **kwargs) dict#
Returns:

{
  "current": {
    "apparent_temperature": 9.0,
    "cloud_cover": 0.5,
    "humidity": 30,
    "icon": "cloudy",
    "precip_intensity": "Intensity of the precipitation",
    "precip_type": "rain",
    "pressure": 1000.0,
    "summary": "Cloudy",
    "sunrise": "2020-01-01T06:00:00+00:00",
    "sunset": "2020-01-01T18:00:00+00:00",
    "temperature": 10.0,
    "time": "2020-01-01T12:00:00+00:00",
    "units": "metric",
    "visibility": 2000.0,
    "wind_direction": 180.0,
    "wind_gust": 15.0,
    "wind_speed": 10.0
  },
  "forecast": [
    {
      "apparent_temperature": 9.0,
      "cloud_cover": 0.5,
      "humidity": 30,
      "icon": "cloudy",
      "precip_intensity": "Intensity of the precipitation",
      "precip_type": "rain",
      "pressure": 1000.0,
      "summary": "Cloudy",
      "sunrise": "2020-01-01T06:00:00+00:00",
      "sunset": "2020-01-01T18:00:00+00:00",
      "temperature": 10.0,
      "time": "2020-01-01T12:00:00+00:00",
      "units": "metric",
      "visibility": 2000.0,
      "wind_direction": 180.0,
      "wind_gust": 15.0,
      "wind_speed": 10.0
    }
  ]
}

stop()#

Stop the plugin.

transform_entities(entities: List[dict], *, type: str)#

This method takes a list of entities in any (plugin-specific) format and converts them into a standardized collection of Entity objects. Since this method is called by publish_entities() before entity updates are published, you may usually want to extend it to pre-process the entities managed by your extension into the standard format before they are stored and published to all the consumers.

wait_stop(timeout=None)#

Wait until a stop event is received.