Initial code
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
708f9faead
commit
53758081d8
14 changed files with 9071 additions and 0 deletions
22
debian/README.md
vendored
Normal file
22
debian/README.md
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Installation on Debian
|
||||
|
||||
Install the following packages:
|
||||
- python3-serial
|
||||
- python3-paho-mqtt
|
||||
|
||||
Then git clone this repository to **/opt/arduino-sensors-toolkit**.
|
||||
|
||||
Create the *serial2mqtt* system user and add it to the *dialout* group to read the serial interface:
|
||||
```
|
||||
# adduser --system --disabled-password --disabled-login --home /var/lib/serial2mqtt \
|
||||
--no-create-home --quiet --force-badname --group serial2mqtt
|
||||
# usermod -a -G dialout serial2mqtt
|
||||
```
|
||||
|
||||
Copy the [serial2mqtt.service](serial2mqtt.service) file to **/etc/systemd/system/serial2mqtt.service**.
|
||||
|
||||
Copy the [serial2mqtt.default](serial2mqtt.default) file to **/etc/default/serial2mqtt**.
|
||||
|
||||
Reload systemd configuration with `systemctl daemon-reload`.
|
||||
|
||||
Enable service with `systemctl enable serial2mqtt.service`.
|
2
debian/serial2mqtt.default
vendored
Normal file
2
debian/serial2mqtt.default
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Options passed as daemon argument
|
||||
#DAEMON_OPTS="-c /etc/serial2mqtt.ini -v"
|
16
debian/serial2mqtt.service
vendored
Normal file
16
debian/serial2mqtt.service
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Read serial port and send sensors measurements to MQTT broker
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=serial2mqtt
|
||||
Group=serial2mqtt
|
||||
EnvironmentFile=-/etc/default/serial2mqtt
|
||||
ExecStart=/opt/arduino-sensors-toolkit/serial2mqtt.py $DAEMON_OPTS
|
||||
KillMode=process
|
||||
TimeoutSec=30
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue