Source code for platypush.message.event.entities

import logging
from typing import Union

from platypush.entities import Entity
from platypush.message.event import Event


[docs] class EntityEvent(Event):
[docs] def __init__(self, entity: Union[Entity, dict], *args, **kwargs): # EntityEvents can be quite verbose, so we only report them if debug # logging is enabled kwargs['logging_level'] = logging.DEBUG if isinstance(entity, Entity): entity = entity.to_dict() super().__init__(entity=entity, *args, **kwargs)
[docs] class EntityUpdateEvent(EntityEvent): """ This event is triggered whenever an entity of any type (a switch, a light, a sensor, a media player etc.) updates its state. """
[docs] class EntityDeleteEvent(EntityEvent): """ This event is triggered whenever an entity is deleted. """
# vim:sw=4:ts=4:et: