expliot.plugins.mqtt.mqttsub

Plugin to subscribe to a topic of a MQTT broker.

Module Contents

Classes

MqttSub

Subscribe to a topic of a MQTT broker.

class expliot.plugins.mqtt.mqttsub.MqttSub

Bases: expliot.core.tests.test.Test

Subscribe to a topic of a MQTT broker.

Output Format: [

{

“topic”: “foobar/topic”, “payload”: “Foobar payload”

}, # … May be zero or more entries

]

on_msg(client, userdata, message)

Custom on_message callback for MqttClient. It just logs the topic and the message received.

Args:

client (MqttClient) - The MQTT client object. This is not used. userdata (caller defined): Callback specific data passed in

__init__() of MqttClient. This is not used as we cane use self members to pass information.

message (MQTTMessage): Contains topic, payload, qos, retain

for the message received from the broker.

Returns:

Nothing.

execute()

Execute the plugin.