sensor#

class platypush.message.event.sensor.SensorDataAboveThresholdEvent(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)[source]#

Bases: SensorDataEvent

Event triggered when a sensor’s read goes above a configured threshold

__init__(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)#
Parameters:
  • data – Sensor data.

  • source – Sensor source - usually the plugin qualified name.

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.sensor.SensorDataBelowThresholdEvent(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)[source]#

Bases: SensorDataEvent

Event triggered when a sensor’s read goes below a configured threshold

__init__(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)#
Parameters:
  • data – Sensor data.

  • source – Sensor source - usually the plugin qualified name.

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.sensor.SensorDataChangeEvent(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)[source]#

Bases: SensorDataEvent

Event triggered when a sensor has new data

__init__(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)#
Parameters:
  • data – Sensor data.

  • source – Sensor source - usually the plugin qualified name.

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.sensor.SensorDataEvent(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)[source]#

Bases: Event, ABC

Sensor events base class.

__init__(*args, data: float | int | Mapping[str, float | int] | Iterable[float | int], source: str | None = None, **kwargs)[source]#
Parameters:
  • data – Sensor data.

  • source – Sensor source - usually the plugin qualified name.

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