function log() {
if (!(“nv” in getroottable())) {
nv <- { data = “” };
hourly();
}
local min = (t/60) % 60;
readEverything();
if (min == 59) {
hourly();
}
imp.onidle(function() { imp.deepsleepfor(60 - (time() % 60)); });
}
log();
`
Ive modified the code to fit my needs, at first it seemed that the imp was going to deepsleep before it had time to deliver all the data .set() to the Output port, i thought i’ve fixed this issue by wrapping the deepsleep api call inside onidle. (It worked for some hours, but then this morning it stopped delivering outputs every hour, only deliverying say 1 out of 5 times).
In the logging i can see that the imp powers up on the minutte, and then goes offline again without having sent the data to my web app.
I have about ~ 2.8Kb of data in the nv. is there any way to make the delivery more stable, or somehow make it retry if it fails?
7/3/2013 1:59:21 PM: Device booting
7/3/2013 1:59:21 PM: Device configured to be "Kamstrup" 7/3/2013 2:59:13 PM: Device booting
7/3/2013 2:59:13 PM: Device configured to be "Kamstrup"
7/3/2013 2:59:13 PM: Power state: online=>asleep
7/3/2013 3:59:14 PM: Power state: asleep=>online
7/3/2013 3:59:14 PM: Device booting
7/3/2013 3:59:14 PM: Device configured to be "Kamstrup"
7/3/2013 3:59:34 PM: Power state: online=>offline
7/3/2013 4:59:14 PM: Power state: offline=>online
7/3/2013 4:59:14 PM: Device booting
7/3/2013 4:59:14 PM: Device configured to be "Kamstrup"
7/3/2013 5:59:16 PM: Device booting
7/3/2013 5:59:16 PM: Device configured to be "Kamstrup"
7/3/2013 6:59:19 PM: Device booting
7/3/2013 6:59:19 PM: Device configured to be "Kamstrup"
7/3/2013 7:59:21 PM: Device booting
7/3/2013 7:59:21 PM: Device configured to be "Kamstrup"
7/3/2013 8:59:14 PM: Device booting
7/3/2013 8:59:39 PM: Power state: online=>offline
The text in bold is where it have actually sent some data to my webserver - The other entries the imp just seems to wake up and go offline a few seconds later (not sending my webserver any data)