Connect your Meshtastic mesh network with Telegram group chats! 📡💬
- 🔌 Supports both serial and TCP connections to Meshtastic devices
- 🔄 Automatic reconnection to Meshtastic device
- 🚦 Message queuing and retry mechanism
- 🔔 Command to send bell notifications to Meshtastic nodes
- 📊 Real-time status updates for nodes (telemetry, position, routing, neighbors)
- 🗺️ Location sharing between Telegram and Meshtastic
- 🔐 User authorization for Telegram commands
- 📝 Optional logging to file and syslog
- Python 3.12+ 🐍
- Dependencies:
envyaml
: For YAML configuration file parsing with environment variable supportmeshtastic
: Python API for Meshtastic devicespython-telegram-bot
: Telegram Bot API wrapperpubsub
: For publish-subscribe messaging pattern
-
Clone the repo:
git clone https://github.com/gretel/meshgram.git cd meshgram
-
Set up a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure the project: Create a
config.yaml
file in theconfig
directory:telegram: bot_token: "your_bot_token_here" chat_id: -1001234567890 authorized_users: - 123456789 meshtastic: connection_type: "serial" # or "tcp" device: "/dev/ttyUSB0" # or "hostname:port" for TCP default_node_id: "!abcdef12" local_nodes: - "!abcdef12" - "!12345678" logging: level: "info" level_telegram: "warn" level_httpx: "warn" use_syslog: false syslog_host: "localhost" syslog_port: 514 syslog_protocol: "udp"
-
Run Meshgram:
python src/meshgram.py
/start
- Start the bot and see available commands/help
- Show help message/status
- Check the current status of Meshgram and Meshtastic/bell [node_id]
- Send a bell notification to a Meshtastic node/node [node_id]
- Get information about a specific node/user
- Get information about your Telegram user
We welcome contributions! 💖 Please open an issue or submit a pull request if you have any improvements or bug fixes.
Happy meshing! 🎉