<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I don't know about the new script but is it possible the old one is
printing faster than the rev2 can send? Maybe you can append the
serial data to a string until you get the '}' and then print that.<br>
<br>
Regards,<br>
<br>
Deniz<br>
<br>
<div class="moz-cite-prefix">On 06/10/15 16:05, Bo Herrmannsen
wrote:<br>
</div>
<blockquote
cite="mid:CAFqpYu6C7okhVdW_DoFMeN5L9WSX3wcw8Br-GMUudR_BhvpDHA@mail.gmail.com"
type="cite">
<div dir="ltr">Hi
<div><br>
</div>
<div>I started on a script that can read serial data from a rev2
unit and send the data on to emoncms.</div>
<div><br>
</div>
<div>i get this on the serial line</div>
<div><br>
</div>
<div>
<div>{"@":"2800","+":4,"T|C16":544,"vC|%":2340,"O":1}</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>and so far i have this python script</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>import serial</div>
<div>import io</div>
<div>import time</div>
<div>ser = serial.Serial('/dev/ttyUSB0',4800)</div>
<div><br>
</div>
<div><br>
</div>
<div>sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser, 1),
encoding='ascii',newline='\r\n')</div>
<div><br>
</div>
<div>while ser.isOpen():</div>
<div><br>
</div>
<div> datastring = sio.readline()</div>
<div><br>
</div>
<div>print datastring</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>the serial data end with CRLF</div>
<div><br>
</div>
<div>but it does not print anything.... where am i wrong?</div>
<div><br>
</div>
<div>before i used this script:</div>
<div><br>
</div>
<div>
<div style="font-size:12.8px">import serial</div>
<div style="font-size:12.8px">import time</div>
<div style="font-size:12.8px">s =
serial.Serial('/dev/ttyUSB0',4800)</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">while 1:</div>
<div style="font-size:12.8px"> if s.inWaiting():</div>
<div style="font-size:12.8px"> val =
s.read(s.inWaiting())</div>
<div style="font-size:12.8px"> print val</div>
</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">but then i got:</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">
<div style="font-size:12.8px">{"@":"0950","</div>
<div style="font-size:12.8px">+":</div>
<div style="font-size:12.8px">5,"</div>
<div style="font-size:12.8px">t</div>
<div style="font-size:12.8px">T|C</div>
<div style="font-size:12.8px">":</div>
<div style="font-size:12.8px">1</div>
<div style="font-size:12.8px">9,"</div>
<div style="font-size:12.8px">vC|%</div>
<div style="font-size:12.8px">":</div>
<div style="font-size:12.8px">20</div>
<div style="font-size:12.8px">0,"</div>
<div style="font-size:12.8px">T|</div>
<div style="font-size:12.8px">C</div>
<div style="font-size:12.8px">1</div>
<div style="font-size:12.8px">6":</div>
<div style="font-size:12.8px">33</div>
<div style="font-size:12.8px">1}</div>
<div><br>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OpenTRV-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenTRV-dev@lists.opentrv.org.uk">OpenTRV-dev@lists.opentrv.org.uk</a>
<a class="moz-txt-link-freetext" href="http://lists.opentrv.org.uk/listinfo/opentrv-dev">http://lists.opentrv.org.uk/listinfo/opentrv-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>