I can´t publish MQTT messages after a few days
I'm using "mqttasgi" as library with Django justo to listen and posting many messages. However, for some reason after a few days it is no longer possible to continue posting messages. It should be noted that I am using the amazon login with "mqttasgi" and a level 1 of QO(because AWS doesn't allow a level 2 of QO).
This is my procfile
mqttasgi -H $MQTT_URL -p $MQTT_PORT -v 2 -C $TLS_CERT -K $TLS_KEY -S $TLS_CA iot_stracontech.asgi:application```
and this is my consumer.py
from mqttasgi.consumers import MqttConsumer from mqtt_handler.tasks import processmqttmessage import json
class MyMqttConsumer(MqttConsumer):
async def connect(self):
await self.subscribe('tpx/things/+/uplink', 0)
await self.channel_layer.group_add("stracontech", self.channel_name)
async def receive(self, mqtt_message):
print('Received a message at topic:', mqtt_message['topic'])
print('With payload', mqtt_message['payload'])
print('And QOS:', mqtt_message['qos'])
dictresult = json.loads(mqtt_message['payload'])
jsonresult = json.dumps(dictresult)
processmqttmessage.delay(jsonresult, mqtt_message['topic'])
pass
async def publish_results(self, event):
data = event['result']
await self.publish("stracontech/procesed/" + event['result']['device_id'] + "/result",
json.dumps(data).encode('utf-8'), qos=1, retain=False)
async def disconnect(self):
await self.unsubscribe('tpx/things/+/uplink')
I want to know if exist a way to know why does it stop publishing messages, anyway to do a debug or see the logs?
Pd: @Santiago Ivulich maybe you can give me a hand with that.