-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setup commands.txt
53 lines (37 loc) · 1.55 KB
/
Setup commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Setup incoming on localhost
cd /home/rob/Documents/simple-gateway
source .venv/bin/activate
Setup incoming data app:
gunicorn -w 4 -k uvicorn.workers.UvicornWorker grafana_duckdb_api:app --bind 0.0.0.0:8000
In Grafana;
http://localhost:8000/query?device_id=47&latitude=35.6617&unit=cpm
or http://localhost:8000/query?device_id=49&latitude=35.6617&unit=cpm&device_id=47
Test a curl:
curl -X POST http://localhost:8000/measurements?api_key=q1LKu7RQyxunnDW -H "Content-Type: application/json" -d '{"longitude":"139.7449","latitude":"35.6617","device_id":"49","value":"60","unit":"cpm","height":"111"}'
Fix locked duckdb database when DB is replaced.
CREATE TABLE measurements_temp AS SELECT * FROM measurements;
DROP TABLE measurements;
CREATE TABLE measurements AS
SELECT * FROM measurements_temp;
DROP TABLE measurements_temp;
curl -X POST "http://localhost:8000/measurements?api_key=q1LKu7RQyxunnDW" \
-H "Content-Type: application/json" \
-d '{
"bat_voltage": "3.7",
"dev_temp": "25",
"device": "2830364905",
"device_sn": "65000",
"device_urn": "urn:dev:12345",
"env_temp": "30",
"lnd_7128ec": "60",
"lnd_7318c": "",
"lnd_7318u": "20",
"loc_country": "US",
"loc_lat": "37.7749",
"loc_lon": "-122.4194",
"loc_name": "San Francisco",
"pms_pm02_5": "12.5",
"device_class": "geigiecast-zen",
"when_captured": "2024-11-02T15:30:00"
}'
curl -X GET "http://localhost:8000/query?device_sn=SN12345"