RPi-TELEBOT/README.md

51 lines
1.6 KiB
Markdown
Raw Normal View History

2020-06-28 11:45:44 +02:00
# RPi-TELEBOT
2020-06-28 11:55:27 +02:00
Python based Telegram bot to monitor and control the raspberry pi.
2020-06-28 13:18:48 +02:00
## Setting up the bot
2020-06-28 13:15:55 +02:00
- Install telepot library for enabling the Raspberry Pi to communicate with the Telegram bot using the API.
```
sudo apt-get install python-pip
sudo pip install telepot
```
- Request the BotFather to create a new Bot.
2020-06-30 12:19:44 +02:00
- Paste the HTTP access token here (in the code):
2020-06-28 13:15:55 +02:00
```
bot = telepot.Bot(' Enter your Telegram bot API token here ')
```
2020-06-28 13:30:48 +02:00
- Run *gpiotel20.py* as sudo
- Try out the commands given below in the Telegram bot chat (see Usage section below)
2020-06-29 13:46:28 +02:00
- GPIO of led1 and led2 set as 5 and 10 respectively(BCM numbering).
2020-06-28 11:55:27 +02:00
## Commands:
2020-06-28 13:15:55 +02:00
- help - List of commands
2020-06-28 11:55:27 +02:00
- ledon1 - Switch on LED 1
- ledoff1 - Switch off LED 1
- ledon2 - Switch on LED 2
- ledoff2 - Switch off LED 2
2020-06-28 13:30:48 +02:00
- cpu - Get CPU info (lscpu)
- usb - See connected USB devices (lsusb)
2020-06-28 11:55:27 +02:00
- hi - To check if online
- time - Returns time
- date - Returns date
- temp - CPU Temperature
2020-06-28 13:30:48 +02:00
- repoupdate - update repositories (sudo apt-get update)
- upgrade - upgrade packages (sudo apt-get upgrade -y)
- shutdown - Shutdown RPi (sudo shutdown -h now)
- reboot - Reboot RPi (sudo reboot)
2020-06-28 12:01:45 +02:00
2020-06-29 13:41:06 +02:00
## Usage:
2020-06-28 13:30:48 +02:00
- Use ' / ' before each command
2020-06-29 13:41:06 +02:00
- Example: To check the CPU Temperature;
2020-06-28 12:01:45 +02:00
```
/temp
```
2020-06-30 12:09:30 +02:00
## Tips:
2020-06-30 12:10:30 +02:00
- See more about telegram bots here: https://core.telegram.org/bots
- As the /repoupdate and /upgrade takes time you can use /ledon1 or /ledon2 command to alert you when the process is complete.
2020-06-30 12:55:15 +02:00
## Screenshots:
![Screenshot1](https://github.com/RNA3210d/RPi-TELEBOT/blob/master/snip1.png)
![Commands list](https://github.com/RNA3210d/RPi-TELEBOT/blob/master/scrn1.jpg)