Why its stop sync after period?

Could someone pls help me ?

   var  started = false;
   sync.setSyncPeriod('2 min');
   
   function turnOnLED(){
    io.led(true);
    timers.single(3000, () => {
        io.led(false);
    });
}

    io.press(() => {
 
        if (started === false) {
           turnOnLED()

  location.startUpdates((position) => {
                cloud.enqueue('position-change', position);
              
            }, {minInterval: 60 /* s */, minDistance: 0/* m */, timeout: 0 /* s */});
            
            started = true;
            print("started");
            cloud.enqueue("status", {'started':true},{});
           sync.now();
            
        } else {
            location.stop();
            sync.now();
            started = false;
            print("stoped");
        }
    }) 
    
  sensors.accel.onMotion((inMotion) => {
    if(inMotion && started === true) {
     turnOnLED();
     sync.now();
    }
})

Its work few times and then sync stopped ,did i do somhing wrong ?

Hi there,

the .setSyncPeriod method sets the max sync period after the last sync, regardless of whether it was trigger by sync.now().

In practice, this means that if a sync is triggered by sync.now(), the automatic sync set by .setSyncPeriod will be postponed by the pre-defined period, which in your case is 2 minutes.

We generally advise against using sync.now() together with cloud.enqueue, as it makes battery life management difficult.

1 Like

Hi Timo ,tq i try remove sync.now() and test

sorry but this anyway stop work after period
5:41 total “total”: 40,
6:03 :“total”: 63,
6:31 total": 63,

You may set sync period to 2 minutes and it will sync every 2 minutes, but if there is no data enqueued then nothing will be delivered and shown in the cloud console.
There are two places where events are enqueued:

  • on button press
  • on GNSS position update

First one only enqueues one event. Second will generate event every minute, but only if it is able to locate itself using GNSS satellites (see here and here). If you are indoors you will get no position updates. Be sure that you are running your microApp outdoors and sky is not obstructed by any object.
You may add a function that will blink one of the LEDs with different color to signal that position has been obtained.

1 Like

Hi Pober, could you please say how i can sync each 2 minute ?
timers.repeat(‘2 min’, someCallback) not sync each 2 minute as well

Calling sync.setSyncPeriod('2 min'); should be enough to get sync every 2 minutes.
You did not provide any code for someCallback function so I cannot tell why it is not working.
If your beacon is low on battery synchronization through LTE might be not possible, however when connected though WebIDE it should still work (you can read more about it here). When you are testing synchronization
are you connected to WebIDE?
Why do you think it is not synchronizing? It is not sending events? Synchronization will have no visible effect when there is no data to be sent (there was no cloud.enqueue since last sync). Your code in the first post suggests that such scenario is possible when there is no GNSS fix.
Have you checked if location.startUpdates is providing position (tested outdoors)?
You may try to this snippet to generate dummy event every 30 seconds, so you can see events in Cloud Event Log:

sync.setSyncPeriod('2 min');
var cnt = 0;
timers.repeat('30s', () => {
  cloud.enqueue('test', { cnt: cnt++})
})

I would also be good to know what firmware version your LTE Beacon is running on to rule out some already fixed problems.

1 Like

Thank you for answer i will test
I think its not sync coz i not see any updates on rest point
Yes i connect IDE via bluetooth ,and not i still not tested outdoor :frowning:

Hardware Revision
LTE_A1.1
Firmware Version
0.1.10

I tested and stop work after 250
“meta”: {
“page”: 1,
“total”: 251,
“type”: “test”,
“app_release”: [],
}

After I connected via Bluetooth again, missed events synced via clouds

“page”: 1,
"total": 416,
“type”: “test”,

Could you please say how i can sync without connection via bluetooth each time ? d

It should work automatically but I think that you might not have LTE-M coverage and modem is not able to send data. Try to enable GSM by:

modem.setTech(modem.Tech.GSM_LTE);

This function is undocumented and experimental and may be changed or removed in future releases.

1 Like

Many thanks i will try

Hi there , Im sorry but anyway its stopped after period

“meta”: {
“page”: 1,
“total”: 74,
“type”: “last”,
“app_id”: “UrhgGXyp8N”,
“app_release”: [],
“until”: 1578660068267
}

So you was disconnected from WebIDE and it was working using cellular modem and then it stopped?
Or you were still connected via WebIDE and it stopped? Was Bluetooth link still active (side LEDs pulsating)?
LTE Beacon sends data through Bluetooth when you are connected to it to save on power and data plan (you can read about it here). So if you want to test cellular connectivity you have to disconnect from WebIDE.

Hi Pober
what i did

  1. .i go to iot appplications and select one application https://cloud.estimote.com/#/iot_apps/UrhgGXyp8N
  2. then i press connecti via bluetootn
  3. then i press compile and send

I will check about LED`s pulsating , battery
94% (charging)

Hi i tested and side lighting pulsating ,but anyway stoped
“page”: 1,
“total”: 102,
“type”: “l7st”,
“app_id”: “UrhgGXyp8N”,
“app_release”: [],
“until”: 1578673966830

Hi there , look its like start working :partying_face:

pober ,Timo
guys thx for help m,its works !