Only publish MQTT on LoRa Tx if packet is from us and on Rx if not #3245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we're only publishing to MQTT when we're transmitting a packet via LoRa. Nevertheless, we still see received packets on MQTT as well, but this is only because we forced a node to always rebroadcast when MQTT is enabled:
firmware/src/mesh/FloodingRouter.cpp
Line 24 in 143ee9c
However, as observed in #3138, direct messages towards the MQTT node will not be published, because we don't rebroadcast if we're the destination.
With this, we're publishing when transmitting via LoRa only when we're the original transmitter, and we publish when receiving when we're not the original transmitter. This way we can get rid of the "hack" where we're always rebroadcasting via LoRa when MQTT is enabled, and we'll see direct messages to the MQTT node as well.
Since we already don't publish packets to MQTT if they came via MQTT, this will not create any extra traffic when bridging networks.
Also fixed a possible issue where
env->packet
contains the encrypted version of the packet and we're trying to printdecoded.portnum
.