Skip to content

Latest commit

 

History

History
129 lines (92 loc) · 4.07 KB

README.md

File metadata and controls

129 lines (92 loc) · 4.07 KB

Automatic Gate Opener rpy

If you are tired to spend a lot of money in automatic gate controller this project can help you!

Automatic Gate Opener rpy is a Raspberry Pi solution to control an automatic gate by a mobile phone using a broken automatic gate controller.

alt text

Requirements

Circuit Installation

take your broken automatic gate controller and try to close the circuit with a cable. When you found the correct pins weld to each of them a cable and after that follow the images in the build circuit folder

SW Installation

go in your raspberry pi and paste the following commands:

update the package lists for upgrades for packages that need upgrading

sudo apt-get update

fetch new versions of packages existing on the machine if APT knows about these new versions

sudo apt-get upgrade

install all necessary library

sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make libjansson-dev

copy the Command-line interface for Telegram in the directory where you want install it

git clone --recursive https://github.com/vysheng/tg.git 

go in the tg folder, configure all and enter into installation of de Telegram cli

cd tg
sudo ./configure
sudo make

enter into the guided installation

./bin/telegram-cli

now enter the mobile phone number with the prefix of your country, your name and surname of the people who are allowed to control the gate with the following command

add_contact [countryPrefix_phone_number] [name] [surname]
ex: add_contact 39xxxxxxxxx Alan Turing

at this point add the code prvided by BotFather into the array id_a and run the telegram_server.py using this command

python telegram_server.py

now chat with your bot using this command on your telegram app and the gate will start to opening

/toggle

note: if you are using an ssh connection you can keep alive the session using a tool like tmux

boot server at startup using systemd

move to systemd folder of your Raspberry

cd lib/systemd/system/

create your service

sudo nano automatic_gate.service

and paste in the new file the following lines

[Unit]
Description=Clown server for jessie
After=network.target

[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/Desktop/projects/automatic-gate-opener-rpy/telegram_server.py >>/home/pi/log.txt 2>&1
Restart=always
StartLimitIntervalSec=1min
StartLimitBurst=500

[Install]
WantedBy=multi-user.target



enable your service

sudo systemctl enable automatic_gate.service

control the status of your service

sudo systemctl status automatic_gate

Structure

Build with

  • telepot: Python framework for Telegram

Copyright © 2017 sdrabb