One of my devices shows as offline in the IDE, but both when I write code and runs it, and when I send commands from the agent to it, it works exactly as it should like if it was online. Still it continues to show as offline on the site, any idea why that is happening?
Mine does the same. It’s really not offline.
Yes, it’s not really offline. There’s a known bug in the Erlang server (which everyone is on now) which can cause devices to show in the IDE as offline.
Yes it’s happening to me on day 1 of my imp learning. Disconcerting to read: Device: xxxxxx (offline)
- Hmmmm, this is more complicated for me.
- I make a few changes in the Agent Code
- then Build and Force Restart
- the device is still (offline)
- unplug the board from USB and then plug in again
- wait for blinking red status to change to green
- I note now the Device: (Online)
- then my commands from browser “…?led=0” or “…?led=1” are accepted as expected
8)I’m working my way through https://developer.electricimp.com/gettingstarted/imp006-hello-world and changing some elements of the suggested code. And on checking my code I always receive message “Your code syntax checks out.”
If you’re saying that there are intentional syntax errors in your code and the syntax checker is missing them, that’s an issue. Otherwise your code look good — though may not run due to non-syntax errors, of course.
Re. the offline/online thing, are you on cellular? Depending on the network you’re actually connected to at any given time and location, your device may go on and offline. impCentral checks periodically so there will be a lag if it’s registering a device as online and you yank the power.
In a real application, you might use server.isconnected() in your device code to check status; the equivalent call on the agent is device.isconnected() (use device.onconnect() and device.ondisconnect() to register callbacks for notifications on device connection state). These operate almost immediately, unlike impCentral.
Thank you so much for this reply. There is no issue, unless my slow enlightenment. It confirms my hunches. In the last several days I’ve unplugged and plugged in power only from a wall wart. Success, improved enlightenment. I’ve just read about server.isconnected() in your device code to check status; the equivalent call on the agent is device.isconnected() so as a newbie I’m slowly climbing the learning curve. Onwards.