Skip to content

Commit 5dbbfa7

Browse files
author
Jim Bennett
committed
merging
Revert "merging" This reverts commit 4f3aea6b2cfaa98be31d82e5076fe3df29d198f7. Revert "Revert "merging"" This reverts commit a250e00d6964442592fad5fbeb7f31ddb339daf7. Delete mpy.sh
1 parent 2bfa039 commit 5dbbfa7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

adafruit_azureiot/iot_mqtt.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def _handle_device_twin_update(self, msg: str, topic: str) -> None:
213213
for property_name, value in desired.items():
214214
self._callback.device_twin_desired_updated(property_name, value, desired_version)
215215

216-
def _handle_direct_method(self, msg: str, topic: str) -> None:
216+
def _handle_direct_method(self, client, topic: str, msg: str) -> None:
217217
index = topic.find("$rid=")
218218
method_id = 1
219219
method_name = "None"
@@ -278,7 +278,8 @@ def _on_message(self, client, msg_topic, payload) -> None:
278278
if topic.startswith("$iothub/twin/PATCH/properties/desired/") or topic.startswith("$iothub/twin/res/200/?$rid="):
279279
self._handle_device_twin_update(str(msg), topic)
280280
elif topic.startswith("$iothub/methods"):
281-
self._handle_direct_method(str(msg), topic)
281+
pass
282+
# self._handle_direct_method(str(msg), topic)
282283
else:
283284
if not topic.startswith("$iothub/twin/res/"): # not twin response
284285
self._logger.error("ERROR: unknown twin! - {}".format(msg))
@@ -365,7 +366,9 @@ def __init__(
365366
def _subscribe_to_core_topics(self):
366367
self._mqtts.subscribe("devices/{}/messages/events/#".format(self._device_id))
367368
self._mqtts.subscribe("devices/{}/messages/devicebound/#".format(self._device_id))
368-
self._mqtts.subscribe("$iothub/methods/#")
369+
370+
self._mqtts.add_topic_callback("$iothub/methods/#", self._handle_direct_method)
371+
# self._mqtts.subscribe("$iothub/methods/#")
369372

370373
def _subscribe_to_twin_topics(self):
371374
self._mqtts.subscribe("$iothub/twin/PATCH/properties/desired/#") # twin desired property changes

0 commit comments

Comments
 (0)