My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /opt/local/bin/perl -w

#########################################################################
# Script to upload the PV status to pvoutput.org
#
# Lieven Hollevoet, 2011
#########################################################################

use strict;
use POSIX;

# PVOutput Settings
$system_id = '2358';
$api_key = '90834250489189201734971078964523479120875';

# Get the production of today
my $production = `./update_zonnestroomopbrengst.pl pvoutput`;

#print "Production today is : $production Wh\n";

if ($production == 0) {
print "PVoutput result not posted, no production yet\n";
exit(0);
}

# Get the date and time for the request
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $year = 1900 + $yearOffset;
# Convert to nicely formatted strings
my $hm = sprintf("%02i:%02i", $hour, $minute);
my $ymd = sprintf("%04i%02i%02i", $year, $month+1, $dayOfMonth);

my $command = "curl -s -d \"d=$ymd\" -d \"t=$hm\" -d\"v1=$production\" -H \"X-Pvoutput-Apikey: $api_key\" -H \"X-Pvoutput-SystemId: $system_id\" http://pvoutput.org/service/r2/addstatus.jsp\n";
#print "Sending: $command\n";

my $post_result = `$command`;

print "PVoutput curl response: $post_result\n";

Change log

r241 by lieven.hollevoet on Sep 2, 2011   Diff
Script configuration through variables at
the top of the file
Go to: 
Project members, sign in to write a code review

Older revisions

r240 by lieven.hollevoet on Aug 30, 2011   Diff
Added script to push data to the
pvoutput database
All revisions of this file

File info

Size: 1265 bytes, 38 lines

File properties

svn:executable
*
Powered by Google Project Hosting