Imp continuously disconnects

I have been trying to build a “tempbug”. Newbie question and not sure what the issue might be.

Keep getting the following errors in the log
2015-02-28 23:03:44 UTC+13 [Device] sleeping until 1425118501000
2015-02-28 23:04:06 UTC+13 [Agent] PUSH: 6 -
2015-02-28 23:04:05 UTC+13 [Status] Device connected; 3.87% program storage used
2015-02-28 23:04:06 UTC+13 [Device] sleeping until 1425118501000
2015-02-28 23:04:17 UTC+13 [Agent] PUSH: 6 -
2015-02-28 23:04:16 UTC+13 [Status] Device connected; 3.87% program storage used
2015-02-28 23:04:17 UTC+13 [Device] sleeping until 1425118501000
2015-02-28 23:04:43 UTC+13 [Agent] PUSH: 6 -
2015-02-28 23:04:43 UTC+13 [Status] Device connected; 3.87% program storage used
2015-02-28 23:04:43 UTC+13 [Device] sleeping until 1425118501000

Agent code is as follows:

`// TempBug Example Agent Code

/* GLOBALS and CONSTANTS -----------------------------------------------------*/

const SPARKFUN_BASE = "https://data.sparkfun.com";
const SPARKFUN_PUBLIC_KEY = "xxxxxx";
const SPARKFUN_PRIVATE_KEY = "xxxxxx";

/* CLASS AND GLOBAL FUNCTION DEFINITIONS -------------------------------------*/

class SparkFunStream {
_baseUrl = null;

_publicKey = null;
_privateKey = null;

constructor(baseUrl, publicKey, privateKey) {
_baseUrl = baseUrl;
_privateKey = privateKey;
_publicKey = publicKey;
}

function push(data, cb = null) {
assert(typeof(data == "table"));

// add private key to table
data["private_key"] <- _privateKey;
local url = format("https://%s/input/%s?%s", _baseUrl, _publicKey, http.urlencode(data));

// make the request
local request = http.get(url);
if (cb == null) {
return request.sendsync();
}

request.sendasync(cb);
}

function get(cb = null) {
local url = format("https://%s/output/%s.json", _baseUrl, _publicKey);

local request = http.get(url);
if(cb == null) {
return request.sendsync();
}
return request.sendasync(cb);
}

function clear(cb = null) {
local url = format("https://%s/input/%s/clear", _baseUrl, _publicKey);
local headers = { "phant-private-key": _privateKey };

local request = http.httpdelete(url, headers);
if (cb == null) {
return request.sendsync();
}
return request.sendasync(cb);
}
}
/* REGISTER DEVICE CALLBACKS ------------------------------------------------*/

device.on("data", function(datapoint) {
local resp = stream.push({"temp": datapoint.temp});
server.log(format("PUSH: %i - %s", resp.statuscode, resp.body));
});

/* REGISTER HTTP HANDLER -----------------------------------------------------*/

// This agent does not need an HTTP handler

/* RUNTIME BEGINS HERE -------------------------------------------------------*/

server.log("TempBug Agent Running");

// instantiate our Xively client
stream <- SparkFunStream(SPARKFUN_BASE, SPARKFUN_PUBLIC_KEY, SPARKFUN_PRIVATE_KEY);`

Looks like it just wakes up, does its thing, them goes back to sleep again.

Thanks MikeyDK. Problem is that nothing is being pushed to spark fun?

Okay, I have never used that, but since the topic was “Imp continuously disconnects” I assumed the problem you were having was that it continuously disconnected, so that was the only thing I was looking for.

Thanks again MikeyDK. I had assumed issue was due to disconnection.

Apologies but should of mentioned Sparkfun issue in title. Can’t seem to edit now.

Issue resolved. Sparkfun base had https:// when was not needed. Removed and now works. Thanks

@Savanna12a, I removed your SparkFun keys from the code (which I also formatted). You shouldn’t make this information public.