Closed vvsokolov closed 7 years ago
maybe the automatica startup is before the completion of the network setup? I do not use the systemctl stuff for automatica start.
root@homekit:~#cat /etc/systemd/system/homebridge.service [Unit] Description=Node.js HomeKit Server After=syslog.target network-online.target
[Service] Type=simple User=homebridge EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS Restart=on-failure RestartSec=10 KillMode=process
[Install] WantedBy=multi-user.target
I thought this is the best way to start the service automatically
When did it stop working?
After the last power-off
Could you please add abnormal service termination on this error ? In this case systemd will detect, that "Unit homebridge.service entered failed state" and will restart it in "RestartSec=" seconds
Yes. Reason is that Pi got ip-address after the home bridge start:
May 7 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] [FibaroHC2] Server Listening... May 7 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] Homebridge is running on port 51826. May 7 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] [FibaroHC2] Error getting data from Home Center: Error: connect ENETUNREACH 192.168.xx.x:80 - Local (0.0.0.0:0) undefined May 7 13:36:47 homekit dhcpcd[448]: eth0: leased 192.168.xx.x for 600 seconds May 7 13:36:47 homekit dhcpcd[448]: eth0: adding route to 192.168.xx.0/24 May 7 13:36:47 homekit dhcpcd[448]: eth0: adding default route via 192.168.xx.1
And after that the service simply "hangs", but the systemd "thinks" that everything is fine:
root@homekit:/var/log# systemctl status -l homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: active (running) since нд 2017-05-07 13:36:33 EEST; 12min ago Main PID: 509 (homebridge) CGroup: /system.slice/homebridge.service └─509 homebridge
тра 07 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] [FibaroHC2] Configuring Accessory: t° Коридор тра 07 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] [FibaroHC2] Configuring Accessory: Освещенность тра 07 13:36:45 homekit homebridge[509]: Scan this code with your HomeKit App on your iOS device to pair with Homebridge: тра 07 13:36:45 homekit homebridge[509]: Plugin - DidFinishLaunching тра 07 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] [FibaroHC2] Server Listening... тра 07 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] Homebridge is running on port 51826. тра 07 13:36:45 homekit homebridge[509]: [2017-05-07 13:36:45] [FibaroHC2] Error getting data from Home Center: Error: connect ENETUNREACH 192.168.xx.x:80 - Local (0.0.0.0:0) undefined
I found the decigion: in /etc/network/interfaces must be: auto eth0 iface eth0 inet dhcp
network-online.target is aware of the interface eth0 now
Otherwise, eth0 was not registered to the daemons as an active ethernet device, despite it being perfectly happy receiving an IP address via DHCP.
There is always an error "[FibaroHC2] Error getting data from Home Center: Error: connect ENETUNREACH 192.168.xxx.xxx:80 " after the normal reboot of RaspberryPi (#shutdown -r now) or abnormal power off-on. But if I manually restart the service (systemctl restart homebridge) - homebridge-fibaro-hc2 starts normally. What could be the reason ?