Doesn't seem to work

We believe there’s a race condition there, but the behavior now is much improved (I just did about 30 switches without a fail).

When you do the switch, you should see the LED on the imp flick red for a fraction of a second. Do you see this?

Eric just added some log messages that’ll show more details about your imps state, which are both useful to you and also will help us debug issues like this :slight_smile:

The imp in in the basement and my computer is on the first floor so I didn’t see the LED. I just hit run on hello world and it changed from temperature to hello world. I then changed the planner back to temperature sensor and it is now stuck on hello world both in the planner and from the run button on the temperature sensor code page. I didn’t get any log messages, are they on your end?

Update: a few minutes later I hit the run button on temperature sensor and it changed from hello world to temperature sensor. There seems to be a delay ?

2nd update: The 2nd attempt to switch also had a few minute delay

If you force a refresh of the webpage, does it appear instantly?

The log messages appear in your log window and show when the device boots and configures. When you press play you should see it reloading the code, like this:

Wednesday, October 17, 2012 21:03:05: Device booting
Wednesday, October 17, 2012 21:03:05: Device configured to be “Digits 6”

Hugo,
I’m getting some logging messages and I thought it might help if I posted them. This log capture was done at 11:15 am EDT. You can see that the last entry is “06:16:33: Power state: online=>offline” I have not phyically touched the device since last night. I just clicked the run button on Hello World code edit and got an error code “line 0: impee offline” I did not do enything to the imp, planner or code page between 6:07 am and 11:15 am. I don’t know why it went offline at 6:16 am
Thursday, October 18, 2012 06:03:33: 81.3 F Thursday, October 18, 2012 06:03:38: 81.7 F Thursday, October 18, 2012 06:03:43: 81.3 F Thursday, October 18, 2012 06:03:48: 81.7 F Thursday, October 18, 2012 06:03:48: Device booting Thursday, October 18, 2012 06:03:48: Device configured to be "First Program" Thursday, October 18, 2012 06:03:48: Hello Ian! Thursday, October 18, 2012 06:03:48: 0c2a690003bb Thursday, October 18, 2012 06:04:46: Device booting Thursday, October 18, 2012 06:04:47: Started Thursday, October 18, 2012 06:04:47: Device configured to be "Temperature Logger" Thursday, October 18, 2012 06:04:47: 81.3 F Thursday, October 18, 2012 06:04:52: 81.5 F Thursday, October 18, 2012 06:04:57: 81.3 F Thursday, October 18, 2012 06:05:02: 81.3 F Thursday, October 18, 2012 06:05:07: 81.3 F Thursday, October 18, 2012 06:05:12: 81.3 F Thursday, October 18, 2012 06:05:17: 81.5 F Thursday, October 18, 2012 06:05:22: 81.9 F Thursday, October 18, 2012 06:05:27: 81.7 F Thursday, October 18, 2012 06:05:32: 81.3 F Thursday, October 18, 2012 06:05:37: 81.7 F Thursday, October 18, 2012 06:05:42: 81.7 F Thursday, October 18, 2012 06:05:47: 81.5 F Thursday, October 18, 2012 06:05:52: 81.7 F Thursday, October 18, 2012 06:05:57: 81.5 F Thursday, October 18, 2012 06:06:02: 81.7 F Thursday, October 18, 2012 06:06:05: Started Thursday, October 18, 2012 06:06:05: Device configured to be "Temperature Logger" Thursday, October 18, 2012 06:06:05: 81.5 F Thursday, October 18, 2012 06:06:05: Device booting Thursday, October 18, 2012 06:06:40: 81.7 F Thursday, October 18, 2012 06:07:09: 81.3 F Thursday, October 18, 2012 06:07:17: 81.5 F Thursday, October 18, 2012 06:07:22: 81.7 F Thursday, October 18, 2012 06:07:23: Power state: online=>offline Thursday, October 18, 2012 06:07:24: Power state: offline=>online Thursday, October 18, 2012 06:07:26: 81.5 F Thursday, October 18, 2012 06:07:30: Device booting Thursday, October 18, 2012 06:07:31: Device configured to be "First Program" Thursday, October 18, 2012 06:07:31: Hello Ian! Thursday, October 18, 2012 06:07:31: 0c2a690003bb Thursday, October 18, 2012 06:16:33: Power state: online=>offline

The time period there is 9 minutes, which happens to be our ping interval. What this means is that your device has been pinged by the server to check the connection is still up, and it didn’t get a reply and so closed the server side.

You likely have a shorter NAT timeout than 9 minutes. You can work around this by doing a timed server.log, eg:

function watchdog() {
imp.wakeup(60,watchdog);
server.log(“watchdog”);
}

watchdog();

…but we will be attempting to auto-adjust the ping timer to work out your NAT timeout remotely.

Do you know what your NAT timeout is? On some routers it’s configurable.

DD-WRT set to the default of TCP 3600 seconds and UDP 120 seconds!

Most perplexing. Does the watchdog code I posted help at all, or not? If it does help, how long does it log for?

I left the temperature logger running over night and it went off line at 05:06 am EDT. I didn’t put the watchdog code in, I’ll do that now. The imp is still flashing green and shows up in the router dhcp list.
I had selected the temperature sensor in the planner while the imp was offline last night. I power cycled the imp at 11:09 pm. It started up and logged every 5 seconds then left it alone until I looked at it a about 6:15 am this morning:
Here is the start and end of the log:
Thursday, October 18, 2012 23:09:55: Power state: offline=>online Thursday, October 18, 2012 23:09:55: Device booting Thursday, October 18, 2012 23:09:56: Started Thursday, October 18, 2012 23:09:56: Device configured to be "Temperature Logger" Thursday, October 18, 2012 23:09:56: 77.9 F Thursday, October 18, 2012 23:10:01: 77.7 F

Friday, October 19, 2012 05:06:04: show: 76.3 F Friday, October 19, 2012 05:06:08: 76.3 F Friday, October 19, 2012 05:06:08: show: 76.3 F Friday, October 19, 2012 05:06:13: 76.3 F Friday, October 19, 2012 05:06:13: show: 76.3 F Friday, October 19, 2012 05:06:16: Power state: online=>offline

I had the same thing happen to me this morning at 5:05:16 Eastern Time using my Modbus Master code. The code polls 3 separate registers on a Modbus slave every half second - interestingly the server received (or reported out of order) one poll after the imp had gone offline.

Friday, October 19, 2012 05:06:16: Percent Current = 200.00% Enunciated Amps = 16.000 State = 7 Friday, October 19, 2012 05:06:16: Percent Current = 200.00% Enunciated Amps = 16.000 State = 7 Friday, October 19, 2012 05:06:16: Power state: online=>offline Friday, October 19, 2012 05:06:17: Percent Current = 200.00% Enunciated Amps = 16.000 State = 7

It appears there may be some issue with the imp cloud as well now… My imps’ status LED show they are connecting but they are not properly running their code (for instance the LED on my Hannah board is not lighting up and trying to HTTP post commands into my Modbus device is not working either) So for now my devices aren’t working :frowning:

And just like that everything is working again. I happened to see the LED on my Hannah magically come back to life and now everything is working perfectly. I didn’t have the planner pulled up at the time so I don’t have a log entry to know what time exactly but it was around 8:40 Eastern.

I see that mine started up again without my doing anything:
Friday, October 19, 2012 08:32:00: 80.4 F Friday, October 19, 2012 08:32:05: 80.4 F Friday, October 19, 2012 08:32:11: 80.4 F Friday, October 19, 2012 08:32:15: 80.8 F Friday, October 19, 2012 08:32:20: 80.8 F Friday, October 19, 2012 08:32:25: 80.4 F Friday, October 19, 2012 08:32:34: 80.4 F