Skip to content

Commit

Permalink
[TTN] Add debugging statements
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed May 8, 2023
1 parent 44a1be4 commit b13ed5b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ in progress
mean iterator type: *query.stringInterruptIterator`` or ``InfluxDB Error:
not executed``.
- Add TTS (The Things Stack) / TTN (The Things Network) decoder
- Add experimental TTS/TTN HTTP Webhook forwarder
``/api/mqttkit-1/ttn/itest-foo-bar/uplinks``


.. _kotori-0.27.0:
Expand Down
1 change: 1 addition & 0 deletions kotori/daq/decoder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def probe(self, payload: str = None):
return True

# TTS/TTN: The Things Stack / The Things Network
print("self.topology:", self.topology)
if self.topology.slot.endswith('data.json') \
and payload is not None \
and "uplink_message" in payload \
Expand Down
1 change: 1 addition & 0 deletions kotori/daq/services/mig.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def process_message(self, topic, payload, **kwargs):
def decode_message(self, topic, payload):

# Compute topology information from channel topic.
print("========== decode_message >>> topic_to_topology:", topic)
topology = self.strategy.topic_to_topology(topic)
log.debug(u'Topology address: {topology}', topology=dict(topology))

Expand Down
2 changes: 2 additions & 0 deletions kotori/daq/strategy/wan.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def topic_to_topology(self, topic):
gets transmitted from an embedded device node.
"""

print("########## TOPIC:", topic)

# Decode the topic.
m = self.matcher.match(topic)
if m:
Expand Down
3 changes: 3 additions & 0 deletions kotori/io/protocol/forwarder.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,22 @@ def forward(self, bucket):
Receive data bucket from source, run through
transformation machinery and emit to target.
"""
print("bucket:", bucket)

# 1. Map/transform topology address information
if 'transform' in self.channel:
for entrypoint in read_list(self.channel.transform):
try:
transformer = KotoriBootloader.load_entrypoint(entrypoint)
print("transformer:", transformer)
bucket.tdata.update(transformer(bucket.tdata))
except ImportError as ex:
log.error('ImportError "{message}" when loading entrypoint "{entrypoint}"',
entrypoint=entrypoint, message=ex)

# MQTT doesn't prefer leading forward slashes with topic names, let's get rid of them
target_uri_tpl = self.target_uri.path.lstrip('/')
print("target_uri_tpl:", target_uri_tpl)

# Compute target bus topic from url matches
target_uri = target_uri_tpl.format(**bucket.tdata)
Expand Down

0 comments on commit b13ed5b

Please sign in to comment.