Skip to content

Commit 62b8b20

Browse files
committed
the property did not work before. now it does what you expect - return true or false
1 parent 41c8ec5 commit 62b8b20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_io/adafruit_io.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import json
2323
import re
2424

25+
from adafruit_minimqtt.adafruit_minimqtt import MMQTTException
2526
from adafruit_io.adafruit_io_errors import (
2627
AdafruitIO_RequestError,
2728
AdafruitIO_ThrottleError,
@@ -117,7 +118,10 @@ def disconnect(self):
117118
@property
118119
def is_connected(self):
119120
"""Returns if connected to Adafruit IO MQTT Broker."""
120-
return self._client.is_connected
121+
try:
122+
return self._client.is_connected()
123+
except MMQTTException:
124+
return False
121125

122126
# pylint: disable=not-callable, unused-argument
123127
def _on_connect_mqtt(self, client, userdata, flags, return_code):

0 commit comments

Comments
 (0)