expliot.core.protocols.internet.mqtt.aws

Wrapper for AWSIoTPythonSDK MQTT functionality.

Attributes

DEFAULT_AWSIOT_PORT

DEFAULT_AWSIOT_TIMEOUT

Classes

AwsMqttClient

Wrapper on AWSIoTMQTTClient class.

Module Contents

expliot.core.protocols.internet.mqtt.aws.DEFAULT_AWSIOT_PORT = 8883
expliot.core.protocols.internet.mqtt.aws.DEFAULT_AWSIOT_TIMEOUT = 5
class expliot.core.protocols.internet.mqtt.aws.AwsMqttClient(client_id, protocol_type=MQTTv3_1_1, use_websocket=False, clean_session=True)

Bases: AWSIoTPythonSDK.MQTTLib.AWSIoTMQTTClient

Wrapper on AWSIoTMQTTClient class.

It implements easy configuration method, default callbacks and connection state check. If you need customized configuration and callbacks, directly use AWSIoTMQTTClient instead.

is_connected = False
_onlinecb()

A callback method that is called when connected.

_offlinecb()

A callback method that is called when disconnected.

easy_disconnect()

Simple disconnect based on super.disconnect().

Works with a check for valid connection before disconnecting. For resource cleanup we need to make sure and call disconnect() in finally clause in the plugins, however if it is not connected disconnect() raises an Exception, which we need to avoid. Hence, this implementation.

easy_config(**kwargs)

Simplify the different configuration methods.

Collects and provides simple callbacks to monitor connection and subscribe.

Parameters:
  • host – The AWS endpoint hostname

  • port – The AWS endpoint port

  • use_websocket – Use websocket or not

  • rootca – AWS Root CA file

  • privatekey – AWS Thing private key file

  • cert – AWS Thing certificate file

  • user – User Name

  • passwd – Password

  • timeout – Connection and MQTT operation timeout