Skip to content

ucloud: Update QoS settings. #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions arduino_iot_cloud/ucloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ async def discovery_task(self, interval=0.100):

if lastval_record := self.records.pop("r:m", None):
lastval_record.add_to_pack(self.senmlpack)
self.mqtt.subscribe(self.create_topic("shadow", "i"))
self.mqtt.publish(self.create_topic("shadow", "o"), self.senmlpack.to_cbor(), qos=True)
self.mqtt.subscribe(self.create_topic("shadow", "i"), qos=1)
self.mqtt.publish(self.create_topic("shadow", "o"), self.senmlpack.to_cbor(), qos=1)
logging.info("Device configured via discovery protocol.")
await asyncio.sleep(interval)

Expand All @@ -308,7 +308,7 @@ async def mqtt_task(self, interval=0.100):
logging.debug("Pushing records to Arduino IoT cloud:")
for record in self.senmlpack._data:
logging.debug(f" ==> record: {record.name} value: {str(record.value)[:48]}...")
self.mqtt.publish(self.topic_out, self.senmlpack.to_cbor(), qos=True)
self.mqtt.publish(self.topic_out, self.senmlpack.to_cbor(), qos=1)
self.last_ping = timestamp()
elif self.keepalive and (timestamp() - self.last_ping) > self.keepalive:
self.mqtt.ping()
Expand Down