I Have has (and still have) similar issues. to help get more info I am using this to troubleshoot
In setup()
System.on(all_events, handle_all_the_events);
// ---------------------------------------------------------------------------
void handle_all_the_events(system_event_t event, int param )
// ---------------------------------------------------------------------------
{
const int maxSizeOfEventText = 59;
const int maxSizeOfEventMsg = 60;
char systemParamMsg[maxSizeOfEventMsg] = "Non defined event"; // undefined event in DeviceOS
switch (event) {
case setup_begin: // signals the device has entered setup mode
snprintf(systemParamMsg, maxSizeOfEventText, "Setup started");
break;
case setup_update: // periodic event signaling the device is still in setup mode.
snprintf(systemParamMsg, maxSizeOfEventText, "Setup busy for last %d ms", param);
break;
case setup_end: // signals setup mode was exited
snprintf(systemParamMsg, maxSizeOfEventText, "Setup ended after %d ms", param);
break;
case network_credentials: // network credentials were changed
switch(param) {
case network_credentials_added:
snprintf(systemParamMsg, maxSizeOfEventText, "Network credentials added" );
break;
case network_credentials_cleared:
snprintf(systemParamMsg, maxSizeOfEventText, "Network credentials cleared" );
break;
default:
snprintf(systemParamMsg, maxSizeOfEventText, "Unknown network_credentials event ID [%d]", event ); // unknown event so just show value
break;
}
break;
case network_status: // network connection status
switch(param) {
case network_status_powering_on:
snprintf(systemParamMsg, maxSizeOfEventText, "Network starting" );
break;
case network_status_on:
snprintf(systemParamMsg, maxSizeOfEventText, "Network on" );
break;
case network_status_powering_off:
snprintf(systemParamMsg, maxSizeOfEventText, "Network stopping" );
break;
case network_status_off:
snprintf(systemParamMsg, maxSizeOfEventText, "Network off" );
break;
case network_status_connecting:
snprintf(systemParamMsg, maxSizeOfEventText, "Network connecting" );
break;
case network_status_connected:
snprintf(systemParamMsg, maxSizeOfEventText, "Network connected" );
break;
default:
snprintf(systemParamMsg, maxSizeOfEventText, "Unknown network_status event ID [%d]", event ); // unknown event so just show value
break;
}
break;
case cloud_status: // cloud connection status
switch (param) {
case cloud_status_connecting:
snprintf(systemParamMsg, maxSizeOfEventText, "Cloud connecting" );
break;
case cloud_status_connected:
snprintf(systemParamMsg, maxSizeOfEventText, "Cloud connected" );
break;
case cloud_status_disconnecting:
snprintf(systemParamMsg, maxSizeOfEventText, "Cloud disconnecting" );
break;
case cloud_status_disconnected:
snprintf(systemParamMsg, maxSizeOfEventText, "Cloud disconnected" );
break;
default:
snprintf(systemParamMsg, maxSizeOfEventText, "Unknown cloud_status event ID [%d]", event ); // unknown event so just show value
break;
}
break;
case button_status: // button pressed or released
snprintf(systemParamMsg, maxSizeOfEventText, "Mode button pressed for %d ms", param);
break;
case firmware_update: // firmware update status
switch (param) {
case firmware_update_begin:
snprintf(systemParamMsg, maxSizeOfEventText, "F/W update started" );
break;
case firmware_update_progress:
snprintf(systemParamMsg, maxSizeOfEventText, "F/W update in progress" );
break;
case firmware_update_complete:
snprintf(systemParamMsg, maxSizeOfEventText,"F/W update done" );
break;
case firmware_update_failed:
snprintf(systemParamMsg, maxSizeOfEventText, "F/W update failed" );
break;
default:
snprintf(systemParamMsg, maxSizeOfEventText, "Unknown firmware_update event ID [%d]", event ); // unknown event so just show value
break;
}
break;
case firmware_update_pending: // notifies the application that a firmware update is available.
snprintf(systemParamMsg, maxSizeOfEventText, "Firmware update available");
break;
case reset_pending: // notifies the application that the system would like to reset
snprintf(systemParamMsg, maxSizeOfEventText, "Reset requested");
break;
case reset: // notifies that the system will reset once the application has completed handling this event
snprintf(systemParamMsg, maxSizeOfEventText, "Reset started");
tbDisconnect();
break;
case button_click: // event sent each time setup button is clicked
snprintf(systemParamMsg, maxSizeOfEventText, "Mode button clicked %d times", system_button_clicks(param) );
break;
case button_final_click: // at the end of a series of clicks.
snprintf(systemParamMsg, maxSizeOfEventText, "Mode button clicked %d times in total", system_button_clicks(param) );
break;
case time_changed: // device time changed
switch (param) {
case time_changed_manually:
snprintf(systemParamMsg, maxSizeOfEventText, "Time updated manually" );
break;
case time_changed_sync:
snprintf(systemParamMsg, maxSizeOfEventText, "Time synchronised" );
break;
default:
snprintf(systemParamMsg, maxSizeOfEventText, "Unknown time_changed event ID [%d]", event ); // unknown event so just show value
break;
}
break;
case low_battery: // low battery condition is detected
checkBattV(); // sends particle.publish immediately with battery level
break;
case out_of_memory: // out of memeory
snprintf(systemParamMsg, maxSizeOfEventText, "Out of memory : %d bytes required", param );
break;
default: // undefined event in DeviceOS
snprintf(systemParamMsg, maxSizeOfEventText, "Unknown event ID [%d]", event ); // unknown event so just show value
break;
}
Log.warn(systemParamMsg);
// special cses where the Log message needs to be shown before the next action i.e. Reset]
switch (event) {
case firmware_update_pending: // notifies the application that a firmware update is available.
gracefullReset();
break;
case reset_pending: // notifies the application that the system would like to reset
gracefullReset();
default:
break;
}
}
I haven’t found the cloud codes (17, -230 etc) yet …