Thanks pinto! Up and running now...
Final script for posterity:
#! /bin/sh
#
while :
do
WhatWeRead=$(grep -m 1 V /dev/ttyUSB0)
# Format reading
volt=`echo $WhatWeRead | cut -c -7`
amp=`echo $WhatWeRead | cut -c 10-16`
watt=`echo $WhatWeRead | cut -c 19-25`
wattH=`echo $WhatWeRead | cut -c 28-34 ...
Search found 17 matches
- Thu Jun 14, 2012 12:11 am
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
- Wed Jun 13, 2012 11:02 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Alright so that works!
One last thing:
Actual Sensors are /100 in your syntax, how would I *100 so the values come out right on the sensors?
Type # ID Name Last Signal Sensor Data
unknown 20 1 sec 0.13
unknown 21 1 sec 0.02
unknown 22 1 sec 0.26
unknown 23 1 sec 5.14
Station 2 (Plug-in ...
One last thing:
Actual Sensors are /100 in your syntax, how would I *100 so the values come out right on the sensors?
Type # ID Name Last Signal Sensor Data
unknown 20 1 sec 0.13
unknown 21 1 sec 0.02
unknown 22 1 sec 0.26
unknown 23 1 sec 5.14
Station 2 (Plug-in ...
- Wed Jun 13, 2012 10:55 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Ok, I think it will work now as this is what I did:
#! /bin/sh
#
while :
do
WhatWeRead=$(grep -m 1 V /dev/ttyUSB0)
# Format reading
volt=`echo $WhatWeRead | cut -c -7`
amp=`echo $WhatWeRead | cut -c 10-16`
watt=`echo $WhatWeRead | cut -c 19-25`
wattH=`echo $WhatWeRead | cut -c 28-34`
echo data20 ...
#! /bin/sh
#
while :
do
WhatWeRead=$(grep -m 1 V /dev/ttyUSB0)
# Format reading
volt=`echo $WhatWeRead | cut -c -7`
amp=`echo $WhatWeRead | cut -c 10-16`
watt=`echo $WhatWeRead | cut -c 19-25`
wattH=`echo $WhatWeRead | cut -c 28-34`
echo data20 ...
- Wed Jun 13, 2012 10:39 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
used ipkg install grep to get a different version, now it supports -m
New lines aren't working though
root@sioweather:/home/meteohub$ sh load.sh
data20 13.3\ndata21 2.0\ndata22 26.4\ndata23 514.0
New lines aren't working though
root@sioweather:/home/meteohub$ sh load.sh
data20 13.3\ndata21 2.0\ndata22 26.4\ndata23 514.0
- Wed Jun 13, 2012 9:51 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
this is what I get from the command line
root@sioweather:/home/meteohub$ sh -x load.sh
+ :
+ grep -m 1 V /dev/ttyUSB0
grep: invalid option -- m
BusyBox v1.2.1 (2007.12.25-11:17+0000) multi-call binary
Usage: grep [-ihHnqvsEABC] PATTERN [FILEs...]
Search for PATTERN in each FILE or standard input ...
root@sioweather:/home/meteohub$ sh -x load.sh
+ :
+ grep -m 1 V /dev/ttyUSB0
grep: invalid option -- m
BusyBox v1.2.1 (2007.12.25-11:17+0000) multi-call binary
Usage: grep [-ihHnqvsEABC] PATTERN [FILEs...]
Search for PATTERN in each FILE or standard input ...
- Wed Jun 13, 2012 9:44 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
trying right now..
- Wed Jun 13, 2012 7:51 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Ok I think I cracked it, probably there is a simpler way to write it, but this seems to work:
awk 'BEGIN {FS = "" } ; { print "data20 " $5$6$7$8 "\n" "data21 " $14$15$16$17 }' /dev/ttyUSB1
The result is:
data20 15.5
data21 12.5
data20
data21
data20 15.8
data21 12.5
data20
data21
The blank ...
awk 'BEGIN {FS = "" } ; { print "data20 " $5$6$7$8 "\n" "data21 " $14$15$16$17 }' /dev/ttyUSB1
The result is:
data20 15.5
data21 12.5
data20
data21
data20 15.8
data21 12.5
data20
data21
The blank ...
- Wed Jun 13, 2012 5:00 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Since it seems to hang when in a variable (not sure why, other than you cannot cat /dev/ttyUSB0 more than once, The second session will just hang)
I have tried a different approach.
Using:
#! /bin/sh
while :
do
(printf "%s" "data20 "; cat /dev/ttyUSB1| cut -c 4-8)
sync
sleep 30
done
I get ...
I have tried a different approach.
Using:
#! /bin/sh
while :
do
(printf "%s" "data20 "; cat /dev/ttyUSB1| cut -c 4-8)
sync
sleep 30
done
I get ...
- Mon Jun 11, 2012 9:29 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Here is what I get:
Seems to hang. BUt I know I can call cat /dev/ttyUSB0 from a shell script as I have done it numerous times. Something to do with loading it into a variable first?
Code: Select all
root@sioweather:/home/meteohub$ sh -x ./load.sh
+ sh -x ./load.sh
+ :
+ cat /dev/ttyUSB0
- Mon Jun 11, 2012 6:08 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Ok, still no luck, but I rechecked everything possible to make sure there were no syntax errors, or other mistakes.
SO I started working on my version of the script:
#! /bin/sh
#
while :
do
# Read data from sensors
Load=`cat /dev/ttyUSB0`
Charge=`cat /dev/ttyUSB1`
# Format readings
lvolt=`echo ...
SO I started working on my version of the script:
#! /bin/sh
#
while :
do
# Read data from sensors
Load=`cat /dev/ttyUSB0`
Charge=`cat /dev/ttyUSB1`
# Format readings
lvolt=`echo ...
- Mon Jun 11, 2012 5:17 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
ARRGGHH.. for a second I thought I had cracked it. I use nano on the meteohub shell, and forgot to do nano -w so the original attempt to implement the script was wrong. I fixed that, but still no new sensors are being implemented. I do see this in the meteohub log though:
logger (11.06.2012 09:13 ...
logger (11.06.2012 09:13 ...
- Mon Jun 11, 2012 5:04 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Also, FWIW, doing this does work:
root@sioweather:~$ cat /dev/ttyUSB1 | cut -c -7
-00015.
-00015.
Ill have to play with cut to get exactly what I want extracted, but I see where you were going with that. WAY easier than awk to pick specific characters.
And I also think I understand what your ...
root@sioweather:~$ cat /dev/ttyUSB1 | cut -c -7
-00015.
-00015.
Ill have to play with cut to get exactly what I want extracted, but I see where you were going with that. WAY easier than awk to pick specific characters.
And I also think I understand what your ...
- Mon Jun 11, 2012 4:57 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
I apologize for not understanding. Here is how I tried to implement:
copied your script to a file /home/meteohub/load.sh
chmod u+x /home/meteohub/load.sh
execute it
/home/metohub/load.sh
After about 30 seconds it comes back "Terminated"
Not sure what that means.
So I try to add as new plugin ...
copied your script to a file /home/meteohub/load.sh
chmod u+x /home/meteohub/load.sh
execute it
/home/metohub/load.sh
After about 30 seconds it comes back "Terminated"
Not sure what that means.
So I try to add as new plugin ...
- Sun Jun 10, 2012 9:30 am
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Re: Serial Volt/Amp meter
Awesome! Thanks.. ill try to implement tomorrow
Thanks again!
Thanks again!
- Fri Jun 08, 2012 8:50 pm
- Forum: other stations (RainWise, Peet Bros, energy monitors)
- Topic: Serial Volt/Amp meter
- Replies: 20
- Views: 19415
Serial Volt/Amp meter
I posted this in another thread a while back, but no responses (wrong forum category maybe?). Im really just looking for a way to read my wattsview http://wattsview.com/ serial DC Amp/Volt meters. I have them attached to the linksys nslu2 via added USB ports and USB serial adapters. I have two of ...