hue#
- class platypush.message.event.hue.HueEvent(target=None, origin=None, id=None, timestamp=None, logging_level=20, disable_web_clients_notification=False, **kwargs)[source]#
Bases:
EventBase class for events generated by devices connected to a Philips Hue bridge.
- __init__(target=None, origin=None, id=None, timestamp=None, logging_level=20, disable_web_clients_notification=False, **kwargs)#
- 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.hue.HueSensorEvent(*args, sensor_id=None, sensor_name=None, sensor_type=None, unique_id=None, state=None, button=None, button_action=None, **kwargs)[source]#
Bases:
HueEventEvent triggered when the state of a sensor or accessory connected to a Philips Hue bridge changes.
Note that switches, dimmers and buttons paired to the bridge are also exposed as sensors (usually with type
ZLLSwitchorZGPSwitch), and their button events are reported through thebuttoneventstate attribute. For devices that follow the standard Hue button-event encoding, the event also exposes the decodedbuttonindex andbutton_action.- __init__(*args, sensor_id=None, sensor_name=None, sensor_type=None, unique_id=None, state=None, button=None, button_action=None, **kwargs)[source]#
- Parameters:
sensor_id (int or str) – ID of the sensor that triggered the event
sensor_name (str) – Name of the sensor that triggered the event
sensor_type (str) – Hue type of the sensor (e.g.
ZLLSwitch,ZLLPresence,ZLLTemperature,ZLLLightLevel,ZGPSwitch)unique_id (str) – Unique ID of the sensor (usually derived from its MAC address)
state (dict) – Current state reported by the sensor (e.g.
buttoneventfor switches,presencefor motion sensors,temperaturefor temperature sensors)button (int) – Decoded button index, if the sensor is a switch that follows the standard Hue
buttoneventencoding (e.g. 1-4 on a Hue dimmer switch)button_action (str) – Decoded button action - one of
initial_press,hold,short_releaseorlong_release- if the sensor is a switch that follows the standard Huebuttoneventencoding
- 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