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
This commit is contained in:
parent
7637ceb880
commit
1a5b4c105a
19 changed files with 130 additions and 144 deletions
20
homeassistant/components/mqtt/models.py
Normal file
20
homeassistant/components/mqtt/models.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""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]
|
Loading…
Add table
Add a link
Reference in a new issue