Startpoint
After I integrated the entrance in my smart home / Siri, I decided to do it with the persiennes as well! The reason was simple, only one port of the PiFace relay has been used, three were unused.
I disassembled the remote control of the persiennes and I saw 4 simple switches. The up-and-down switch could be switched by a relay. And so I kept my soldering iron and I soldered two little cables at each end to the simple switch. The important aspect was, that the remote control got not destroyed. The simple switches are still usable without the relay.
Here starts the tutorial for the automation of the persiennes. The preparation of the project is described in the project “entrance”.
Preparation / List of needed things:
Raspberry Pi
Piface Relay+
soldering iron
6 Cables
At first you need am extension of the scripts that you have created for the entrance automation. 3 additional functions are needed. That’s way I decided to upgrade the listener script of the ventilation system. To do that, the config.json has to be modified. You find it here: /home/pi/.homebridge/config.json :
"platforms": [{ "platform": "cmdSwitch2", "name": "CMD Switch", "switches": [{ "name" : "persienne up", "on_cmd": "echo 1 > /root/steuerung/steuer_pipe", "off_cmd": "echo 3 > /root/steuerung/steuer_pipe", "state_cmd": "cat /nas/data/raffstore.txt | grep -i 1", "polling": true, "interval": 2 },{ "name" : "persienne down", "on_cmd": "echo 2 > /root/steuerung/steuer_pipe", "off_cmd": "echo 3 > /root/steuerung/steuer_pipe", "state_cmd": "cat /nas/data/raffstore.txt | grep -i 2", "polling": true, "interval": 2 },{ "name" : "Raffstore stop", "on_cmd": "echo 3 > /root/steuerung/steuer_pipe", "off_cmd": "echo > /root/steuerung/steuer_pipe", "state_cmd": "cat /nas/data/raffstore.txt | grep -i 0", "polling": true, "interval": 2 }] }] }
All other configurations are not edited! You can see in the script, that I switch the relay without an additional script out of the config,json. This is a simple trick and had no impact on the stability. I had an uptime of one year without any crash!
The steuerung.sh has to be upgraded:
#!/bin/bash # Skript welches den Raffstore über Homekit / HomeBridge steuert. # Die Befehle werden über eine pipe aufegenommen. # Folgende Befehle sind für den Raffstore geplant: # hoch / runter / stop # CASE 1 = up # CASE 2 = down # CASE 3 = stop # CASE 4 = open the entrance HOMEPATH=/root/steuerung rm -rf /root/steuerung/steuer_pipe mknod /root/steuerung/steuer_pipe p chmod 666 /root/steuerung/steuer_pipe while true do # Wartet auf Daten aus der Pipe STUFE=($(cat /root/steuerung/steuer_pipe )) case "$STUFE" in 1) gpio -p write 200 0 gpio -p write 201 0 gpio -p write 202 0 gpio -p write 203 0 gpio -p write 200 1 sleep 0.5 gpio -p write 200 0 echo 1 > /nas/data/raffstore.txt;; 2) gpio -p write 200 0 gpio -p write 201 0 gpio -p write 202 0 gpio -p write 203 0 gpio -p write 201 1 sleep 0.5 gpio -p write 201 0 echo 2 > /nas/data/raffstore.txt;; 3) gpio -p write 200 0 gpio -p write 201 0 gpio -p write 202 0 gpio -p write 203 0 gpio -p write 202 1 sleep 0.5 gpio -p write 202 0 echo 3 > /nas/data/raffstore.txt;; 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;; esac done
As next the start script has to be modified. You find it in /etc/crontab . That is it!
0 * * * * pi sudo /root/steuerung/autostart.sh & > /dev/null 2>&1
Fotos
Disassembled remote control with the soldered cables at the switches:
Please note: Only electricians should do that installation job!