KeepAlive does not work on electron V 0.6.2 (SEMI_AUTOMATIC)

I was publishing message using Particle.publish command that repeat every 40 sec and was running successfully and message appear in Event Log without any message drop, after increase the publish time interval to 60 sec, It drops messages randomly but in most cases a message appear in Event log every 3 minutes in most cases and 2 minutes in rare cases.

I add some functions to code to investigate and figure problem plus adding solution found in other thread.

I first add

void setup()
{
Particle.keepAlive(20);
}

and did not solve the solution and I did not found "device came online" packet in Event log every 20 sec as programmed ("device came online" appear in Event log randomly) , then adding

void loop() {
Particle.process();

and also did not solve publish message or send "device came online" packet.

So I add check if publish successfully send message and so I add WITH_ACK flag.

temp = Particle.publish("Message", message,PRIVATE,WITH_ACK);
if (!temp) {
// get here if event publish did not work
#ifdef SERIAL_DEBUG
Serial.printlnf( "Error sending Message" );
#endif
}

and I found that some message packet did not appear in Event Log and error message appear in serial monitor terminal.

the Electron Version is v 0.6.2 with SYSTEM_MODE(SEMI_AUTOMATIC);

With SEMI_AUTOMATIC you have to call Particle.connect() to establish a connection - I can’t see you doing that anywhere.

With SEMI_AUTOMATIC you have to call Particle.connect() to establish a connection - I can't see you doing that anywhere.

Thanks SrcuffR, I already use Particle.connect(), as I describe I could get messages correctly with Event Log with interval 40 sec, for interval 1 minute and more, I could not get messages correctly some of them drops. So I used KeepAlive(20) to keep me connected to cloud. even the led is working normally and breath blue.

If you can post a running short example that exhibits this issue we might better be able to assist - your snippets above obviously paint an incomplete picture.

3 Likes