light#

class platypush.message.event.light.LightAnimationStartedEvent(*args, animation, lights: list | None = None, groups: list | None = None, **kwargs)[source]#

Bases: LightEvent

Event triggered when a light animation is started.

__init__(*args, animation, lights: list | None = None, groups: list | None = None, **kwargs)[source]#
Parameters:

plugin_name – Name of the platypush.plugins.light.LightPlugin instance that triggered 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.light.LightAnimationStoppedEvent(*args, animation=None, lights: list | None = None, groups: list | None = None, **kwargs)[source]#

Bases: LightEvent

Event triggered when a light animation is stopped.

__init__(*args, animation=None, lights: list | None = None, groups: list | None = None, **kwargs)[source]#
Parameters:

plugin_name – Name of the platypush.plugins.light.LightPlugin instance that triggered 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.light.LightEvent(*args, plugin_name: str | None = None, **kwargs)[source]#

Bases: Event

Base class for light plugins events.

__init__(*args, plugin_name: str | None = None, **kwargs)[source]#
Parameters:

plugin_name – Name of the platypush.plugins.light.LightPlugin instance that triggered 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.light.LightStatusChangeEvent(light_id=None, light_name=None, on=None, bri=None, sat=None, hue=None, ct=None, xy=None, *args, **kwargs)[source]#

Bases: LightEvent

Event triggered when the state of a lightbulb changes

__init__(light_id=None, light_name=None, on=None, bri=None, sat=None, hue=None, ct=None, xy=None, *args, **kwargs)[source]#
Parameters:
  • light_id (int) – Light ID that triggered the event

  • light_name (str) – Light name that triggered the event

  • on (bool) – Set if the power state of the bulb changed

  • bri (int) – Set if the brightness state of the bulb changed

  • sat (int) – Set if the saturation state of the bulb changed

  • hue (int) – Set if the hue state of the bulb changed

  • ct (int) – Set if the color temperature state of the bulb changed

  • xy (list) – Set if the color of the bulb (expressed in XY coordinates) has changed

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