
This image is generated by Gemini
A private Telegram bot for monitoring your home LAN.
- A
Raspberry Pi2,4where this script will be deployed. Tested onRPi2
- Device Discovery: Scan LAN, detect devices
- Telegram Bot: Control via Telegram commands
- Device Tracking: Track devices by MAC address
sudo apt install nmap python3-venvgit clone https://github.com/yourusername/telepihomereconbot.git
cd telepihomereconbot
python3 -v -m venv .venv
source venv/bin/activate
pip install -r requirements.txtcp .env.example .env
nano .envAdd your settings:
TELEGRAM_BOT_TOKEN- Get from @BotFatherAUTHORIZED_USERS- Your Telegram user ID (get from @userinfobot)
python main.py --bot| Command | Description |
|---|---|
/scan |
Scan LAN for devices |
/list |
List tracked devices |
/status |
network status |
/help |
Show commands |
Create /etc/systemd/system/telepihomereconbot.service:
[Unit]
Description=TelePiHomeReconBot
After=network.target
[Service]
Type=simple
User=<user>
Group=<group>
WorkingDirectory=/home/<user>/telepihomereconbot
ExecStart=/home/<user>/telepihomereconbot/venv/bin/python main.py --bot
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetAdjust the path (/home/<user>/telepihomereconbot) if your installation directory is different.
sudo systemctl daemon-reloadsudo systemctl enable telepihomereconbotsudo systemctl start telepihomereconbotsudo systemctl status telepihomereconbotsudo journalctl -u telepihomereconbot -f| Action | Command |
|---|---|
| Start | sudo systemctl start telepihomereconbot |
| Stop | sudo systemctl stop telepihomereconbot |
| Restart | sudo systemctl restart telepihomereconbot |
| Enable (boot) | sudo systemctl enable telepihomereconbot |
| Disable (boot) | sudo systemctl disable telepihomereconbot |
| Status | sudo systemctl status telepihomereconbot |
| View logs | sudo journalctl -u telepihomereconbot -f |
telepihomereconbot/
├── .env # Secrets (see .env.example)
├── config/
│ └── config.json # Settings
├── src/
│ ├── bot.py # Telegram handlers
│ ├── scanner/ # Network scanning
│ └── storage/ # SQLite database
├── main.py # Entry point
└── requirements.txt
MIT