Created
April 20, 2020 15:21
-
-
Save cbuctok/54cbced2d15e57a9e0e647b7c2b1f4b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
data=$(timeout 20 gatttool -b $SENSOR_ADDRESS --char-write-req --handle=0x10 -n 0100 --listen 2>/dev/null | grep "Notification handle" -m 2) | |
temperature=$(echo $data | awk '{print $7$6}') | |
humidity=$(echo $data | awk '{print $8}') | |
temperature=$((16#$temperature)) | |
temperature=$(echo "scale=2; $temperature/100" | bc -l) | |
humidity=$((16#$humidity)) | |
echo $temperature | |
echo $humidity | |
curl -q -i -XPOST "$INFLUXDB/write?db=home_temperature" --data-binary "salon temperature=$temperature,humidity=$humidity" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment