Skip to content

Instantly share code, notes, and snippets.

@Tafkas
Created November 13, 2013 13:47
Show Gist options
  • Save Tafkas/7449360 to your computer and use it in GitHub Desktop.
Save Tafkas/7449360 to your computer and use it in GitHub Desktop.
Fetch data from USB-WDE1 receiver and write it to RRDTool database
#!/usr/bin/env bash
# Receive weather data from remote USB WDE1 and store it into database
# Loop forever to read data from USB WDE1
socat / dev/ttyUSB0, B9600 STDOUT | \
while read line
do
if [["$ {line%% *}" == '$ 1']] then
# Format data
"{? line # 1, 1,} $" tmp = `echo | tr ',' ','`.
data = `echo" $ {tmp% N% 0} "| sed 's / :: /: U :/ g' | sed 's / :: /: U :/ g'`
data = $ data {%%}
# Update rrd
rrdtool update temperatures.rrd $ data
fi
done
@tihomircolev
Copy link

I think you have a mistake in line 15 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment