Skip to content

Commit 78c6515

Browse files
committed
(+) example & ref-to-example
1 parent e040c47 commit 78c6515

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def deinit(self):
200200
self.disconnect()
201201

202202
def will_set(self, topic=None, payload=None, qos=0, retain=False):
203-
"""Sets the last will and testament properties. MUST be called before connect().
203+
"""Sets the last will and testament properties. MUST be called before `connect()`.
204204
205205
:param str topic: MQTT Broker topic.
206206
:param str payload: Last will disconnection payload.
@@ -681,10 +681,11 @@ def loop_forever(self):
681681
method if you want to run a program forever.
682682
Code below a call to this method will NOT execute.
683683
684-
NOTE: This method is depreciated and will be removed in the
685-
next major release. Please see examples/minimqtt_pub_sub_blocking.py
686-
for an example of creating a blocking loop which can handle wireless
687-
network events.
684+
.. note:: This method is depreciated and will be removed in the
685+
next major release. Please see
686+
`examples/minimqtt_pub_sub_blocking.py <examples.html#basic-forever-loop>`_
687+
for an example of creating a blocking loop which can handle wireless
688+
network events.
688689
"""
689690
while True:
690691
if self._sock.connected:
@@ -835,7 +836,7 @@ def attach_logger(self, logger_name="log"):
835836
def set_logger_level(self, log_level):
836837
"""Sets the level of the logger, if defined during init.
837838
838-
:param string log_level: Level of logging to output to the REPL.
839+
:param str log_level: Level of logging to output to the REPL.
839840
"""
840841
if self.logger is None:
841842
raise MMQTTException(

docs/examples.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@ Ensure your device works with this simple test.
66
.. literalinclude:: ../examples/minimqtt_simpletest.py
77
:caption: examples/minimqtt_simpletest.py
88
:linenos:
9+
10+
Basic forever loop
11+
------------------
12+
13+
This example shows how to write a loop that runs forever
14+
& can handle disconnect/re-connect events.
15+
16+
.. literalinclude:: ../examples/minimqtt_pub_sub_blocking.py
17+
:caption: examples/minimqtt_pub_sub_blocking.py
18+
:linenos:

0 commit comments

Comments
 (0)