hass-core/homeassistant/components/mqtt/models.py
Malte Franken 1a5b4c105a Move imports in mqtt component (#27835)
* move imports to top-level in mqtt server

* move imports to top-level in mqtt configflow

* move imports to top-level in mqtt init

* move imports to top-level in mqtt vacuum

* move imports to top-level in mqtt light
2019-10-17 17:04:27 -07:00

20 lines
443 B
Python

"""Modesl used by multiple MQTT modules."""
from typing import Union, Callable
import attr
# pylint: disable=invalid-name
PublishPayloadType = Union[str, bytes, int, float, None]
@attr.s(slots=True, frozen=True)
class Message:
"""MQTT Message."""
topic = attr.ib(type=str)
payload = attr.ib(type=PublishPayloadType)
qos = attr.ib(type=int)
retain = attr.ib(type=bool)
MessageCallbackType = Callable[[Message], None]