remove old files

This commit is contained in:
2012-11-27 09:51:34 +01:00
parent 728e41c5dc
commit cb2a76b4e9
7 changed files with 1 additions and 247 deletions

View File

@@ -48,7 +48,7 @@ other = "/opt/inverter/data" # unix/linux
[scripts]
pvoutput = "perl pvoutput.pl" # to export data to http://pvoutput.org
pvoutput_php = "./pvoutput.php" # to export data to http://pvoutput.org
create_rrd = "./create_rrd.pl" # to export data to rrdtool for graphing
create_rrd = "./create_rrd.php" # to export data to rrdtool for graphing
rrdtool_exe_win = "rrdtool" # windows
rrdtool_exe_oth = "/usr/bin/rrdtool" # unix/linux

View File

@@ -1,54 +0,0 @@
#!/usr/bin/perl -w
#
# AS AT 27Mar2011
#
# This creates the rrd file using rrdtool (Round Robin Database Tool)
# Download & install rrdtool for your platform (unix/linux/windows)
# - http://oss.oetiker.ch/rrdtool/download.en.html
# - http://www.mywebhostingblog.net/window-hosting/install-rrdtool-on-windows-server/]
#
# CREATED BY: slampt with help from JinbaIttai
#
# + editions by shell_l_d:
# + converted to perl script
#
# Usage examples:
# perl create_rrd.pl "c:/solar/inverter.rrd" "c:/rrdtool/rrdtool"
# perl create_rrd.pl "/tmp/inverter.rrd" "/usr/bin/rrdtool"
#
# Arguments:
# $ARGV[0] = path & name for the new rrd file
# $ARGV[1] = path to rrdtool
#
#######################################################################
my $rrdfile = $ARGV[0];
my $rrdexe = $ARGV[1];
#
# Info: http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html
# --step = base interval in secs with which data will be fed into the RRD.
# --start = time in secs since EPOCH when first value should be added to the RRD
# DS = Data Source
# DS:ds-name:GAUGE|COUNTER|DERIVE|ABSOLUTE:heartbeat:min:max
# RRA = Round Robin Archive
# RRA:AVERAGE|MIN|MAX|LAST:xff:steps:rows
#
my $rrdCreateLine = "--step 60 " .
# "--start 1300774440 " .
"DS:TEMP:GAUGE:120:U:U " .
"DS:VPV:GAUGE:120:U:U " .
"DS:IAC:GAUGE:120:U:U " .
"DS:VAC:GAUGE:120:U:U " .
"DS:FAC:GAUGE:120:U:U " .
"DS:PAC:GAUGE:120:0:U " .
"DS:ETOTAL:GAUGE:120:0:U " .
"DS:HTOTAL:GAUGE:120:0:U " .
"DS:MODE:GAUGE:120:0:U " .
"DS:ETODAY:GAUGE:120:0:U " .
"RRA:AVERAGE:0.5:1:576 " . # 1*60secs= 1min , 576* 1min = 9.6hrs = 0.4days
"RRA:AVERAGE:0.5:6:672 " . # 6*60secs= 6mins, 672* 6mins = 67.2hrs = 2.8days
"RRA:AVERAGE:0.5:24:732 " . # 24*60secs= 24mins, 732* 24mins = 292.8hrs = 12.2days
"RRA:AVERAGE:0.5:144:1460"; #144*60secs=144mins, 1460*144mins = 3504.0hrs = 146.0days
system( "$rrdexe create $rrdfile $rrdCreateLine" );

View File

@@ -1,16 +0,0 @@
#!/bin/bash
cd /opt/inverter/
while :
do
service bluetooth restart
sleep 10
hcitool scan
sleep 10
bluetooth-agent 1234 00:12:06:15:10:43 &
sleep 10
rfcomm connect 0 00:12:06:15:10:43 1 &
sleep 10
perl inverter.pl
hcitool dc 00:12:06:15:10:43
sleep 10
done

View File

@@ -1,46 +0,0 @@
#!/usr/local/bin/php
<?php
echo '<pre>';
$sRRDFile = 'inverter.rrd';
$sRRDFetch = 'rrdtool fetch %s AVERAGE -r %d -s %d -e %d';
$sField = 'PAC';
/* Constrain data to fetch */
$iLast = strtotime('9:00');
$iStart = $iLast;
$iEnd = strtotime('17:00');
$iResolution = 5;
/* Extract fields */
$sData = command(sprintf($sRRDFetch, $sRRDFile, $iResolution, $iStart, $iEnd));
$aData = explode("\n", trim($sData));
$aFields = preg_split("~[\s]+~", array_shift($aData));
array_shift($aData);
$aFields = array_flip($aFields);
$bFirst = true;
$fTotal = 0;
if (isset($aFields[$sField])) {
$iField = $aFields[$sField] + 1;
array_shift($aData);
foreach ($aData as $sRow) {
$aRow = explode(' ', $sRow);
if ($bFirst) var_dump($aRow);
$iDate = substr($aRow[0], 0, -1);
$iInterval = $bFirst ? (($bFirst = false) || $iResolution) : $iDate - $iLast;
if (($fValue = floatval($aRow[$iField])) > 0) {
$fTotal += $iInterval * $fValue;
}
$iLast = $iDate;
}
}
/* Convert to kWh */
var_dump(count($aData));
var_dump($fTotal / 1000 / 3600);
function command($sCommand) {
ob_start();
system($sCommand);
return ob_get_clean();
}

View File

@@ -1,7 +0,0 @@
#!/bin/bash
cd /opt/inverter/
while :
do
perl inverter.pl
sleep 10
done

View File

@@ -1,121 +0,0 @@
#!/usr/bin/perl -w
#
# AS AT 04May2011
#
# Submit solar production data to pvoutput.org per http://pvoutput.org/help.html#api
#
# Setup your pvoutput settings per http://pvoutput.org/help.html#api
# Set all values in @PVOUTPUT in this script to match those in your pvoutput settings
# - API_KEY & SYSTEM_ID to your settings from pvoutput.org
# - SERIAL_NUM to your inverter's serial number
# - add another record (in curly braces) if you have more than 1 inverter
#
# V1: Initial release
#
# Copyright Eric Sandeen <sandeen@sandeen.net> 2010
# released under GNU GPL v3 or later
#
# + editions by mmcdon23:
# + removed enphase envoy lines
# + added 4 arguments
#
# + editions by shell_l_d:
# + added serial_num argument so works for multiple inverters
# + replaced variables with @PVOUTPUT array of hashes
# + removed die if $current_watts = 0
#
# Usage examples:
# perl pvoutput.pl 5500 1813 20110307 12:15 1234567890
#
# Arguments:
# $ARGV[0] = (ETODAY) watt hrs exported so far today
# $ARGV[1] = (PAC) current watts
# $ARGV[2] = (VAC) current voltage
# $ARGV[3] = date (YYYYMMDD)
# $ARGV[4] = time (HH:MM)
# $ARGV[5] = inverter serial number - in case of multiple inverters
#
#######################################################################
use HTTP::Request::Common qw(POST GET);
use LWP::UserAgent; # Web User Agent
use strict;
my $daily_watthrs = $ARGV[0];
my $current_watts = $ARGV[1];
my $current_volts = $ARGV[2];
my $log_date = $ARGV[3];
my $log_time = $ARGV[4];
my $serial_num = $ARGV[5];
use constant {
DEBUG_SCRIPT => 0, # 0 = NO, 1 = YES
LIVE_DATA_URL => "http://pvoutput.org/service/r1/addstatus.jsp",
};
#
# Array of Hashes of pvoutput information for each inverter - add more as required (in curly braces)
#
my @PVOUTPUT = (
{
SERIAL_NUM => "1204DQ0116",
API_KEY => "16e7a916d69656e354d00461a4da1d2e40cfa4f1",
SYSTEM_ID => "12419",
},
);
#######################################################################
#
# Display arguments if $debug turned on
#
if ( DEBUG_SCRIPT ) {
print "Serial: $serial_num as at: $log_date $log_time\n";
print "Now: $current_watts W\n";
print "Today: $current_volts Wh\n";
print "Today: $daily_watthrs Wh\n";
}
#
# Prepare the web request
#
my $ua = LWP::UserAgent->new;
#
# Loop through the PVOUTPUT Array of Hashes to find the matching inverter serial number
#
my $i;
for $i ( 0 .. $#PVOUTPUT ) {
if ( $PVOUTPUT[$i]{SERIAL_NUM} eq $serial_num ) {
if ( DEBUG_SCRIPT ) {
print $PVOUTPUT[$i]{SERIAL_NUM} . " serial match found at index $i\n";
}
$ua->default_header(
"X-Pvoutput-Apikey" => $PVOUTPUT[$i]{API_KEY},
"X-Pvoutput-SystemId" => $PVOUTPUT[$i]{SYSTEM_ID},
"Content-Type" => "application/x-www-form-urlencoded"
);
}
}
#
# Prepare request string
#
print "Sending to PVOUTPUT [ d => $log_date, t => $log_time, v1 => $daily_watthrs, v2 => $current_watts, v6 => $current_volts ]\n";
my $request = POST LIVE_DATA_URL, [ d => $log_date, t => $log_time, v1 => $daily_watthrs, v2 => $current_watts, v6 => $current_volts ];
#
# Send request to pvoutput to add/update live output status
#
my $res = $ua->request($request);
#
# Display any errors
#
if (! $res->is_success) {
die "Couldn't submit data to pvoutput.org:" . $res->status_line . "\n";
}
exit;

View File

@@ -1,2 +0,0 @@
#!/bin/bash
/opt/inverter/inverter.php >> /opt/inverter/log 2>&1 &