I'm following the guide to install ha-bridge for an IR control project found here: https://github.com/bwssytems/ha-bridge
I have created the habridge directory in the /home/pi folder and when I change to the directory /home/pi/habridge I have to make sure to add sudo first
sudo java -jar ha-bridge-4.3.1.jar
and then it will launch as expected and I configured my device.
I then proceeded to the directions for doing System Control Setup so it will automatically start on the Pi Zero W on boot. I copied and pasted all commands and followed the instructions as far as I can tell, and the service starts, but the database is not loaded. The Syslog information shows
[main] WARN com.bwssystems.HABridge.dao.DeviceRepository - Error reading the file: data/device.db - Does not exist or is not readable. continuing...
If I stop the service and manually start it again while in the habrige directory, then the device is there.
If I stop the manually launched instance, and change directory to another folder, such as /root and run
sudo java -jar /home/pi/habridge/ha-bridge-4.3.1.jar
it will begin to launch, but has the same warning about an error reading the file: data/device.db
I adding
WorkingDirectory=/home/pi/habridge
to the .service file, restarted the daemon and then when I started the service, the database could be loaded.
I'm not sure if this is new to the Pi Zero W or to the latest build of Raspbian, but I believe adding the WorkingDirectory parameter will allow it to run as expected on these types of devices unless I messed something else up that caused this to be required.
I'm not a pi guy but do know your ha-Bridge file should be renamed to ha-bridge.jar
@MallocArray That was the correct way. When starting from SystemCtl, the directory is now relative to the root user and not the pi user, that is why it did not find your original data directory. By adding the WorkignDirectory, you put that in the proper place. looks like I need to update the directions. Thanks!
Updated the docs already
Most helpful comment
@MallocArray That was the correct way. When starting from SystemCtl, the directory is now relative to the root user and not the pi user, that is why it did not find your original data directory. By adding the WorkignDirectory, you put that in the proper place. looks like I need to update the directions. Thanks!