Raspberry - Homebridge und Homematic
zuletzt getestet Feb. 2020
Quellen:
- https://github.com/nfarina/homebridge
- https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi
- https://www.npmjs.com/package/homebridge-homematic
install Node.js
# sudo su
# curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs gcc g++ make python
# node -v
v12.15.0
install Homebridge
# npm install -g --unsafe-perm homebridge
https://github.com/oznu/homebridge-config-ui-x
# npm install -g --unsafe-perm homebridge-config-ui-x
config
# useradd -m --system -G video homebridge
# echo 'homebridge ALL=(ALL) NOPASSWD: ALL' | sudo EDITOR='tee -a' visudo
homebridge ALL=(ALL) NOPASSWD: ALL
# mkdir -p /var/lib/homebridge
# cat >/var/lib/homebridge/config.json <<EOL
{
"bridge": {
"name": "Homebridge",
"username": "CB:22:3D:E2:CE:31",
"port": 51826,
"pin": "033-44-254"
},
"accessories": [],
"platforms": [
{
"name": "Config",
"port": 8080,
"auth": "form",
"restart": "sudo -n systemctl restart homebridge",
"sudo": true,
"log": {
"method": "systemd"
},
"platform": "config"
}
]
}
EOL
# cat >/etc/systemd/system/homebridge.service <<EOL
[Unit]
Description=Homebridge
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=$(which homebridge) \$HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=3
KillMode=process
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_CHOWN CAP_FOWNER CAP_DAC_OVERRIDE CAP_AUDIT_WRITE CAP_SYS_ADMIN
AmbientCapabilities=CAP_NET_RAW
[Install]
WantedBy=multi-user.target
EOL
# cat >/etc/default/homebridge <<EOL
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge -I
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
# To enable web terminals via homebridge-config-ui-x uncomment the following line
# HOMEBRIDGE_CONFIG_UI_TERMINAL=1
EOL
# chown -R homebridge: /var/lib/homebridge
# systemctl daemon-reload && systemctl enable homebridge && systemctl start homebridge