kopia lustrzana https://github.com/mate-dev/meshtastic-matrix-relay
Update README.md
rodzic
add017bc06
commit
e3e8d2ae9c
63
README.md
63
README.md
|
@ -1,10 +1,35 @@
|
|||
# Meshtastic <=> Matrix Relay
|
||||
|
||||
Simple relay between Meshtastic and a Matrix homeserver.
|
||||
A powerful and easy-to-use relay between Meshtastic devices and Matrix chat rooms, allowing seamless communication across platforms.
|
||||
|
||||
## Features
|
||||
|
||||
- Bidirectional message relay between Meshtastic devices and Matrix chat rooms, capable of supporting multiple meshnets
|
||||
- Supports both serial and network connections for Meshtastic devices
|
||||
- Custom keys are embedded in Matrix messages with information (Meshtastic longname + meshnet name) that is used when relaying messages between two or more meshnets.
|
||||
- Truncates long messages to fit within Meshtastic's payload size
|
||||
- SQLite database to store Meshtastic longnames for improved functionality
|
||||
- Customizable logging level for easy debugging
|
||||
- Configurable through a simple YAML file
|
||||
|
||||
## Custom Keys in Matrix Messages
|
||||
|
||||
This relay utilizes custom keys in Matrix messages to store metadata about Meshtastic users. When a message is received from a remote meshnet, the relay includes the sender's longname and the meshnet name as custom keys in the Matrix message. This metadata helps identify the source of the message and provides context for users in the Matrix chat room.
|
||||
|
||||
Example message format with custom keys:
|
||||
|
||||
```
|
||||
{
|
||||
"msgtype": "m.text",
|
||||
"body": "[Alice/RemoteMesh]: Hello from the remote meshnet!",
|
||||
"meshtastic_longname": "Alice",
|
||||
"meshtastic_meshnet": "RemoteMesh"
|
||||
}
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Clone the repo
|
||||
Clone the repository:
|
||||
|
||||
```
|
||||
git clone https://github.com/geoffwhittington/meshtastic-matrix-relay.git
|
||||
|
@ -12,24 +37,25 @@ git clone https://github.com/geoffwhittington/meshtastic-matrix-relay.git
|
|||
|
||||
### Setup
|
||||
|
||||
In the directory create a Python virtualenv:
|
||||
Create a Python virtual environment in the project directory:
|
||||
|
||||
```
|
||||
python3 -m venv .pyenv
|
||||
```
|
||||
|
||||
Activate the virtualenv and install dependencies
|
||||
Activate the virtual environment and install dependencies:
|
||||
|
||||
```
|
||||
source .pyenv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
|
||||
### Configuration
|
||||
|
||||
Create a `config.yaml` in the directory with the appropriate values. A sample is provided below:
|
||||
Create a `config.yaml` in the project directory with the appropriate values. A sample configuration is provided below:
|
||||
|
||||
```
|
||||
```yaml
|
||||
matrix:
|
||||
homeserver: "https://example.matrix.org"
|
||||
access_token: "reaalllllyloooooongsecretttttcodeeeeeeforrrrbot"
|
||||
|
@ -39,31 +65,25 @@ matrix:
|
|||
meshtastic:
|
||||
connection_type: serial # Choose either "network" or "serial"
|
||||
serial_port: /dev/ttyUSB0 # Only used when connection is "serial"
|
||||
host: "meshtastic.local" # Only used when connection is "network"
|
||||
channel: 0
|
||||
meshnet_name: "Your Meshnet Name" # This is displayed in full on Matrix, but is truncated when sent to a Meshnet
|
||||
host: "meshtastic.local" # Only used when connection is "network"
|
||||
channel: 0 # Channel ID of the Meshtastic Channel you want to relay
|
||||
meshnet_name: "Your Meshnet Name" # This is displayed in full on Matrix, but is truncated when sent to a remote Meshnet
|
||||
display_meshnet_name: true
|
||||
|
||||
logging:
|
||||
level: "debug"
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
After activating the virtualenv:
|
||||
|
||||
## Usage
|
||||
Activate the virtual environment:
|
||||
```
|
||||
source .pyenv/bin/activate
|
||||
```
|
||||
|
||||
Run the following on the command-line:
|
||||
|
||||
Run the `main.py` script:
|
||||
```
|
||||
python main.py
|
||||
```
|
||||
|
||||
For example,
|
||||
|
||||
Example output:
|
||||
```
|
||||
$ python main.py
|
||||
INFO:meshtastic.matrix.relay:Starting Meshtastic <==> Matrix Relay...
|
||||
|
@ -71,4 +91,9 @@ 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:Sending radio message from Alice to radio broadcast
|
||||
INFO:meshtastic.matrix.relay:Processing inbound radio message from !613501e4
|
||||
INFO:meshtastic.matrix.relay:Processing matrix message from @bob:matrix.org: Hi Alice!
|
||||
INFO:meshtastic.matrix.relay:Sending radio message from Alice to radio broadcast
|
||||
INFO:meshtastic.matrix.relay:Processing inbound radio message from !613501e4
|
||||
```
|
||||
|
|
Ładowanie…
Reference in New Issue