Skip to content

Commit 3af1918

Browse files
authored
systemd, Adafruit_Python_DHT
Add systemd description and link to Adafruit_Python_DHT
1 parent 10749a1 commit 3af1918

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

README.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,27 @@ It consists out of three parts:
1313

1414
### Logger (python3)
1515

16-
This script does the actual recording of the temperature and humidity values.
16+
This script does the actual reading of the temperature and humidity values from the supported sensors.
1717
It will scan all 1wire slaves and extract the temperature from DS18B20 sensors (maybe other sensors will work as well).
1818
It will look for DHT22 sensors as well and retrieve temperature and humitidy values from them.
19-
It is able to log these values into a sqlite database or send them to the RESTful API.
19+
Depending on the configuration it is able to log these values into a sqlite database or send them to the RESTful API.
20+
21+
When sending to the RESTful API is not possible (e.g. in case of no network connection or API down) the records will be cached locally in a sqlite database and sent when API is reachable again.
22+
23+
24+
For accessing DHT22 sensors we are using [Adafruit_Python_DHT](https://github.com/adafruit/Adafruit_Python_DHT).
2025

2126
### RESTful API (nodejs)
2227

2328
@todo
2429

25-
Built with https://github.com/expressjs/express
30+
Built with [expressjs](https://github.com/expressjs/express)
2631

2732
### Frontend (HTML + javascript)
2833

2934
@todo
3035

31-
Built with https://github.com/jquery/jquery/ and https://github.com/plotly/plotly.js/
36+
Built with [jquery](https://github.com/jquery/jquery/) and [plotly.js](https://github.com/plotly/plotly.js/)
3237

3338

3439

@@ -46,9 +51,40 @@ Built with https://github.com/jquery/jquery/ and https://github.com/plotly/plotl
4651
9. @todo
4752

4853

49-
## API as service
54+
## API as systemd service
55+
56+
If you want the RESTful API run as a systemd service you can do the following:
57+
58+
```sudo nano /etc/systemd/system/sensorlog-api.service```
59+
60+
then insert the following:
61+
62+
```
63+
[Unit]
64+
Description=Sensorlog RESTful API
65+
66+
[Service]
67+
ExecStart=/usr/bin/node /home/$user/sensorlog/api/api.js
68+
User=$user
69+
TimeoutSec=30
70+
71+
[Install]
72+
WantedBy=multi-user.target
73+
```
74+
75+
replace $user with the username the service should run as.
76+
77+
After you saved the file you can enable and start the service with:
78+
79+
```
80+
sudo systemctl daemon-reload
81+
82+
sudo systemctl enable sensorlog-api
83+
84+
sudo systemctl start sensorlog-api
85+
86+
```
5087

51-
@todo systemd service file and starting
5288

5389
## Periodic logging of temperatures and humidities
5490

0 commit comments

Comments
 (0)