From 6783d5f9dcacc3badf44435171942bf9d2f235cc Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 10 Jan 2021 11:44:12 +0000 Subject: [PATCH] send light readings to mqtt This can be used to dim other devices on home network depending on light intensity --- influx.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/influx.sh b/influx.sh index 2f6b46b..ae76e62 100755 --- a/influx.sh +++ b/influx.sh @@ -4,4 +4,7 @@ stty -F /dev/ttyUSB0 ispeed 115200 cs8 -cstopb -parenb -echo igncr 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" + light=$( echo $line | sed -e 's/^.*,light=//' -e 's/,.*$//' ) + mosquitto_pub -h rpi2 -t grove/light -m $light + echo $line > /dev/shm/grove done -- 2.20.1