1

Unit mileage for specific timestamp

Тема: Unit mileage for specific timestamp

Hi everyone
I need to get mileage for unit but not last value like with the unit.getmileage() function, i would like to know the value for a specific timestamp like 3days ago at 3pm for exemple. I don't want to use report regarding to the time of execution so is there a way to get it? I was thinking about getting messages for the periode, but we have units with Gps mileage so i think i need the wialon computed value of the mileage..
thanks

2

Unit mileage for specific timestamp

Re: Unit mileage for specific timestamp

janus пишет:

Hi everyone
I need to get mileage for unit but not last value like with the unit.getmileage() function, i would like to know the value for a specific timestamp like 3days ago at 3pm for exemple. I don't want to use report regarding to the time of execution so is there a way to get it? I was thinking about getting messages for the periode, but we have units with Gps mileage so i think i need the wialon computed value of the mileage..
thanks

Good afternoon!

It's possible to get mileage counter values for a specific time with events/load request.

Example with getting all counters values for time range below:

svc=events/load&params = {"itemId": 111111,
                  "ivalType": 1,
                  "timeFrom": 1594291890,
                  "timeTo": 1594293890,
                  "detectors": [
                      {
                          "type": "counters",
                          "filter1": 0
                      }
                  ],
                  "selector": {
                          "type": "counters",
                          "timeFrom": 1594291890,
                          "timeTo": 1594293890,
                          "detalization": 0x3
                      },
                  }

In response mileage counters values list will be in the field "selector" -> "counters" -> "0" with name "mileage"

3

Unit mileage for specific timestamp

Re: Unit mileage for specific timestamp

Thank you so much muev  for the speed and clarity of your reply.
I saw the events/load request but didn't know how to use it.
thanks again
have a good day

4

Unit mileage for specific timestamp

Re: Unit mileage for specific timestamp

Hi again
Is someone knows the javascript Api equivalent of events/load request and its use ?
Thanks

5

Unit mileage for specific timestamp

Re: Unit mileage for specific timestamp

janus пишет:

Hi again
Is someone knows the javascript Api equivalent of events/load request and its use ?
Thanks

Hello!

There is not method in JS API. You can use the following method remoteCall to execute any other http request to server (svc command)

the function  format is following : wialon.core.Remote.getInstance().remoteCall(svc_command, params, callback)
svc_command - the name of API command
params - the params of required svc_command
callback - function which executed for other action.

Here you can find the example where this method is used for 'events/check_updates' , but you can use it also to revoke events/load (You can use your user's token to run example)

Diana Cheley
Wialon Hosting Expert
Gurtam