MQTT bridging¶
dataClay includes support for client communication via MQTT.
In order to use this functionality, the client class has to inherit the MQTTMixin class.
The client will be able to specify how the messages should be handled, which topics will be subscribed to, and send messages with a topic.
- class MQTTMixin[source]¶
MQTT mechanisms
- message_handling(client, userdata, msg)[source]¶
Placeholder for function message_handling. This function describes how the client will handle a message.
- Parameters:
client (paho.mqtt.client.Client) – The client instance for this callback.
userdata – The private user data as set in Client() or user_data_set().
msg (MQTTMessage) – The received message. This is a class with members topic, payload, qos, retain.
- Raises:
NotImplementedError – If the message_handling function has not been implemented, an error is raised.
- subscribe_to_topic(topic: str = 'dataclay')[source]¶
Subscribes the client to a topic and indicates how it will handle a message received.
- Parameters:
topic (str, optional) – String representing the topic. Defaults to “dataclay”.