support custom channel

pull/1/head
Geoff Whittington 2023-04-17 20:39:14 -04:00
rodzic 0500e37fa8
commit 957a4e3b76
3 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -39,6 +39,7 @@ matrix:
meshtastic: meshtastic:
host: "meshtastic.local" host: "meshtastic.local"
broadcast_enabled: false broadcast_enabled: false
channel: 0
logging: logging:
level: "debug" level: "debug"

10
main.py
Wyświetl plik

@ -157,13 +157,19 @@ async def on_room_message(room: MatrixRoom, event: RoomMessageText) -> None:
logger.debug( logger.debug(
f"Sending radio message from {event.sender} to {target_node} ..." 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}") logger.info(f"Sent radio message from {event.sender} to {target_node}")
elif relay_config["meshtastic"]["broadcast_enabled"]: elif relay_config["meshtastic"]["broadcast_enabled"]:
logger.debug( logger.debug(
f"Sending radio message from {event.sender} to radio broadcast ..." 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") logger.info(f"Sent radio message from {event.sender} to radio broadcast")
elif not relay_config["meshtastic"]["broadcast_enabled"]: elif not relay_config["meshtastic"]["broadcast_enabled"]:
logger.debug( logger.debug(

Wyświetl plik

@ -7,6 +7,7 @@ matrix:
meshtastic: meshtastic:
host: "meshtastic.local" host: "meshtastic.local"
broadcast_enabled: false broadcast_enabled: false
channel: 0
logging: logging:
level: "debug" level: "debug"