-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSolarStatsCoUk.ino
More file actions
71 lines (51 loc) · 2.31 KB
/
Copy pathSolarStatsCoUk.ino
File metadata and controls
71 lines (51 loc) · 2.31 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
NANODE SMA PV MONITOR
Latest version found at https://github.com/stuartpittaway/nanodesmapvmonitor
Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
http://creativecommons.org/licenses/by-nc-sa/3.0/
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
Under the following conditions:
Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial — You may not use this work for commercial purposes.
Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
All code is copyright Stuart Pittaway, (c)2012.
*/
char solarstatswebsite[] PROGMEM = "www.solarstats.co.uk";
int webserviceSolarStats::getTimerResetValue (){
//Number of minutes between uploads
return 2;
}//end function
bool webserviceSolarStats::dnsLookup() {
//Think the pvoutputwebsite should be moved into a function inside the base class then overridden from the child, can we return prog_
return ether.dnsLookup( solarstatswebsite );
}
void webserviceSolarStats::preparePacket(unsigned long totalkWhGenerated,unsigned long spotTotalPowerAC,unsigned long spotTotalPowerDC, time_t dt)
{
//Serial.print(F("Uploading to "));
//Serial.println(solarstatswebsite);
// generate the header with payload - note that the stash size is used,
// and that a "stash descriptor" is passed in as argument using "$H"
//http://forum.jeelabs.net/node/375
byte sd = stash.create();
stash.print(F("date="));
//date is in YYYY-MM-DD format
stash.print(year(dt));
stash.print('-');
stashPrintTwoDigits(month(dt));
stash.print('-');
stashPrintTwoDigits(day(dt));
stash.print(F("&time="));
stashPrintTwoDigits(hour(dt));
stashPrintTwoDigits(minute(dt));
stash.print(F("&watthour="));
stash.print(totalkWhGenerated);
stash.save();
Stash::prepare(PSTR("GET http://$F/api/Update.ashx?apikey=$F&apipassword=$F&$H HTTP/1.0" "\r\n"
"Host: $F" "\r\n"
//"User-Agent: NanodeSMAPVMonitor" "\r\n"
"Content-Length: $D" "\r\n"
"\r\n"),
solarstatswebsite,PSTR(SOLARSTATSAPIKEY),PSTR(SOLARSTATSAPIPASSWORD),sd,solarstatswebsite, 0);
}