descartes / TheThingsStack-Integration-Starters

Starter / Template code for various The Things Stack (v3) integrations
MIT License
26 stars 14 forks source link

No uplink in payload #1

Open panamantis opened 2 years ago

panamantis commented 2 years ago

The TTS.MQTT.Tab.py uses: mqttc.subscribe("#", 0) # all device uplinks ??works?

But, my json has no raw payloads. But I can see the payload data in the ttn viewer.

descartes commented 2 years ago

mqttc.subscribe("#", 0) means all messages - uplinks, join requests, downlinks, everything for that application. So if you are seeing nothing at all, then there is something else going on.

As for the "works?" question, this code was used for the TTN Summer Academy and people on the TTN forum are using it and my clients are using it and I use it and it's been around for 10 months and this is the first time someone has asked if it actually works at all, so overall, yeah, I think it works. ;-)

Without any other logs or details it's going to be very hard to know what the issue here is. If you need help debugging your setup, please post on the TTN forum. Please try with an MQTT client like MQTT Explorer before you post so we know if your credentials are OK.

panamantis commented 2 years ago

Thanks for the response. My confusion was resolved via your previous comments here (I just didn't recognize the base64 data format): https://www.thethingsnetwork.org/forum/t/webhook-encrypted-frm-payload-content/49419/3

So v3 now base64 encodes the payload data into the frm_payload field so to match what you see in the live viewer (HEX) you'd decode the uplink with ie: payload = base64.b64decode(parsedJSON['uplink_message']['frm_payload']).decode()