weather#

class platypush.message.event.weather.NewPrecipitationForecastEvent(*args, plugin_name: str | None = None, average: float, total: float, time_frame: int, **kwargs)[source]#

Bases: Event

Event triggered when the precipitation forecast changes

__init__(*args, plugin_name: str | None = None, average: float, total: float, time_frame: int, **kwargs)[source]#
Parameters:
  • target (str) – Target node

  • origin (str) – Origin node (default: current node)

  • id (str) – Event ID (default: auto-generated)

  • timestamp (float) – Event timestamp (default: current time)

  • logging_level – Logging level for this event (default: logging.INFO)

  • disable_web_clients_notification – Don’t send a notification of this event to the websocket clients

  • kwargs – Additional arguments for the event

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.weather.NewWeatherConditionEvent(*args, plugin_name: str, summary: str | None = None, icon: str | None = None, image: str | None = None, precip_intensity: float | None = None, precip_type: str | None = None, temperature: float | None = None, apparent_temperature: float | None = None, humidity: float | None = None, pressure: float | None = None, rain_chance: float | None = None, wind_speed: float | None = None, wind_gust: float | None = None, wind_direction: float | None = None, cloud_cover: float | None = None, visibility: float | None = None, sunrise: datetime | None = None, sunset: datetime | None = None, units: str = 'metric', **kwargs)[source]#

Bases: Event

Event triggered when the weather condition changes

__init__(*args, plugin_name: str, summary: str | None = None, icon: str | None = None, image: str | None = None, precip_intensity: float | None = None, precip_type: str | None = None, temperature: float | None = None, apparent_temperature: float | None = None, humidity: float | None = None, pressure: float | None = None, rain_chance: float | None = None, wind_speed: float | None = None, wind_gust: float | None = None, wind_direction: float | None = None, cloud_cover: float | None = None, visibility: float | None = None, sunrise: datetime | None = None, sunset: datetime | None = None, units: str = 'metric', **kwargs)[source]#
Parameters:
  • plugin_name – Plugin that triggered the event.

  • summary – Summary of the weather condition.

  • icon – Icon representing the weather condition.

  • image – Image URL representing the weather condition.

  • precip_intensity – Intensity of the precipitation.

  • precip_type – Type of precipitation.

  • temperature – Temperature, in the configured unit system.

  • apparent_temperature – Apparent temperature, in the configured unit system.

  • humidity – Humidity percentage, between 0 and 100.

  • pressure – Pressure, in the configured unit system.

  • rain_chance – Chance of rain, between 0 and 100.

  • wind_speed – Wind speed, in the configured unit system.

  • wind_gust – Wind gust, in the configured unit system.

  • wind_direction – Wind direction, in degrees.

  • cloud_cover – Cloud cover percentage, between 0 and 100.

  • visibility – Visibility, in meters.

  • sunrise – Sunrise time.

  • sunset – Sunset time.

  • units – Unit system (default: metric).

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.weather.NewWeatherForecastEvent(*args, plugin_name: str, forecast: List[dict], **kwargs)[source]#

Bases: Event

Event triggered when a new weather forecast is received.

__init__(*args, plugin_name: str, forecast: List[dict], **kwargs)[source]#
Parameters:

forecast

List of weather forecast items. Format:

[
  {
    "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
  }
]

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object