#!/usr/bin/perl -w # Reads data from Current Cost and e.on energy monitor devices via serial port. use strict; use Device::SerialPort qw( :PARAM :STAT 0.07 ); my $PORT = "/dev/ttyUSB0"; my $ob = Device::SerialPort->new($PORT); $ob->baudrate(57600); $ob->write_settings; open(SERIAL, "+>$PORT"); while (my $line = ) { if ($line =~ m! *([\-\d.]+).*0*(\d+)!) { my $temp = $1; my $watts = $2; print "$watts, $temp\n"; } }