zewelor / bt-mqtt-gateway

A simple Python script which provides a Bluetooth to MQTT gateway, easily extensible via custom workers. See https://github.com/zewelor/bt-mqtt-gateway/wiki for more information.
MIT License
549 stars 116 forks source link

Systemd Installation like in README does not work, service.sh might have superfluous sudo #259

Open contradictioned opened 1 year ago

contradictioned commented 1 year ago

[*] I've read the Troubleshooting Wiki, my problem is not described there and I am already using the specified minimum bluez version.

Describe the bug

When trying to install as systemd service as instructed by the README, the service gets stuck at starting with ModuleNotFoundError: No module named 'yaml', similar to #250.

To Reproduce Steps to reproduce the behavior:

  1. Setup the gateway with virtualenv such that it starts using ./gateway.py
  2. Follow instructions for systemd service installation
  3. Observe journalctl -u bt-mqtt-gateway.service

Expected behavior Service should start.

Config (does not apply)

Debug gateway logs (does not apply)

Server (please complete the following information):

Additional context

I removed the sudo from the last line of service.sh such that it looks like:

#!/bin/sh
set -e
SCRIPT_DIR=$( cd "$( dirname "$0" )" >/dev/null 2>&1 && pwd )
VIRTUAL_ENV=$SCRIPT_DIR/.venv
if [ -d "$VIRTUAL_ENV" ]; then
    export VIRTUAL_ENV
    PATH="$VIRTUAL_ENV/bin:$PATH"
    export PATH
fi
cd "$SCRIPT_DIR"
python3 ./gateway.py "$@"

Then, it works.