summaryrefslogtreecommitdiff
path: root/datastore-leveldb/bin/insert_testdata.py
blob: 6ea11809c2e3c3a677d90e572b89f3c059fc68da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import random
import math
import time
import requests

s = ["heizkreisregler9.solarDaten.tempKollektor",
    "heizkreisregler10.betriebsdatenRegler1.kesselTemperatur",
    "feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur"]

MINUTE = 1000 * 60
DAY = MINUTE * 60 * 24
NOW = long(time.time()*1000)

FROM=NOW-DAY*30
TO=NOW
STEP=MINUTE

for i in range(FROM,TO,STEP):
    for j,sensor in zip(range(len(s)),s):
        x = (float(i)/DAY)+j
        requests.put("http://localhost:8080/api/value/"+sensor+"/"+str(i),
                    str(50+50*math.sin(x)))