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

Explain how to automatically start keyble-mqtt on boot #3

Open
oyooyo opened this issue Dec 31, 2020 · 1 comment
Open

Explain how to automatically start keyble-mqtt on boot #3

oyooyo opened this issue Dec 31, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@oyooyo
Copy link
Owner

oyooyo commented Dec 31, 2020

As suggested by @mccoy88f, the documentation should contain a section that explains how to automatically start keyble-mqtt on boot.

@oyooyo oyooyo added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 31, 2020
@R3ITOSv87
Copy link

Running keyble-mqtt as a Service

To run keyble-mqtt as a service on your Raspberry Pi and ensure it starts automatically on system startup, we can create a systemd service file.

Create a new file named keyble-mqtt.service in the directory /etc/systemd/system/ with:

sudo nano /etc/systemd/system/keyble-mqtt.service

and insert the following content:

[Unit]
Description=keyble-mqtt
After=network.target

[Service]
ExecStart=/usr/bin/node /usr/lib/node_modules/keyble-mqtt/keyble-mqtt.js 01:23:45:67:89:ab 1 ca78ad9b96131414359e5e7cecfd7f9e --host 127.0.0.1
WorkingDirectory=/usr/lib/node_modules/keyble-mqtt
Restart=always

[Install]
WantedBy=multi-user.target

Make sure to replace the MAC address of the smart lock (01:23:45:67:89:ab) and the user data (1 and ca78ad9b96131414359e5e7cecfd7f9e) in the ExecStart line.

Save the file and execute the following commands to enable and start the service:

sudo systemctl enable keyble-mqtt.service
sudo systemctl start keyble-mqtt.service

keyble-mqtt will now run as a service and automatically start on system startup. To ensure that the service started correctly, you can use the following command:

sudo systemctl status keyble-mqtt.service

https://github.com/Strange-Panda/keyble-ha-setup#running-keyble-mqtt-as-a-service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants