diff --git a/lrs_json_api/bridge.py b/lrs_json_api/bridge.py index 27ba1e7039df3f44e75c3ee0f5b94d3f0db89c23..ff5d9fd7a4beb5e994b6856628431cf1103dc736 100644 --- a/lrs_json_api/bridge.py +++ b/lrs_json_api/bridge.py @@ -326,11 +326,15 @@ class Bridge(Mqtt): self.connect_publish("connected") def get_topic_from_unit(self, unit, subtopic): + print("GET_TOPIC_FROM_UNIT unit:", unit) + print("GET_TOPIC_FROM_UNIT subtopic:", subtopic) topic = "" unit = unit.lstrip("/") + print("GET_TOPIC_FROM_UNIT unit:", unit, self.unit_to_prefix_map) if unit in self.unit_to_prefix_map: + print("UNIT IN DICT unit:", unit) topic = f'{self.unit_to_prefix_map[unit]}/{unit}/{subtopic}' - # self.get_logger().info(f'get_topic_from_unit: {unit} - {topic}') + self.get_logger().info(f'get_topic_from_unit: {unit} - {topic}') return topic @@ -623,7 +627,7 @@ class Bridge(Mqtt): topic = "/".join(topic_elements[5:]) #print("SELECTTOPIC:", topic) - #if agent == "spot0": + #if agent == "op2": # print("TOPIC:", topic) #if topic == "heartbeat": @@ -641,6 +645,7 @@ class Bridge(Mqtt): if topic == "heartbeat": + print("HEARTBEAT:", agent, "/".join(topic_elements[:4])) self.unit_to_prefix_map[agent] = "/".join(topic_elements[:4]) return @@ -1134,6 +1139,7 @@ class Bridge(Mqtt): self.client.publish(topic, payload=request.msg) response.success = True else: + self.get_logger().error(f'BRIDGE: Could not find topic for unit: {unit}') response.success = False except Exception as exc: print("EXCEPTION on_message", type(exc))