@@ -115,8 +115,7 @@ def wrap_socket(self, socket, server_hostname=None):
115
115
116
116
117
117
class MQTT :
118
- """MQTT Client for CircuitPython
119
-
118
+ """MQTT Client for CircuitPython.
120
119
:param str broker: MQTT Broker URL or IP Address.
121
120
:param int port: Optional port definition, defaults to 8883.
122
121
:param str username: Username for broker authentication.
@@ -448,7 +447,6 @@ def username_pw_set(self, username, password=None):
448
447
# pylint: disable=too-many-branches, too-many-statements, too-many-locals
449
448
def connect (self , clean_session = True , host = None , port = None , keep_alive = None ):
450
449
"""Initiates connection with the MQTT Broker.
451
-
452
450
:param bool clean_session: Establishes a persistent session.
453
451
:param str host: Hostname or IP address of the remote broker.
454
452
:param int port: Network port of the remote broker.
@@ -727,23 +725,10 @@ def subscribe(self, topic, qos=0):
727
725
728
726
def unsubscribe (self , topic ):
729
727
"""Unsubscribes from a MQTT topic.
730
-
731
728
:param str,list topic: Unique MQTT topic identifier string or a list
732
729
of tuples, where each tuple contains an MQTT topic identier
733
730
string.
734
731
735
- Example of unsubscribing from a topic string.
736
-
737
- .. code-block:: python
738
-
739
- mqtt_client.unsubscribe('topics/ledState')
740
-
741
- Example of unsubscribing from multiple topics.
742
-
743
- .. code-block:: python
744
-
745
- mqtt_client.unsubscribe([('topics/ledState'), ('topics/servoAngle')])
746
-
747
732
"""
748
733
topics = None
749
734
if isinstance (topic , str ):
@@ -790,8 +775,8 @@ def unsubscribe(self, topic):
790
775
791
776
def reconnect (self , resub_topics = True ):
792
777
"""Attempts to reconnect to the MQTT broker.
793
-
794
778
:param bool resub_topics: Resubscribe to previously subscribed topics.
779
+
795
780
"""
796
781
if self .logger :
797
782
self .logger .debug ("Attempting to reconnect with MQTT broker" )
@@ -996,7 +981,6 @@ def is_connected(self):
996
981
# Logging
997
982
def enable_logger (self , logger , log_level = 20 ):
998
983
"""Enables library logging provided a `logger` object.
999
-
1000
984
:param logging.Logger logger: A python logger pacakge.
1001
985
:param log_level: Numeric value of a logging level, defaults to `logging.INFO`.
1002
986
0 commit comments