Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service file #7

Open
geoffbon opened this issue Mar 11, 2021 · 1 comment
Open

Add service file #7

geoffbon opened this issue Mar 11, 2021 · 1 comment

Comments

@geoffbon
Copy link

Hi - I finally got this working as a service, using your hack_ble.sh file. I think it would be useful to add instructions to create a service file:

  1. Create new file /etc/systemd/system/ble_sensor_mqtt.service
  2. Paste in, adjusting the path to hack_ble.sh and the user name:
[Unit]
Description=BLE Sensor MQTT service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=on-abort
RestartSec=1
User=pi
ExecStart=/usr/bin/sudo /home/pi/govee/bluetooth-temperature-sensors/hack_ble.sh

[Install]
WantedBy=multi-user.target
  1. Edit the path in hack_ble.sh to match the source dir
  2. sudo chmod a+x ./hack_ble.sh
  3. sudo systemctl daemon-reload
  4. sudo systemctl start ble_sensor_mqtt
  5. sudo systemctl status ble_sensor_mqtt
  6. If everything looks good, sudo systemctl enable ble_sensor_mqtt
@Hassiopeia
Copy link

Hassiopeia commented Mar 14, 2021

I was just coming back to this repo to ask for advice on this. thank you! I was running the command with nohup, but every time I'd restart HA the sensor would lose connection to MQTT and fail. Does this service you figured out restart the process if it fails?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants