Skip to content

Filter --reply based on specified channel index#883

Merged
ianmcorvidae merged 1 commit into
meshtastic:masterfrom
thatSFguy:patch-3
May 31, 2026
Merged

Filter --reply based on specified channel index#883
ianmcorvidae merged 1 commit into
meshtastic:masterfrom
thatSFguy:patch-3

Conversation

@thatSFguy

Copy link
Copy Markdown
Contributor

Fixes an issue where automatic replies generated by the --reply flag were incorrectly routed and unfiltered.

Changes

  1. Channel Routing: Responses are now explicitly sent back on the same channel index the message was received on, rather than defaulting to the primary channel (0).

  2. Channel Filtering: The --reply action now respects the --ch-index flag. It will only trigger a response if the incoming message matches the user-specified channel.

Behavior Comparison

Command: meshtastic --ch-index 1 --reply

Scenario Previous Behavior New Behavior
Msg received on Ch 0 Sent reply on Ch 0 Ignored (No match)
Msg received on Ch 1 Sent reply on Ch 0 Sent reply on Ch 1
Msg received on Ch 2 Sent reply on Ch 0 Ignored (No match)

Technical Implementation

The onReceive handler now casts args.ch_index to an integer and performs a comparison against the channel field in the incoming packet before calling interface.sendText().

Ensures that automatic replies are sent back on the same channel index the message was received on. Previously, all replies defaulted to the primary channel (0), even if the incoming message arrived on a secondary channel. Additionally it ensures incoming messages match the specified channel index.

E.g:  meshtastic --ch-index 1 --reply .

Modified the `onReceive` handler to extract the `channel` index from received packets. This ensures `interface.sendText` targets the originating channel rather than always defaulting to the primary channel. Added a filter to ensure that only the specified channel index is being replied to.
@ianmcorvidae ianmcorvidae merged commit c8b1b8e into meshtastic:master May 31, 2026
1 check passed
@ianmcorvidae

Copy link
Copy Markdown
Contributor

Thanks for the pull request! I've merged it and also added a bit of a note to the --reply command line help noting the behavior when --ch-index is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants