some minor changes
This commit is contained in:
parent
b4de30f825
commit
101f78be57
@ -13,13 +13,13 @@ def trans():
|
||||
queuelast = time.time()
|
||||
while True:
|
||||
queuedata = powerqueue.get()
|
||||
queuetime = queuedata[0]
|
||||
queuetime = int(queuedata[0])
|
||||
queueval = str(queuedata[1])
|
||||
if ((queuetime - queuelast) >= 5):
|
||||
payload = "val:" + str(queuetime) + ";" + queueval
|
||||
payload = {"val": str(queuetime) + ";" + str(queueval)}
|
||||
if sys.stdout.isatty():
|
||||
print("request https://strom.ccc-ffm.de:2342/gettest.php => "+payload)
|
||||
r = requests.post("https://strom.ccc-ffm.de:2342/gettest.php", data=payload, verify=False, auth=('CCC', 'Freundschaft'))
|
||||
print("request https://strom.ccc-ffm.de:2342/get.php => "+repr(payload))
|
||||
r = requests.post("https://strom.ccc-ffm.de:2342/get.php", data=payload, verify=False, auth=('CCC', 'Freundschaft'))
|
||||
if sys.stdout.isatty():
|
||||
print(r)
|
||||
queuelast = queuetime
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
if (preg_match("/^[0-9]{10}\.[0-9]{0,2};[0-9]{1,5}\.[0-9]{0,20}$/", $_POST['val'])) {
|
||||
$val = explode(";", $_POST['val']);
|
||||
$updator = new RRDUpdater("power.rrd");
|
||||
$updator->update(array("power" => $val[1]), $val[0]);
|
||||
$fileh = fopen("power.log", "w+");
|
||||
fwrite($fileh, $_POST['val']);
|
||||
fclose($fileh);
|
||||
echo "0";
|
||||
} else {
|
||||
echo "1";
|
||||
}
|
||||
|
||||
if (preg_match("/^[0-9]{10}\;[0-9]{1,5}\.?[0-9]{0,20}/", $_POST['val'])) {
|
||||
$val = explode(";", $_POST['val']);
|
||||
$updator = new RRDUpdater("power.rrd");
|
||||
$updator->update(array("power" => $val[1]), $val[0]);
|
||||
$fileh = fopen("power.log", "w+");
|
||||
fwrite($fileh, $_POST['val']);
|
||||
fclose($fileh);
|
||||
echo "0";
|
||||
} else {
|
||||
echo "1";
|
||||
}
|
||||
?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user