Device.isconnected issue

Has there been any update to this? I’ve returned from the weekend to find that one of my IMPs has been off for 2 days, yet the IDE still claims that it is on. I keeping sending requests to the device (through the agent) and the agent is none the wiser. After a few minutes it does report that the agent is stopped, but the device still doggedly stays ‘on’. I have refreshed the browser, logged out and back in again. No difference.

Hmm. The fix was pushed and we did not hear of any problems from the other customers who had previously seen the issue. Please PM me with the device ID so we can look at yours.

I am having connection problems starting (I think it was 1:05 AM Central time April 11, USA) in the middle of the night a few days ago. It disconnected in the middle of the night. This is either wifi out (ISP out) or maybe the imp service shut down or shut if off?

The device would not come back without a power cycle and now it is exhibiting blink codes that are not in the documentation.

on power up
Amber (quick)
Green (quick)
Then starts RED-AMBER-RED-AMBER
And finally locks on AMBER while continuing to run except with .isconnected not working.

The device is sending messages to the agent and the agent log is writing them.

However, device.isconnected() in the agent is returning false and so my web page does not load.

I can get operation back by doing this in the agent code:
//if (device.isconnected()){ if (true){

but the amber light remains on.

{ A second device is still off line from this same event and I have not messed with it }

update on two devices that went offline suddenly the other day (temporary isp outage or something on imp service side)

1st imp; First exhibited odd blink codes detailed above but then suddenly after a power cycle, went green and started operating correctly.

2nd imp; I did a power cycle one time and it did not come back up. rebuilding from the IDE only restarts the agent.

Something is wrong somewhere, what is it?

2nd imp; I did a power cycle one time and it did not come back up. rebuilding from the IDE only restarts the agent.

Something is wrong somewhere, what is it?


I have had that happening long ago, blinkup made it come back online again.

I should have mentioned; yes the last time I had this happen I did a blink-up to get it back. I raise this point because the imp should come back online without blink-up being necessary. In my case the device is closed inside of a box for safety reasons so looking at the blink codes is also not an option and there is no documented reason I should have to blink-up again.

btw, @MikeyDK I am using wifi code that came from you. Possibly I have changed it a tiny bit but mostly it is yours. After the last occurrence of a very similar issue I added code so that UART57 would put out debug information. At some point I can hook up my logic analyzer and watch to see what the device is up to.

My issue seems to be back again. isdisconnected == true, even when there is data flow.

sorry, some of my previous responses may have taken the thread a bit off-topic. It thought my connection troubles were related but perhaps not.

Today I again noticed .isconnected not working properly though all other aspects of this particular device are working fine. This is an imp-based tool that has been stable for a while now.

device
software version af0f28a - release-27.10 - Fri Dec 13 11:08:38 2013

agent
software version 6c94395 - jenkins-ei-named-branch-1560 - Mon Mar 10 09:05:27 2014

returning false negative

Re-blinkup should never be needed. It doesn’t do anything but re-populate the wifi settings fields and enrollment with the server, all of which are never written by the imp (unless your code writes them). It “resets” nothing.

As I remember you were doing stuff with the SSID/password?

Will look into isconnected() again. There’s a huge server update (which should be invisible) coming soon so we’re trying to avoid too much work on the current codebase. Giving device IDs that are showing the problem is helpful.

My device ID 23304d3643fc42ee
(can that lead to a URL, by the way?)

I can arrange for you to get an automatic mail.

Device ID does not lead to a URL, no. Device ID+plan ID can go to a URL (URL will change on every blinkup of a commercial device).

Is that agent showing the device as offline right now then?

Device ID is globally unique and stays the same, right?
Device is currently OK and online.
i can give you a URL that gives the status. (hint: it ends in ?status)

when is the major server update expected to be deployed.

I am facing issues displaying the state of the imp on my demo website due to problems with isconnected function.

We’re testing it with some users now. Depending on how this goes it’ll roll out more widely in the coming weeks.

In the meantime, you can work around the imp state by polling it (send a message from agent to imp, see if you get a reply within a timeout) - this should unblock your application in the meantime.

can you post a code snippet, that works.

I tried to put the electric imp card offline, but httpsend command from agent immediately returns a zero.

You’d need to do something like this:

On the device:
agent.on("ping", function(v) { agent.send("pong", 0); });

…this will return a pong message the instant it sees a ping

On the agent:
`
const POLL_PERIOD = 10; // poll every 10 seconds
last_response = 0; // timestamp of last response
device.on(“pong”, function(v) { last_response = time(); });

function polldevice() {
imp.wakeup(POLL_PERIOD, polldevice);
device.send(“ping”, 0);
}
polldevice();

function is_device_connected() {
// did we hear from device recently?
if ((time() - last_response) < (POLL_PERIOD + 3)) return true;
return false;
}
`

Again, my minor disconnect issue has popped up.
it is happily reporting data, while device.isconnected() is false.

https://ide.electricimp.com/ide/models/18709/devices/23304d3643fc42ee