Apple HomeKit für Brennenstuhl Funksteckdosen

15 Jul 2017

Shopping List

HomeBridge

Install Dependencies

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git make tmux

gcc 4.9.2 should be installed:

> g++ -v
...
gcc version 4.9.2 (Raspbian 4.9.2-10) 

Add homebridge User

Setup HomeBridge with systemd using a homebridge user as described in the instructions. Make system user homebridge:

sudo useradd --system homebridge

Add homebridge user to GPIO group:

usermod -a -G gpio homebridge

Setup systemd

Download these two files and place homebridge under /etc/default and homebridge.service under /etc/systemd/system on your Raspberry Pi:

git clone https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/
cd 0ad0de1feb6adb9eb61a/
sudo cp homebridge /etc/default/
sudo cp homebridge.service /etc/systemd/system

Fixup the location of homebridge in homebridge.service. Set the value of ExecStart to the output of:

which homebridge

Homebbridge Preferences

Make files and folders:

cd /var/lib
sudo mkdir homebridge
sudo chown homebridge:root homebridge/
vim config.json
sudo chown homebridge:root config.json 

HomeBridge RC433 Plugin

Install the HomeBridge RC433 Plugin:

npm install --global homebridge-rc433-etekcity

wiringPi

Install WiringPi:

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

To upgrade at a later point:

git pull origin
./build

Test it:

gpio -v
gpio readall

Install the 433Mhz library:

git clone --recursive https://github.com/ninjablocks/433Utils.git
cd 433Utils/RPi_utils
make all

Homebridge Preferences

Example config.json file:

{
  "bridge": {
    "name": "Homebridge",
    "username": "CD:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
  },

  "description": "My Apartment",
  "accessories": [
    {
      "accessory": "RC433EtekcitySwitch",
      "name": "R14A",
      "id": "01",
      "pulse": "180",
      "on": "1328465",
      "off": "1328468"
    },
    {
      "accessory": "RC433EtekcitySwitch",
      "name": "R14B",
      "id": "01",
      "pulse": "180",
      "on": "1331537",
      "off": "1331540"
    }
  ]
}

The following table lists the values needed in the config file for on/off: (Can be read with receiver.)

Signal r:1 4 r: 23 5 r:none r:1 r: 2
A On 1328465 4261201 5588305 1394001 4539729
A Off 1328468 4261204 5588308 1394004
B On 1331537 4264273 5591377 1397073
B Off 1331540 4264276 5591380 1397076
C On 1332305 4265041 5592145 1397841
C Off 1332308 4265044 5592148
D On 1332497 4265233 5592337
D Off 1332500 4265236 5592340

Home.app

Controlling the devices should work now.