Is imp.deepsleepfor(integer) example correct?

Is the example on this page correct? https://electricimp.com/docs/api/imp/deepsleepfor/

The description says that it should wake up once a min for 0.05s and once an hour activate WiFi to dump it’s results.

If that’s the case I wouldn’t expect 3 entries a min in my Log file as the WiFi shouldn’t be on, unfortunately the imp is at home at the moment and I’m at work so I can’t see the LED status codes.

Also the example doesn’t appear to use best practices which is a bit annoying to a newbie.
"[Device] ERROR: sleeping in main program not recommended, see imp.onidle"

I want to run an app off battery so having the WiFi off as much as possible will really help.

2013-10-21 17:08:40 UTC+1: [Status] Downloading new code 2013-10-21 17:08:41 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:08:41 UTC+1: [Device] ERROR: sleeping in main program not recommended, see imp.onidle 2013-10-21 17:08:41 UTC+1: [] sleeping until 1382375324000 2013-10-21 17:08:41 UTC+1: [Agent] 2013-10-21 17:08:41 UTC+1: [Power State] Power state: online=>asleep 2013-10-21 17:08:41 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:09:09 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:09:09 UTC+1: [Status] Device booting 2013-10-21 17:09:09 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:09:29 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:10:08 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:10:08 UTC+1: [Status] Device booting 2013-10-21 17:10:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:10:28 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:11:08 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:11:08 UTC+1: [Status] Device booting 2013-10-21 17:11:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:11:28 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:12:08 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:12:08 UTC+1: [Status] Device booting 2013-10-21 17:12:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:12:28 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:13:08 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:13:08 UTC+1: [Status] Device booting 2013-10-21 17:13:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:13:28 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:14:08 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:14:08 UTC+1: [Status] Device booting 2013-10-21 17:14:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:14:28 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:15:08 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:15:08 UTC+1: [Status] Device booting 2013-10-21 17:15:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:15:28 UTC+1: [Power State] Power state: online=>offline 2013-10-21 17:16:07 UTC+1: [Power State] Power state: offline=>online 2013-10-21 17:16:07 UTC+1: [Status] Device booting 2013-10-21 17:16:08 UTC+1: [Status] Device configured to be "Hourly report" 2013-10-21 17:16:28 UTC+1: [Power State] Power state: online=>offline

There are a few bad things with that example… I fixed them :slight_smile: If you find anything else that looks wrong please let us know!

imp.configure will cause the imp to come online, so we want to remove that.

The imp.deepsleepfor should be wrapped in an imp.onidle()