Introduction: Use of Motion Sensor With RaspberryPi and Telegram Bot
Hi guys.
In this post we are going to be using Raspberry Pi Telegram Bot with PIR(motion) sensor.
Step 1: Connect PIR
I had a PIR sensor before and I wanted to use my PIR sensor with Raspberry Pi. I followed a guide here is the link : https://www.raspberrypi.org/learning/parent-detector/worksheet/"
Step 2: How to Create a Telegram Bot
Click this link for “How to create a Telegram Bot”
Creating a new bot
Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authorization token for your new bot. The name of your bot is displayed in contact details and elsewhere. The Username is a short name, to be used in mentions and telegram.me links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot's username must end in ‘bot’, e.g. ‘tetris_bot’ or ‘TetrisBot’.
The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API.
Generating an authorization token If your existing token is compromised or you lost it for some reason, use the /token command to generate a new one.
Step 3: Bot and Raspberry Pi
Raspberry Pi connect ssh
git clone https://github.com/yakutozcan/RaspberryPiTelegram...
cd RaspberryPiTelegramPIR/
nano PIRBot.py
CTRL+X and save exit nano
sudo python PIRBot.py
Github Link: https://github.com/yakutozcan/RaspberryPiTelegram...
Original post: https://yakutozcan.blogspot.com.tr/2016/11/raspberrypi-telegram-botu-hareket-sensoru.html