The relay works on Linux, macOS, and Windows and requires Python 3.9+.
Clone the repository:
git clone https://github.com/geoffwhittington/meshtastic-matrix-relay.git
-
Create a Python virtual environment in the project directory:
python3 -m venv .pyenv
-
Activate the virtual environment:
- Linux/macOS:
source .pyenv/bin/activate
- Windows:
.pyenv\Scripts\activate
- Linux/macOS:
-
Install dependencies:
pip install -r requirements.txt
Create a config.yaml
in the project directory based on the sample_config.yaml
.
Run the relay with the virtual environment activated:
python main.py
Example output:
INFO:meshtastic.matrix.relay:Starting Meshtastic <==> Matrix Relay...
INFO:meshtastic.matrix.relay:Connecting to radio at meshtastic.local ...
INFO:meshtastic.matrix.relay:Connected to radio at meshtastic.local.
INFO:meshtastic.matrix.relay:Listening for inbound radio messages ...
INFO:meshtastic.matrix.relay:Listening for inbound matrix messages ...
INFO:meshtastic.matrix.relay:Processing matrix message from @bob:matrix.org: Hi Alice!
INFO:meshtastic.matrix.relay:Sending radio message from Bob to radio broadcast
INFO:meshtastic.matrix.relay:Processing inbound radio message from !613501e4 on channel 0
INFO:meshtastic.matrix.relay:Relaying Meshtastic message from Alice to Matrix: [Alice/VeryCoolMeshnet]: Hey Bob!
INFO:meshtastic.matrix.relay:Sent inbound radio message to matrix room: #someroomid:example.matrix.org
To run the relay automatically on startup:
- Copy the systemd service file:
mkdir -p ~/.config/systemd/user cp tools/mmrelay.service ~/.config/systemd/user/
- Enable and start the service:
systemctl --user enable mmrelay.service systemctl --user start mmrelay.service
If you would prefer to use a Dockerized version of the relay, there are unofficial third-party projects available. Please note that these are not officially supported, and issues should be reported to their respective repositories. For more details, visit the Third Party Projects page.
Contributions are welcome! We use Trunk for automated code quality checks and formatting. Please run Trunk checks before submitting pull requests.
-
Install Trunk:
curl -fsSL https://get.trunk.io | bash
-
Initialize Trunk:
trunk init
-
Run checks and fix issues:
trunk check --all --fix
For more details, see the Trunk documentation.