-
-
Save 350d/c774e68f2986f8cf95be85ca9e7c3fcc to your computer and use it in GitHub Desktop.
Full install + Systemd Service for Homebridge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"bridge": { | |
"name": "Homebridge", | |
"username": "{MAC}", | |
"port": 51826, | |
"pin": "{PIN}" | |
}, | |
"description": "This is an example configuration file. You can use this as a template for creating your own configuration file containing devices you actually own.", | |
"accessories": [], | |
"platforms": [ | |
{ | |
"platform" : "HomeBridgeControllerLink" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# If you uncomment the following line, homebridge will log more | |
# You can display this via systemd's journalctl: journalctl -f -u homebridge | |
# DEBUG=* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Node.js HomeKit Server | |
After=syslog.target network-online.target | |
[Service] | |
Type=simple | |
User=homebridge | |
EnvironmentFile=/etc/default/homebridge | |
# Adapt this to your specific setup (could be /usr/bin/homebridge) | |
# See comments below for more information | |
#ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS | |
#ExecStart=/opt/node/bin/homebridge $HOMEBRIDGE_OPTS | |
ExecStart=/opt/node/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS | |
Restart=on-failure | |
RestartSec=10 | |
KillMode=process | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get update -y | |
apt-get upgrade -y | |
apt-get install -y git make | |
#recommended method for Pi3: | |
#curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
#apt-get install -y nodejs | |
#Pi3 + Pi ZERO W experiment: | |
curl -sL https://gist.githubusercontent.com/350d/c774e68f2986f8cf95be85ca9e7c3fcc/raw/install_nodejs | sudo -E bash - | |
apt-get install -y libavahi-compat-libdnssd-dev | |
npm install -g --unsafe-perm homebridge | |
npm install -g homebridge-controllerlink | |
#install Homebridge service | |
curl -sL https://gist.githubusercontent.com/350d/c774e68f2986f8cf95be85ca9e7c3fcc/raw/homebridge_service_install | sudo -E bash - | |
journalctl -f -u homebridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
useradd -M --system homebridge | |
usermod -a -G video homebridge | |
mkdir /var/lib/homebridge | |
chmod 777 /var/lib/homebridge -R | |
wget https://gist.githubusercontent.com/350d/c774e68f2986f8cf95be85ca9e7c3fcc/raw/config.json -O /var/lib/homebridge/config.json -q | |
PIN=$((RANDOM%10))$((RANDOM%10))$((RANDOM%10))-$((1+RANDOM%9))$((1+RANDOM%9))-$((RANDOM%10))$((RANDOM%10))$((RANDOM%10)) | |
sed -i -- "s,{PIN},$(echo $PIN),g" /var/lib/homebridge/config.json | |
sed -i -- "s,{MAC},$(echo $(cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address) | awk '{print toupper($0)}'),g" /var/lib/homebridge/config.json | |
wget https://gist.githubusercontent.com/350d/c774e68f2986f8cf95be85ca9e7c3fcc/raw/homebridge -O /etc/default/homebridge -q | |
wget https://gist.githubusercontent.com/350d/c774e68f2986f8cf95be85ca9e7c3fcc/raw/homebridge.service -O /etc/systemd/system/homebridge.service -q | |
chmod 777 /var/lib/homebridge -R | |
systemctl daemon-reload | |
systemctl enable homebridge | |
systemctl start homebridge | |
echo "Your PIN: "$PIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PICHIP=$(uname -m) | |
#NODEVERSION="7.10.1" | |
#NODEVERSION="8.16.2" | |
NODEVERSION="14.13.1" | |
#NODE="$(curl -sL https://nodejs.org/dist/latest | grep $PICHIP'.tar.xz' | cut -d'"' -f2)" | |
#NODEFOLDER=$(echo $NODE | sed 's/.tar.xz//') | |
#wget https://nodejs.org/dist/latest/$NODE | |
NODEFOLDER=node-v$NODEVERSION-linux-$PICHIP | |
NODETARXZ=$NODEFOLDER.tar.xz | |
wget https://nodejs.org/dist/v$NODEVERSION/$NODETARXZ | |
tar xJvf $NODETARXZ | |
rm $NODETARXZ | |
rm -R -f /opt/node/ | |
rm /usr/bin/node /usr/sbin/node /sbin/node /sbin/node /usr/local/bin/node /usr/bin/npm /usr/sbin/npm /sbin/npm /usr/local/bin/npm 2> /dev/null; | |
mkdir -p /opt/node | |
mv $NODEFOLDER/* /opt/node/ | |
rm -R -f $NODEFOLDER | |
update-alternatives --install "/usr/bin/node" "node" "/opt/node/bin/node" 1 | |
update-alternatives --install "/usr/bin/npm" "npm" "/opt/node/bin/npm" 1 | |
@sassen did you manage to get homebridge up and running?
@350d I'm having the exact same issue, running on an Zero W with the latest raspbian-stretch-lite (2017-11-29).
I followed your Instructions above exactly and I am able to reproduce the issue every time.
I Would Really love, if you could help finding a solution 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@sassen I have Zero W here and everything works fine last time. I will check it with latest script later.