ilcato / homebridge-Fibaro-HC2

Homebridge plugin for Fibaro Home Center 2 (and Home Center Lite ...)
Apache License 2.0
66 stars 27 forks source link

Unable to Autostart with Raspberry pi #104

Closed brendanlim1995 closed 6 years ago

brendanlim1995 commented 6 years ago

Error message when autostart the Homebridge program as below.

[2018-6-15 13:26:18] [FibaroHC2] didFinishLaunching. [2018-6-15 13:26:18] Homebridge is running on port 51824. [2018-6-15 13:26:19] [FibaroHC2] Error getting data from Home Center: { Error: connect ENETUNREACH 192.168.1.116:80 - Local (0.0.0.0:0) at Object.exports._errnoException (util.js:1022:11) at exports._exceptionWithHostPort (util.js:1045:20) at internalConnect (net.js:934:16) at net.js:1029:9 at _combinedTickCallback (internal/process/next_tick.js:95:7) at process._tickCallback (internal/process/next_tick.js:161:9) code: 'ENETUNREACH', errno: 'ENETUNREACH', syscall: 'connect', address: '192.168.1.116', port: 80 } (node:798) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Startup error: get scenes or devices (node:798) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I am using crontab -e to Autostart the home bridge program, as the .sh doc as below

#!/bin/sh # launcher.sh # navigate to home directory, then to this directory, then execute python script, then back home sudo systemctl restart systemd-resolved sudo systemctl restart homebridge sudo killall homebridge sudo python open_homebridge.py

As in the py script:

import os os.system("sudo homebridge")

But I can successfully run the homebridge from the terminal. As the wpa_supplicant file looks like:

country=TW ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="Network" psk="Passwork" id_str="AP1" }

For the /etc/network/interface, with AP opened

auto lo auto ap0 auto wlan0 iface lo inet loopback allow-hotplug ap0 iface ap0 inet static address 192.168.10.1 netmask 255.255.255.0 hostapd /etc/hostapd/hostapd.conf allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface AP1 inet dhcp

Why did the Error happened, it sometimes will appear theENETUNREACH error message. Is there any way to fix this problems? Thanks Guys.

ilcato commented 6 years ago

Use one of the solution described here in order to autostart homebridge.

ilcato commented 6 years ago

@brendanlim1995, any news?

brendanlim1995 commented 6 years ago

@ilcato Thanks, quite busy for the last few days. Juz follow the step you gave, it works perfectly. Thanks again!

brendanlim1995 commented 6 years ago

Sorry to say that, the homebridge which autostart successfully yesterday is having a problem again.

screen shot 2018-06-20 at 5 56 30 pm

After I delete the paired homebridge on my iPhone and reboot the RPi, I can find the homebridge in my home kit (in iPhone), but it can't be paired again.

What happened to my homebridge again, can someone help me? By the way, the config.json file didn't change at all.

The config.json file looks like below.

screen shot 2018-06-20 at 6 00 36 pm

The error comes in my iPhone as below.

img_45e77c919f95-1

Thanks!

ilcato commented 6 years ago

delete the accessories folder and the persist folder. change a number in the username field in the bridge section. restart

brendanlim1995 commented 6 years ago

@ilcato Why will this happen? Does it need to redo the same steps every time after I deleted the homebridge in my iPhone?

By the way, thanks!

ilcato commented 6 years ago

@brendanlim1995, not necessarily, I never reset the platform in more than 12 month even while using it as a test environment. Sometimes homebridge and or plugins corrupt something internally. Does it work now?

brendanlim1995 commented 6 years ago

@ilcato Yes, it works perfectly right now. I can control my accessories on Fibaro with my iPhone again. Thanks!

brendanlim1995 commented 6 years ago

Hi, @ilcato the problems came back again, the same problem but I have tried the solution that you gave me about a week ago. I had changed the Username in homebridge and the port. But it just looked the same.

Any help?

screen shot 2018-06-26 at 8 54 56 pm
ilcato commented 6 years ago

ENETUNREACH means that you are not able to reach the destination address. Does the error happen on startup?

brendanlim1995 commented 6 years ago

Yup, just happened when I using startup.

ilcato commented 6 years ago

So that means that homebridge starts before the networking subsystem is ready. Try another autostart option that you find in the wiki.

brendanlim1995 commented 6 years ago

Okay, I will try it later. Thanks a lot

brendanlim1995 commented 6 years ago

@ilcato I have successfully autostarted the homebridge by using systemctl's pause. Thanks!