While ring at front door receive photo message and open the door via telegram one-time password
It works but dev is still in progress also see todos list
- Front-door intercom automation
One Raspberry Pi is connected to a BTIcino front-door intercom.
It detects when the door bell rings.
Requests either from a Raspberry PI (Zero) with Camera a photo
or from a Blink Cam (depends on defined configuration in config.yaml).
Sends a door bell ring photo notification via telegram message to a privat
group and attachs the photo.
The house owner can respond with a time-based one time password in the
privat chat to open the door.
Starting point was an article Γberallkingel at heise.de.
At beginning i startet it with RPi's (one as a Cam and one connected to BTIcino house intercom).
Later i decided to have infra red cam for night vison and i got during an amazon black week sale a cheap blink cam. That's why i support my own small Flask API - PiCam API Project as well the Blink Cams in general.
This Project consists of
- one Raspberry Pi B+ which runs this project files
either use one of these camera or both
- one Paspberry Pi Zero with Camera see git project https://github.com/OliverDrechsler/PiCam_API
- one Blink Camera
The main Raspberry Pi is connected via wire to the BTIcino front-door intercom.
When the front door rings, the RPi detects it and starts
to take a photo (depends on config file) either from PiCam API or from a Blink Cam.
Then the RPi sends a telegram message about the door ringing to a privat chat.
Also it sends in a second step the photo to the telegram privat group.
The RPi runs a telegram bot. You can now respond with a one time password
message to open the door.
The bot is only reacting on defined (see config file) privat chat group as well
on known defined chat person id's!
The bot reacts on following received commands:
- opening the door
- taking a snapshot/photo
- adding blink cam 2 factor authentication code
The totp (time-based one time password) is compatible to each public available TOTP provider.
It also support sha1(not recommended), sha256 (sha2) and sha512 (sha3).
I recommend to use sha512.
In future there will be an additional AES encrytption added.
The telegram bot has a command feature, where you can send the new 2FA token to system. In case of first time login or renew/relogin required.
-
door bell detection board:
- Strip grid circuit board of Epoxy β 100 x 100 mit 2,54mm
- Optocoupler (PC817)
- to get correct voltage of 1,2V for Optocoupler, a resistor of 330 Ohm (8 Volt), 560 Ohm (12 Volt) or 1,2 Kiloohm (24 Volt)
- Raspberry Pi Hutschienen-Netzteil (Mean Well MDR-20-15) fΓΌr den Einbau in den Sicherungskasten
-
door opener board with relais:
- saintsmart 2 channel 5V
- Raspberry Pi B+ with both circuits connected
- Raspberry Pi Zero with camera
t.b.d.
to describe
BTICino wiring diagram
to describe
saintsmart 2-Channel 5V Relay Module
shop where to buy saintsmart relay
Jumper and wiring layout wiring layout at stackexchange
t.b.d.
β
βββ camera # Camera's package folder
βΒ Β βββ __init__.py
βΒ Β βββ blink_cam.py # Amazon's Blink Camera modules
βΒ Β βββ cam_common.py # a common module and to decide which cam gets used
βΒ Β βββ picam.py # a module to access my PiCam API Project vi REST-API
βββ common # Common package folder for configuration modules
βΒ Β βββ __init__.py
βΒ Β βββ config_util.py # Common config module / class
βββ docs # Github Pages sphinx docu better read here https://oliverdrechsler.github.io/front_door_intercom_automation/
βββ door # door package folder
βΒ Β βββ __init__.py
βΒ Β βββ bell.py # bell monitoring module
βΒ Β βββ opener.py # door opening module
βββ fdia.py # Main Script / Program
βββ fdia.service # sample systemd service config file
βββ get_otp_token.py # OLD: generate a totp password with otp lib and sha1
βββ messaging # telegram package folder
βΒ Β βββ __init__.py
βΒ Β βββ otp.py # verify totp password module
βΒ Β βββ receive_msg.py # telegram bot module to receive messages
βΒ Β βββ send_msg.py # telegram send message module
βββ LICENSE # Software LICENSE
βββ requirements_licenses.txt # used libraries licenes
βββ README.md # This readme file
βββ blink_config.json # Blink Camera config file. If not exist it be will created.
βββ config.yaml # main config file if not found it will use config_template.yaml
βββ config_template.yaml # a config template file to build your on config file
βββ telegram_bot_setup.md # quick guid to setup a telegram bot
βββ requirements.txt # required python libraries to install
config_template.yaml is a template config file and must be adjusted to your needs. Copy config_template.yaml to config.yaml into project root folder
t.b.d. Also see inside config_template.yaml
t.b.d.
FDIA needs root permission to access GPIO Pin. If this is not wanted you have to adjust right to:
- /dev/gpiomem
- /sys/class/gpio... but its you consult google for it...
Python 3, pip3 and git cli is required.
Clone repo to your RPi.
git clone [email protected]:OliverDrechsler/front_door_intercom_automation.git
now run pip3 to install python requirments
pip3 install requirements.txt
Adjust file fdia.service
to your path.
To run fdia as a service on startup with root permissions
copy fdia.service
to /etc/systemd/system/
to your RPi systemd deamon folder.
Run systemctl daemon-reload
and systemctl start fdia
to start it as a service
t.b.d.
python3 -m pytest
t.b.d.
t.b.d.
t.b.d.
- write full documentation
- added aes encryption to send otp password with aes encrypt additionally
- add precommit checks (lint,bandit and pytest)
- add setup.py install script
- add fdia.py command line args to generate config and set new password
- pictures how i build the hardware
- pictures and docu how i mounted RPi Zero with Cam
- pictures and docu how i mounted blink cam
- pictures and docu how mounted the RPi close to BTIcino frond-door intercom in the control cabinet
- pictures door bell photo notification
- picture door bell open message
other repo ToDo's
-
PiCam API had some ToDo's https://github.com/OliverDrechsler/PiCam_API
-
develop an iPhone and an Apple Watch App to:
- open door through one button via
telegram message with AES + totp code encryption - geofencing feature for asking to open the door
- open door through one button via