Taking pictures every 2 minutes

Taking pictures every 2 minutes depending on input signals from the device.

This guide explains how to take pictures every 2 minutes with Meitrack MVT600 device taking into account input signals from the device.


In order to complete this task successfully it will be needed:

  • A Meitrack device with supported camera connected.
  • Camera plugin installed
  • The interval time for the message updates from the device has to be shorter than the take picture action (less than 2 minutes for this example)

Creating the Event Rule

1. Enable Script Expressions.

2. Create an Event Rule:  On step 4. Expressions select Script Expression.

3. Add the following script: 

var INTERVAL = 120000; // miliseconds for 2 min
if (!context.state) {
    // "active" first time (no set state)
      context.setState(new Date().getTime());
    return true;
else {
    // not first time, since there is stuff in state
    var oldDate = new Date(context.state);
    var now = new Date();
    var diffMilis = now.getTime() - oldDate.getTime();
    if (diffMilis < INTERVAL) {
      // interval didn't pass yet
      return false;
    else {
      // interval passed, trigger again, set new time reference
      return true;

Regarding the variables that we want to take into account, we can add them as complementary expressions.


4. Insert an End expression, so the rule is not kept true. Use an expression that will always be true while the rule is active like might be speed greater or equal than 0.


5. Set up the command notification on step 5. Notifications. After selecting Command from the drop-down list, another drop-down list will be displayed with the available commands.

6. Select the _TakeOnePicture command:


_TakeOnePicture does not download the picture taken which makes the command quicker but the pictures have to be downloaded later on.

7. Don't select 6. Presentation and click Next to save your rule.

Downloading the pictures

To download the pictures taken, look for the Commands panel located by default under the map on the application:


The command that should be used to retrieve the pictures taken should be _TryGetAllPictures displayed on the picture above.