@@ -81,23 +81,20 @@ class MMQTTException(Exception):
8181 #pass
8282
8383class MQTT :
84- """MiniMQTT - a MQTT Client for CircuitPython"""
84+ """MQTT Client for CircuitPython
85+ :param socket: Socket object for provided network interface
86+ :param str broker: MQTT Broker URL or IP Address.
87+ :param int port: Optional port definition, defaults to 8883.
88+ :param str username: Username for broker authentication.
89+ :param str password: Password for broker authentication.
90+ :param ESP_SPIcontrol esp: An ESP network interface object.
91+ :param str client_id: Optional client identifier, defaults to a unique, generated string.
92+ :param bool is_ssl: Sets a secure or insecure connection with the broker.
93+ :param bool log: Attaches a logger to the MQTT client, defaults to logging level INFO.
94+ """
8595 # pylint: disable=too-many-arguments,too-many-instance-attributes, not-callable, invalid-name, no-member
8696 def __init__ (self , socket , broker , port = None , username = None ,
8797 password = None , esp = None , client_id = None , is_ssl = True , log = False ):
88- """Initializes a MQTT client object.
89-
90- :param socket: Socket object for provided network interface
91- :param str broker: MQTT Broker URL or IP Address.
92- :param int port: Optional port definition, defaults to 8883.
93- :param str username: Username for broker authentication.
94- :param str password: Password for broker authentication.
95- :param ESP_SPIcontrol esp: An ESP network interface object.
96- :param str client_id: Optional client identifier, defaults to a unique, generated string.
97- :param bool is_ssl: Sets a secure or insecure connection with the broker.
98- :param bool log: Attaches a logger to the MQTT client, defaults to logging level INFO.
99-
100- """
10198 # network interface
10299 self ._socket = socket
103100 if esp is not None :
@@ -189,8 +186,7 @@ def last_will(self, topic=None, message=None, qos=0, retain=False):
189186 def reconnect (self , retries = 30 , resub_topics = True ):
190187 """Attempts to reconnect to the MQTT broker.
191188 :param int retries: Amount of retries before resetting the network interface.
192- :param bool resub_topics: Client resubscribes to previously subscribed topics upon
193- a successful reconnection.
189+ :param bool resub_topics: Resubscribe to previously subscribed topics.
194190 """
195191 retries = 0
196192 while not self ._is_connected :
@@ -217,8 +213,7 @@ def reconnect(self, retries=30, resub_topics=True):
217213 # pylint: disable=too-many-branches, too-many-statements
218214 def connect (self , clean_session = True ):
219215 """Initiates connection with the MQTT Broker.
220- :param bool clean_session: Establishes a persistent session
221- with the broker. Defaults to a non-persistent session.
216+ :param bool clean_session: Establishes a persistent session.
222217 """
223218 self ._set_interface ()
224219 if self ._logger is not None :
@@ -293,8 +288,7 @@ def connect(self, clean_session=True):
293288 return result
294289
295290 def disconnect (self ):
296- """Disconnects the MiniMQTT client from
297- the MQTT broker.
291+ """Disconnects the MiniMQTT client from the MQTT broker.
298292 """
299293 self .is_connected ()
300294 if self ._logger is not None :
@@ -311,7 +305,6 @@ def disconnect(self):
311305 def ping (self ):
312306 """Pings the MQTT Broker to confirm if the broker is alive or if
313307 there is an active network connection.
314-
315308 """
316309 self .is_connected ()
317310 if self ._logger is not None :
@@ -418,8 +411,7 @@ def subscribe(self, topic, qos=0):
418411 :param str topic: Unique MQTT topic identifier.
419412 :param int qos: Quality of Service level for the topic, defaults to zero.
420413 :param tuple topic: Tuple containing topic identifier strings and qos level integers.
421- :param list topic: List of tuples containing topic identifier strings and
422- qos level integers.
414+ :param list topic: List of tuples containing topic identifier strings and qos.
423415
424416 Example of subscribing a topic string.
425417 .. code-block:: python
@@ -653,7 +645,7 @@ def _check_qos(qos_level):
653645
654646 def _set_interface (self ):
655647 """Sets a desired network hardware interface.
656- Note: The network hardware must be set in init
648+ The network hardware must be set in init
657649 prior to calling this method.
658650 """
659651 if self ._esp :
@@ -692,8 +684,7 @@ def attach_logger(self, logger_name='log'):
692684
693685 def set_logger_level (self , log_level ):
694686 """Sets the level of the logger, if defined during init.
695- :param string log_level: Level of logging to output to the REPL. Accepted
696- levels are DEBUG, INFO, WARNING, EROR, and CRITICIAL.
687+ :param string log_level: Level of logging to output to the REPL.
697688 """
698689 if self ._logger is None :
699690 raise MMQTTException ('No logger attached - did you create it during initialization?' )
0 commit comments