-
Notifications
You must be signed in to change notification settings - Fork 17
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
[TTN] Add TTS (The Things Stack) / TTN (The Things Network) decoder #81
Conversation
What else is needed. Would you like to do some more testing? |
Dear @thiasB, thank you for the heads up. I hope to be able to follow up on this soon. It needs additional thinking if the patch already covers what we are aiming at and then some testing and polishing, including corresponding documentation. With kind regards, |
kotori/daq/decoder/tts_ttn.py
Outdated
@staticmethod | ||
def decode(payload: str): | ||
|
||
# Decode from JSON. | ||
message = json.loads(payload) | ||
|
||
# Use timestamp and decoded payload. | ||
data = OrderedDict() | ||
data["timestamp"] = message["received_at"] | ||
data.update(message["uplink_message"]["decoded_payload"]) | ||
|
||
# TODO: Add more data / metadata. | ||
# This is an implementation from scratch. It can be improved by | ||
# cherry-picking more specific decoding routines from `ttnlogger`. | ||
# https://github.com/daq-tools/ttnlogger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thiasB: This is the gist of decoding TTN uplink messages which would then happen inside Kotori. I can remember that you contributed crafting an advanced version of this within ttnlogger the other day, right?
So, when we are aiming to get en par with the implementation from ttnlogger
, we would need to fill some gaps here within a subsequent iteration.
5928451
to
57c35d0
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #81 +/- ##
==========================================
+ Coverage 52.69% 52.84% +0.14%
==========================================
Files 99 100 +1
Lines 5224 5240 +16
==========================================
+ Hits 2753 2769 +16
Misses 2471 2471
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
A basic decoder for TTS/TTN v3 Uplink Messages [1], submitted using HTTP Webhooks [2]. [1] https://www.thethingsindustries.com/docs/the-things-stack/concepts/data-formats/#uplink-messages [2] https://www.thethingsindustries.com/docs/integrations/webhooks/
Dear @thiasB, @MKO1640, @einsiedlerkrebs, @ClemensGruber, and @u-l-m-i,
following up on GH-8, and attaching to your requests at [1] ff., this patch adds a basic decoder for TTS/TTN v3 Uplink Messages [2], submitted using Webhooks [3].
It will also have a dedicated documentation page within the "Channel decoders" section [4], with a short but concise walkthrough tutorial how to configure a corresponding webhook within the TTS/TTN console, like [5].
You can invoke the specific test cases related to TTN after checking out the referenced branch by running those commands within the toplevel directory of the repository in two different terminals.
source .venv/bin/activate pytest -m ttn
With kind regards,
Andreas.
[1] https://community.hiveeyes.org/t/ttn-daten-an-kotori-weiterleiten/1422/34
[2] https://www.thethingsindustries.com/docs/reference/data-formats/#uplink-messages
[3] https://www.thethingsindustries.com/docs/integrations/webhooks/
[4] https://getkotori.org/docs/handbook/decoders/
[5] https://www.thethingsindustries.com/docs/integrations/webhooks/creating-webhooks/
P.S.: While this only implements the decoder part on the first iteration, it will be expanded, for example into a full-fledged multi-tenant forwarder implementation, on behalf of a subsequent iteration at GH-132.