make upgrade - stop systemd, upload, start it again
[GroveSensor] / influx.sh
index 2f6b46b..b88c43b 100755 (executable)
--- a/influx.sh
+++ b/influx.sh
@@ -1,7 +1,12 @@
-#!/bin/sh -e
+#!/bin/sh
 
-stty -F /dev/ttyUSB0 ispeed 115200 cs8 -cstopb -parenb -echo igncr
+serial=/dev/serial/by-path/platform-xhci-hcd.3.auto-usb-0:2:1.0-port0
 
-cat /dev/ttyUSB0 | while read line ; do
-       curl --silent -XPOST "http://10.13.37.92:8086/write?consistency=any&db=rot13" --data-binary "grove,dc=trnjanska,host=$(hostname -s) $line"
+stty -F $serial ispeed 115200 cs8 -cstopb -parenb -echo igncr
+
+cat $serial | while read line ; do
+       curl --silent -XPOST "http://10.60.0.92:8086/write?consistency=any&db=rot13" --data-binary "grove,dc=trnjanska,host=$(hostname -s) $line"
+       light=$( echo $line | sed -e 's/^.*,light=//' -e 's/,.*$//' )
+       mosquitto_pub -h rpi2 -t grove/light -m $light
+       echo $line > /dev/shm/grove
 done