Skip to search.
ukha_d · Automated Home Discussion

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

  Messages Help
Advanced
Current Cost data extract   Message List  
Reply Message #163043 of 163339 |
Re: [ukha_d] Current Cost data extract

If you’d prefer you can send your VB one over to me and I’ll have a look at
it for where you may be going wrong?

Cheers,

Michael


From: Peter Church
Sent: Monday, February 13, 2012 5:45 PM
To: ukha_d@yahoogroups.com
Subject: RE: [ukha_d] Current Cost data extract


OK. Got ActivePerl - it gives me a Perl Package Manager and a Perl Critic
application. No idea of where I drop this code script.

Can anyone give me any more pointers on what to do. I'm guessing I'll have
to muck around with baud rates and Comports when I get that far, but I'm not
sure even where to start to get the script even thinking about running!?

Thanks

Pete

From: mailto:ukha_d%40yahoogroups.com [mailto:mailto:ukha_d%40yahoogroups.com]
On Behalf Of
Jason Pearce
Sent: 13 February 2012 10:19
To: mailto:ukha_d%40yahoogroups.com
Subject: RE: [ukha_d] Current Cost data extract

Hi,

Google activeperl

Regards,

Jason
On Feb 13, 2012 9:43 AM, "Peter Church" <mailto:yahoo%40petechurch.co.uk
<mailto:yahoo%40petechurch.co.uk> > wrote:

> **
>
>
> Thanks Alex
>
> "drop on a Perl interpreter" might be beyond my rough and ready
> capabilities, but I'll see if I can have a go.
>
> Any recommendations of one for Windows?
>
> P
>
> From: mailto:ukha_d%40yahoogroups.com <mailto:ukha_d%40yahoogroups.com>
[mailto:mailto:ukha_d%40yahoogroups.com <mailto:ukha_d%40yahoogroups.com> ] On
Behalf
Of
> Alex Monaghan
> Sent: 13 February 2012 08:04
> To: mailto:ukha_d%40yahoogroups.com <mailto:ukha_d%40yahoogroups.com>
> Subject: RE: [ukha_d] Current Cost data extract
>
> I used this Perl script on a Linux box a while back (not got round to
> re-configuring after Google ditched the Windows app). Very rough & ready,
> looks like it was cobbled together from a snippet of someone else's
example
> code, but you should be able to drop on a Perl interpreter make a few
> tweaks
> and you'll be running again.
>
> #!/usr/bin/perl -w
>
> use strict;
>
> use Device::SerialPort;
> use XML::Parser;
> use XML::XPath;
> use DBI;
>
> my $port = Device::SerialPort->new("/dev/ttyUSB0");
> my $dbh = DBI->connect("dbi:mysql:ccost:localhost:3306", "ccost",
"ccost");
>
> $port->baudrate(57600);
> $port->parity("none");
> $port->handshake("none");
> $port->databits(8);
> $port->stopbits(1);
> $port->read_char_time(0);
> $port->read_const_time(1);
>
> print "\nStart\n";
> # read data until new data is not found five times in a row
> while (1)
> {
> my $readData = &read(5);
> if ($readData ne "")
> {
> #print $readData;
> eval
> {
> my $xml = XML::XPath->new(xml => $readData);
> my $date = $xml->find('//msg/time');
> my $watts = $xml->find('//msg/ch1/watts');
> #print $date, "," , $watts, "\n";
> # prepare the query
> my $sth = $dbh->prepare("insert into readings(date, reading)
> values(now(), $watts)");
>
> # execute the query
> $sth->execute();
> }
> }
>
> }
>
> $port->close();
> print "\nEnd\n";
>
> sub read()
> {
> my $maxCnt = shift;
> my $notFndCnt = 0;
>
> # clear the read buffer variables
> my $readChars = 0; my $readBytes = ""; my $readBuffer = "";
>
> while ($notFndCnt < $maxCnt) {
> # Read serial port data
> ($readChars, $readBytes) = $port->read(1);
>
> #print $readBytes;
>
> $readBuffer .= $readBytes;
>
> if ($readChars == 0) {
> $notFndCnt++;
> } else {
> $notFndCnt = 0;
>
> }
> }
>
> #print "\n";
>
> $readBuffer;
> }
>
> -----Original Message-----
> From: mailto:ukha_d%40yahoogroups.com <mailto:ukha_d%40yahoogroups.com>
<mailto:ukha_d%40yahoogroups.com>
> [mailto:mailto:ukha_d%40yahoogroups.com <mailto:ukha_d%40yahoogroups.com>
<mailto:ukha_d%40yahoogroups.com> ] On
> Behalf
> Of
> peter_church
> Sent: 12 February 2012 08:26
> To: mailto:ukha_d%40yahoogroups.com <mailto:ukha_d%40yahoogroups.com>
<mailto:ukha_d%40yahoogroups.com>
> Subject: [ukha_d] Current Cost data extract
>
> Hi all,
>
> I've searched the web on this and cannot find anything suitable, but was
> wondering if anyone here has a homebrew solution to this (or a pointer to
> something I missed).
>
> I was using Google to gather the data from my CurrentCost unit, but was
> ignoring their web part but instead pulling out my own values from the
> local
> database that Google was creating on my machine.
>
> Since Google discontinued their monitoring service their software no
longer
> seems to be working (obviously I suppose).
>
> Does anyone have a simple solution to retriveing the CurrentCost info into
> a
> local database? All the ones ont the web contain a fancy front end or
> upload
> to the web which I don't want.
>
> I've tried writing my own in VB (my only language) but it uses all
> resources
> of the processor which is a bit of a problem - down to my limitations I
> guess.
>
> Many thanks in advance
>
> Pete
>
> ------------------------------------
>
> Yahoo! Groups Links
>
> [Non-text portions of this message have been removed]
>
>
>

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]




Mon Feb 13, 2012 6:13 pm

himszy
Offline Offline
Send Email Send Email

Message #163043 of 163339 |
Expand Messages Author Sort by Date

Hi all, I've searched the web on this and cannot find anything suitable, but was wondering if anyone here has a homebrew solution to this (or a pointer to...
peter_church Offline Send Email Feb 12, 2012
8:25 am

I used this Perl script on a Linux box a while back (not got round to re-configuring after Google ditched the Windows app). Very rough & ready, looks like it...
Alex Monaghan
alexmonaghan Offline Send Email
Feb 13, 2012
8:02 am

Thanks Alex "drop on a Perl interpreter" might be beyond my rough and ready capabilities, but I'll see if I can have a go. Any recommendations of one for...
Peter Church
peter_church Offline Send Email
Feb 13, 2012
9:43 am

Google for "activestate", I think they do a community version which is free. There are I'm sure many others out there, I tend to use Linux to run this sort of...
Alex Monaghan
alexmonaghan Offline Send Email
Feb 13, 2012
10:05 am

Hi, Google activeperl Regards, Jason ... [Non-text portions of this message have been removed]...
Jason Pearce
jjpearce05 Offline Send Email
Feb 13, 2012
10:23 am

OK. Got ActivePerl - it gives me a Perl Package Manager and a Perl Critic application. No idea of where I drop this code script. Can anyone give me any more...
Peter Church
peter_church Offline Send Email
Feb 13, 2012
5:45 pm

If you’d prefer you can send your VB one over to me and I’ll have a look at it for where you may be going wrong? Cheers, Michael From: Peter Church Sent:...
Michael Hims
himszy Offline Send Email
Feb 14, 2012
9:38 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help