[OpenTRV-dev] python opentrv to emoncms script...

Deniz Erbilgin deniz.erbilgin at gmail.com
Tue Oct 6 17:10:46 BST 2015


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.

Regards,

Deniz

On 06/10/15 16:05, Bo Herrmannsen wrote:
> Hi
>
> I started on a script that can read serial data from a rev2 unit and 
> send the data on to emoncms.
>
> i get this on the serial line
>
> {"@":"2800","+":4,"T|C16":544,"vC|%":2340,"O":1}
>
>
> and so far i have this python script
>
>
> import serial
> import io
> import time
> ser = serial.Serial('/dev/ttyUSB0',4800)
>
>
> sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser, 1), 
> encoding='ascii',newline='\r\n')
>
> while ser.isOpen():
>
>           datastring = sio.readline()
>
> print datastring
>
>
>
>
> the serial data end with CRLF
>
> but it does not print anything.... where am i wrong?
>
> before i used this script:
>
> import serial
> import time
> s = serial.Serial('/dev/ttyUSB0',4800)
>
> while 1:
>    if s.inWaiting():
>       val = s.read(s.inWaiting())
>       print val
>
> but then i got:
>
> {"@":"0950","
> +":
> 5,"
> t
> T|C
> ":
> 1
> 9,"
> vC|%
> ":
> 20
> 0,"
> T|
> C
> 1
> 6":
> 33
> 1}
>
>
>
>
>
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opentrv.org.uk/pipermail/opentrv-dev/attachments/20151006/03519aa9/attachment.html>


More information about the OpenTRV-dev mailing list