expliot.core.protocols.internet.mqtt.aws

Wrapper for AWSIoTPythonSDK MQTT functionality

Module Contents

Classes

AwsMqttClient

Wrapper on AWSIoTMQTTClient class. It implements easy configuration

Attributes

DEFAULT_AWSIOT_PORT

DEFAULT_AWSIOT_TIMEOUT

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.

_onlinecb()

A callback method that is called when the thing gets connected to the AWS IoT endpoint.

_offlinecb()

A callback method that is called when the thing gets disconnected from the AWS IoT endpoint.

easy_disconnect()

Wrapper on super.disconnect() 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)

Wrapper on different configuration methods in one go 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