sun
#
- class platypush.message.event.sun.SunEvent(latitude: float | None = None, longitude: float | None = None, time: datetime | None = None, *args, **kwargs)[source]#
Bases:
Event
Base class for sun related events (sunrise and sunset).
- __init__(latitude: float | None = None, longitude: float | None = None, time: datetime | None = None, *args, **kwargs)[source]#
- Parameters:
latitude – Latitude for the sun event.
longitude – Longitude for the sun event.
time – Event timestamp.
- 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.sun.SunriseEvent(latitude: float | None = None, longitude: float | None = None, time: datetime | None = None, *args, **kwargs)[source]#
Bases:
SunEvent
Class for sunrise events.
- __init__(latitude: float | None = None, longitude: float | None = None, time: datetime | None = None, *args, **kwargs)#
- Parameters:
latitude – Latitude for the sun event.
longitude – Longitude for the sun event.
time – Event timestamp.
- 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.sun.SunsetEvent(latitude: float | None = None, longitude: float | None = None, time: datetime | None = None, *args, **kwargs)[source]#
Bases:
SunEvent
Class for sunset events.
- __init__(latitude: float | None = None, longitude: float | None = None, time: datetime | None = None, *args, **kwargs)#
- Parameters:
latitude – Latitude for the sun event.
longitude – Longitude for the sun event.
time – Event timestamp.
- 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