Events not showing in particle console

I have a few Particle Electrons and recently one of them has stopped sending events to the cloud, although the return value from Particle.Publish says the function was successful. We’re using 3rd Party SIMs although when I remove the APN credentials and replace the particle sim, there are still no events sent.

I can see on the Particle Console that the non-sending device does handshake to the server correctly, as the last handshake time is updated.

I’ve put some simple code onto two of my electrons, one which tests fine, the second one continues not to send events. code below:

    #include "application.h"

    STARTUP(cellular_credentials_set("MYAPN", "", "", NULL));  

    void setup()
    {
      Serial.begin(57600);
      delay(10000);

      Serial.println("Network checking tool v1");
      delay(1000);
      Serial.printf("Sending cloud notification\n");
      bool iReturn = Particle.publish("Device Online","Connected to the cloud");
      if (!iReturn){
        Serial.printf("Failed to publish status\n");
      }

      CellularSignal sig = Cellular.RSSI();
      Serial.print("RSSI: ");
      Serial.println(sig.rssi);
      Serial.print("Signal Quality: ");
      Serial.println(sig.qual);

      Serial.println("Network scan complete.");
    }

    void loop()
    {
      CellularSignal sig = Cellular.RSSI();
      Serial.print("RSSI: ");
      Serial.println(sig.rssi);
      Serial.print("Signal Quality: ");
      Serial.println(sig.qual);
      delay(5000);
      Serial.printf("Sending cloud notification\n");
      bool iReturn = Particle.publish("Device Online","Connected to the cloud");
      if (!iReturn){
        Serial.printf("Failed to publish status\n");
      }
      delay(5000);
    }

Any ideas?

Thanks in advance.

The return value of Particle.publish() only informs you about the successful enqueueing of the event but nothing about its delivery.
Try adding the WITH_ACK switch.

BTW, don’t use the public firehose if not needed. Rather go with PRIVATE.

That only informs you that the device made it to the cloud but not whether this was a stable connection.

You have no Particle.keepAlive() which usually is required for 3rd party SIMs.

Thanks for the feedback. We were told by the SIM company that we didn’t need to keep alive locally, but I did add a 120 second keep alive for completness. I’ve also added in the other suggestions but were still not seeing any events in the particle cloud.

I added in a particle function to test if it would be available in the Particle console. I can see the function, but when I call it, it times out.

I’ve tested these with both the particle sim (with the APN removed) and the 3rd party sim, both register the Particle function ok.

It’s strange how I have 2 electrons running identical software and firmware (0.6.1) using the same sims. One is working fine, and one is not (We had the device 6 months+ and it was fine until 3 days ago).

Updated code below.

#include "application.h"

STARTUP(cellular_credentials_set("MYAPN", "", "", NULL));  

int hello(String anything) {
  bool iReturn = Particle.publish("Hello","Device is ok",PRIVATE, WITH_ACK);
  if (!iReturn){
    Serial.printf("Failed to send Hello\n");
  }
  else
    Serial.printf("Hello ok - got ACK\n");
  return 0;
}

void setup()
{
  Serial.begin(57600);
  Particle.keepAlive(120);
  Particle.function("hello", hello);
  delay(10000);
  Serial.println("ES Network scanning tool v4");
  delay(1000);
}

void loop()
{
  CellularSignal sig = Cellular.RSSI();
  Serial.print("RSSI: ");
  Serial.println(sig.rssi);
  Serial.print("Signal Quality: ");
  Serial.println(sig.qual);
  delay(5000);
  Serial.printf("Sending cloud notification\n");
  //bool iReturn = Particle.publish("Device Online",NULL, 60, PRIVATE,WITH_ACK);
  bool iReturn = Particle.publish("Device Online","Connected to the cloud",PRIVATE, WITH_ACK);
  if (!iReturn){
    Serial.printf("Failed to publish status\n");
  }
  else
    Serial.printf("Published status ok\n");
  delay(5000);

}

Here’s the output from Putty:

I’d start with a Particle.keepAlive(10) or even 5.
Cellular.RSSI() can take some time and may well be the reason for the function call timing out too.
I’d suggest to only take the RSSI reading once a minute or even less frequently (at least to start with)

@Rincewind, I’m having the same issue with one of my Electrons and they are working on the issue, as it appears to be a cloud issue. I’ll try to post here if/when my issue is resolved. Good to know (in a weird way) someone else is having the same issue.

1 Like

@ctmorrison Thanks for the reply, I did think it was an issue relating to the cloud service, but wanted to exhaust code resolutions first. We did email Particle a few days ago, but are yet to receive a response. It would be much appreciated if you could post when your issue is resolved, hopefully we get fixed at the same time :slight_smile:

@Rincewind, it appears the issue is resolved, although I’m not in the office until next Tuesday to confirm my problematic device is functioning properly. They said the issue impacted several devices, so hopefully, yours is working now, too.

1 Like

@ctmorrison We’ve just tested our device and yes, it has been fixed. It’s sending to the cloud again, so that’s good new.

@ScruffR Thanks for trying to help with this, I’l be adding the changes for Particle.publish you suggested into our core code.