Python based Telegram bot to monitor and control the Raspberry Pi
Go to file
Naveen A.B 4b39411f51
Update README.md
2022-08-05 23:09:24 +05:30
LICENSE.txt Create LICENSE.txt 2020-06-29 23:38:17 +05:30
README.md Update README.md 2022-08-05 23:09:24 +05:30
gpiotel20.py Update gpiotel20.py 2020-06-29 17:14:10 +05:30
scrn1.jpg Add files via upload 2020-06-30 16:16:45 +05:30
snip1.png Add files via upload 2020-06-30 16:18:58 +05:30

README.md

RPi-TELEBOT

Python based Telegram bot to monitor and control the headless raspberry pi servers.

Setting up the bot

  • 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.
  • Paste the HTTP access token here (in the code):
    bot = telepot.Bot('  Enter your Telegram bot API token here  ')
    
  • Run gpiotel20.py as sudo
  • Try out the commands given below in the Telegram bot chat (see Usage section below)
  • GPIO of led1 and led2 set as 5 and 10 respectively(BCM numbering).

Commands:

  • help - List of commands
  • ledon1 - Switch on LED 1
  • ledoff1 - Switch off LED 1
  • ledon2 - Switch on LED 2
  • ledoff2 - Switch off LED 2
  • cpu - Get CPU info (lscpu)
  • usb - See connected USB devices (lsusb)
  • hi - To check if online
  • time - Returns time
  • date - Returns date
  • temp - CPU Temperature
  • 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)

Usage:

  • Use ' / ' before each command
  • Example: To check the CPU Temperature;
/temp

Tips:

Screenshots:

Screenshot1 Commands list