Skip to content

Commit 70e2af8

Browse files
committed
update README
1 parent f71e872 commit 70e2af8

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

README

+35-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,42 @@
1-
prerequisites
2-
-------------
1+
Lightmeter
2+
==========
3+
4+
This is a set of scripts to read out an SQM lightmeter, store it in a Postgres database table,
5+
and send it to the verlustdernacht.aip.de webservice.
6+
7+
8+
Setup on CentOS7
9+
----------------
10+
11+
Install Postgres:
12+
13+
```
14+
yum install postgresql postgresql-devel postgresql-server postgresql-contrib python-psycopg2
15+
postgresql-setup initdb
16+
createuser
17+
```
18+
19+
as postgres user:
320

421
```
5-
apt-get install libdatetime-perl libdatetime-event-sunrise-perl libdbd-pg-perl
22+
createuser lightmeter # or a different user
23+
createdb lightmeter -O lightmeter
624
```
725

26+
Create `settings.py` file including:
27+
828
```
9-
cpan install Astro::Time.pm
29+
SQM_IP = '' # IP address of the lightmeter
30+
SQM_PORT = 10001 # TCP port of the lightmeter
31+
32+
INTERVALL = 2 # read-out intevall in seconds
33+
34+
DB_NAME = 'lightmeter' # local database
35+
DB_TABLE = 'sqm_babelsberg' # local database table
36+
37+
API_URL= '' # url of the webservice (ending on /api/measurements/)
38+
API_USER = '' # authentication username
39+
API_PASS = '' # authentication password
40+
API_LOCATION = '' # location slug of this lightmeter in the web service
1041
```
1142

12-
-db -readings 0 -interval 2 -sun -config $sqm_dir/sqm_robo.conf -ana

send_sqm_data.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from datetime import datetime
88

9-
from settings import DB_NAME, DB_TABLE, LOCATION, API_URL, API_USER, API_PASS
9+
from settings import DB_NAME, DB_TABLE, API_URL, API_USER, API_PASS, API_LOCATION
1010

1111

1212
def serializer(obj):
@@ -40,7 +40,7 @@ def serializer(obj):
4040

4141
data = json.loads(json.dumps({
4242
'count': len(rows),
43-
'location': LOCATION,
43+
'location': API_LOCATION,
4444
'rows': rows
4545
}, default=serializer))
4646

0 commit comments

Comments
 (0)