From 957a4e3b76b6197103eaf787ab523f5de09f8d79 Mon Sep 17 00:00:00 2001 From: Geoff Whittington Date: Mon, 17 Apr 2023 20:39:14 -0400 Subject: [PATCH] support custom channel --- README.md | 1 + main.py | 10 ++++++++-- sample_config.yaml | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 322803c..76ed966 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ matrix: meshtastic: host: "meshtastic.local" broadcast_enabled: false + channel: 0 logging: level: "debug" diff --git a/main.py b/main.py index cf44131..7c0cb94 100644 --- a/main.py +++ b/main.py @@ -157,13 +157,19 @@ async def on_room_message(room: MatrixRoom, event: RoomMessageText) -> None: logger.debug( f"Sending radio message from {event.sender} to {target_node} ..." ) - meshtastic_interface.sendText(text, destinationId=target_node) + meshtastic_interface.sendText( + text=text, + channelIndex=relay_config["meshtastic"]["channel"], + destinationId=target_node, + ) logger.info(f"Sent radio message from {event.sender} to {target_node}") elif relay_config["meshtastic"]["broadcast_enabled"]: logger.debug( f"Sending radio message from {event.sender} to radio broadcast ..." ) - meshtastic_interface.sendText(text) + meshtastic_interface.sendText( + text=text, channelIndex=relay_config["meshtastic"]["channel"] + ) logger.info(f"Sent radio message from {event.sender} to radio broadcast") elif not relay_config["meshtastic"]["broadcast_enabled"]: logger.debug( diff --git a/sample_config.yaml b/sample_config.yaml index 8cb3c22..18a124b 100644 --- a/sample_config.yaml +++ b/sample_config.yaml @@ -7,6 +7,7 @@ matrix: meshtastic: host: "meshtastic.local" broadcast_enabled: false + channel: 0 logging: level: "debug"