here is the one i used to play with interceptor driver

On Sunday, October 30, 2016 at 11:09:01 PM UTC-5, Brad Tucker wrote:
>
> Ha! Of course the most important part ;) I have 1.44 but I'll dig for the 
> source and see what I can find.
>
> Thanks for the help!
> Brad
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/perl 
#===============================================================================
#
#          FILE: acurite-lwp.pl
#
#         USAGE: ./acurite-lwp.pl  
#
#   DESCRIPTION: 
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Radar (), radar@localhost
#  ORGANIZATION: 
#       VERSION: 0.1
#       CREATED: 10/08/2016 07:16:48 PM
# Last modified: Sat Oct 15, 2016  03:30PM
#      REVISION: ---
#===============================================================================

use strict;
use warnings;

use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");

my $req = HTTP::Request->new(POST => 'http://192.168.1.6:9999');
my $res;

my $newline = '';
my $build = 0;
my $obs_line = 'dateutc=now&action=updateraw&realtime=1';

while ( my $line = <> ) {
	if ( defined $line ) {
		if ($line =~ /GET /) {
			$build = 1;
			$newline = '';
		}
		if (($line =~ /&id=/) && ($build == 1)) {
			$line =~ s/.*&id=/&id=/xm;
			chomp $line;
			$newline = $line;
		}
		if (($build == 1) && ($line =~ /&windspeedmph=/)) {
			$line =~ s/.*&windspeedmph=/&windspeedmph=/xm;
			chomp $line;
			$newline = $newline . $line;
		}
		if (($build == 1) && ($newline =~ /5N1x38/)) {
			if (($build == 1) && ($line =~ /&tempf=/)) {
				$line =~ s/.*&tempf=/&tempf=/xm;
				chomp $line;
				$newline = $newline . $line;
			}
		}
		if (($build == 1) && ($line =~ /&rainin=/)) {
			$line =~ s/.*&rainin=/&rainin=/xm;
			chomp $line;
			$newline = $newline . $line;
		}
		if (($build == 1) && ($line =~ /&humidity=/)) {
			$line =~ s/.*&humidity=/&humidity=/xm;
			chomp $line;
			$newline = $newline . $line;
		}
		if (($build == 1) && ($line =~ /&indoorhumidity=/)) {
			$line =~ s/.*&indoorhumidity=/&indoorhumidity=/xm;
			chomp $line;
			$newline = $newline . $line;
		}
		if (($build == 1) && ($line =~ /&probe=/)) {
			$line =~ s/.*&probe=/&probe=/xm;
			chomp $line;
			$newline = $newline . $line;
		}
		if (($build == 1) && ($line =~ /&baromin=/)) {
			$line =~ s/.*&baromin=/&baromin=/xm;
			chomp $line;
			$build = 2;
			$newline = $newline . $line;
			$obs_line = $obs_line . $newline;
			$newline = '';
		}
		if ($build == 2) {
			$build = 0;
			print "$obs_line\n";
			$req->content("$obs_line");
			$res = $ua->request($req);
			$obs_line = 'dateutc=now&action=updateraw&realtime=1';
			
			if ( $res->is_success ) {
				print $res->content, "\n";
			}
			else {
				print $res->status_line, "\n";
			}
		}
	} #end of if definde $line
} # end of while loop

Reply via email to