tommasomarchionni / homebridge-openHAB

Homebridge plugin for openHAB
Apache License 2.0
49 stars 18 forks source link

Automatic Connection to OpenHAB after Start #34

Open syoma755 opened 7 years ago

syoma755 commented 7 years ago

Currently when Homebridge-openhab starts it tries to connect to Openhab server only once. If Openhab is not running yet (typically at start), homebridge stops and service needs to be restarted manually. Other workaround is to start homebridge from openhab script, which is also not good. It would be good if Homebridge-openhab would try to connect to openhab continuously and automatically without requirement for user intervention.

digiltd commented 7 years ago

The solution in #30 works fine for myself and at least one other user :)

You can also set up some switches to fire off the restart commands and put them in a sitemap (I use a separate "admin" one for system related stuff)

Though 99% of the time restarting the service (#30) once openHAB has kicked in usually works fine.

Switch execStopHB    "Stop Homebridge"     { exec="ON:sudo systemctl stop homebridge", autoupdate="false" }
Switch execStartHB   "Start Homebridge"    { exec="ON:sudo systemctl start homebridge", autoupdate="false" }
Switch execRestartHB "Restart Homebridge"  { exec="ON:sudo systemctl restart homebridge", autoupdate="false" }