Entrance door opener with homebridge integration

Project No. 3: The entrance door opener

In our entrance door are 5 actuators integrated. Since 5 Years without any function. After a quick talk with the electrician was it fix, a Raspberry Pi + HomeBridge + PiFace are the needed tools.

List of Hardware:

  • Raspberry pi 3
  • cap rail USB Adapter for the Raspberri pi
  • Transformer SIEMENS LOGO!POWER 24 V/1,3 A

The whole Installation is in the cutout box. There is the cable of the entrance door and the transformation can be powered, as well as the Raspberry Pi with the relay.

First of all the Raspi with the relay and the wiringpi has to be installed. Then the Script for the ventilation system has to be modified. To open the entrance a 1 second impulse is needed.

The steuerung.sh script:

# Script to open the entrance with Homekit / HomeBridg.
# The pipe interprets the commands.
# CASE 4 = open the door
# CASE 0 = waiting 

rm -rf /root/steuerung/steuer_pipe
mknod /root/steuerung/steuer_pipe p
chmod 666 /root/steuerung/steuer_pipe
while true
# Waiting for a command
STUFE=($(cat /root/steuerung/steuer_pipe ))

case "$STUFE" in
4) gpio -p write 200 0
gpio -p write 201 0
gpio -p write 202 0
gpio -p write 203 0
gpio -p write 203 1
sleep 1
gpio -p write 203 0;;
0) echo "AUS!!!"
gpio -p write 200 0
gpio -p write 201 0
gpio -p write 202 0
gpio -p write 203 0;;

For the entrance opener is only one port reserved. The other 3 ports are for the raffstor. My next project.

This is the autostart.sh script:

# autostart script for the listening pipe 


ps ax | grep -i 'steuerung.sh' | grep -v 'grep'  ||  /root/steuerung/steuerung.sh > $HOMEPATH/steuerung.log &

After that, the start script has to be inserted in the /etc/crontab.

0  *    * * *   pi      sudo /root/steuerung/autostart.sh & > /dev/null 2>&1

The HomeKit integration take place in the HomeBridge with these parameters in the config.json:

       "name" : "Entrance",
       "on_cmd": "echo 4 > /root/steuerung/steuer_pipe &",
       "off_cmd": "echo   > /root/steuerung/steuer_pipe",
       "state_cmd": "cat /nas/data/raffstore.txt | grep -i 4",
       "polling": true,
       "interval": 2



Leave a Reply

Your email address will not be published. Required fields are marked *