76

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

The requests events/load and events/get are used to get history events (trips, sensors, ignition , fuel thefts/fillings/consumption) which already registered in system
More - https://forum.gurtam.com/viewtopic.php? … 16#p186716

If you need to get current data, when unit is running online, you need to get use the following requests
https://sdk.wialon.com/wiki/en/sidebar/ … date_units - add units to session and specify event's detector
https://sdk.wialon.com/wiki/en/sidebar/ … ck_updates - execute request periodically to get data
See my previous answer - https://forum.gurtam.com/viewtopic.php? … 05#p183805

Diana Cheley
Wialon Hosting Expert
Gurtam
77

How to get Unit Last update date and time

(edited by trushal.shah 26/04/2021 15:59:43)

Re: How to get Unit Last update date and time

Hello

Can you help me with how I can execute this command [start engine"]?

http://localhost/wialon/ajax.html?svc=unit/exec_cmd&params={"itemId":11489,"commandName":"custom_msg","linkType":"tcp,vrt","param":"","timeout":1,"flags":0}&sid=04dfaf9bcf913b6fca84e821fb220b11

{
    "error": 5
}

"cml": {
                "1": {
                    "id": 1,
                    "n": "start engine",
                    "c": "custom_msg",
                    "l": "",
                    "p": "Juste un exemple",
                    "a": 1,
                    "f": 0
                },
                "2": {
                    "id": 2,
                    "n": "stop engine",
                    "c": "custom_msg",
                    "l": "",
                    "p": "stop engine",
                    "a": 1,
                    "f": 0
                },
                "3": {
                    "id": 3,
                    "n": "أمر جديد",
                    "c": "custom_msg",
                    "l": "tcp",
                    "p": "",
                    "a": 1,
                    "f": 0
                }
            },

78

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

When you execute command you need to pass the same parameters which original command has, like link type, commandName and etc.

In your example,
"n": "start engine" - commandName
"l": "" - link type (empty value means 'Auto')
"p": "Juste un exemple" - specified parameters

So you need to execute request unit/exec_cmd with the following parameters

"params":{"itemId":11489,"commandName":"start engine","linkType":"","param":"Juste un exemple","timeout":1,"flags":0}
Diana Cheley
Wialon Hosting Expert
Gurtam
79

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Diana wrote:

Hello!

When you execute command you need to pass the same parameters which original command has, like link type, commandName and etc.

In your example,
"n": "start engine" - commandName
"l": "" - link type (empty value means 'Auto')
"p": "Juste un exemple" - specified parameters

So you need to execute request unit/exec_cmd with the following parameters

"params":{"itemId":11489,"commandName":"start engine","linkType":"","param":"Juste un exemple","timeout":1,"flags":0}

Hi thanks for the reply if I set this with APi i am getting "

Unrecognized:JUSTE un example"

and same from penal got this message

Command 'start engine' sent to unit 'Platinum'.

params={"itemId":11489,"commandName":"start engine","linkType":"","param":"TawasolMap","timeout":1,"flags":0}&sid=09fff31a9820105727644773ba146a80

80

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hi!

The device send this response to your command as I see on your screenshot, because there is not correct parameter 'Juste un exemple' for command. You need to send command (create command before for unit) with correct parameter for certain command. Please look to device's manual or request to manufacturer  which parameters are correct for this command type.
Maybe here on forum - https://forum.gurtam.com/viewforum.php?id=18  you can find helpful information

Diana Cheley
Wialon Hosting Expert
Gurtam
81

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hi,

Thanks for the reply now it's working for us

I just want to know how I can display Map on the report please check below API request

{svc=report/export_result, params={"format":2,"pageOrientation":"portrait","pageSize":"a4","pageWidth":0,"coding":"utf8","delimiter":"semicolon","headings":0,"compress":0,"attachMap":1,"extendBounds":0,"hideMapBasis":0,"outputFileName":"eabdalmnem_30-04-2021"}, sid=d628a7f4e54b4cb31c928154b234cbb8}

I had reviewed with hideMapBasis hide map layer: 0 - no, 1 - yes

"extendBounds":0
"hideMapBasis":1

"extendBounds":1
"hideMapBasis":1

"extendBounds":1
"hideMapBasis":0

extendBounds=0
hideMapBasis=0

Please find both files different only is right of the screenshot with map and left is without map.

82

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello

I need your 2 bits of help

1. Above request how to display Map background on the report

2. How to get sensor engine operation value in the check_updates API

From search_item API we got all sens value check_updates API

"sens": {
                "1": {
                    "id": 1,
                    "n": "حالة المحرك",
                    "t": "engine operation",
                    "d": "",
                    "m": "On/Off",
                    "p": "adc1",
                    "f": 0,
                    "c": "{\"act\":0,\"appear_in_popup\":true,\"ci\":{},\"mu\":0,\"pos\":1,\"show_time\":false,\"timeout\":0,\"uct\":0,\"unbound_code\":\"\",\"validate_driver_unbound\":0,\"consumption\":2}",
                    "vt": 1,
                    "vs": 0,
                    "tbl": []
                },
                "2": {
                    "id": 2,
                    "n": "الكهرب",
                    "t": "voltage",
                    "d": "",
                    "m": "V",
                    "p": "pwr_int",
                    "f": 0,
                    "c": "{\"act\":1,\"appear_in_popup\":true,\"ci\":{},\"cm\":0,\"mu\":\"0\",\"pos\":2,\"show_time\":false,\"timeout\":0,\"uct\":0}",
                    "vt": 1,
                    "vs": 0,
                    "tbl": []
                }


I am looking for same value from update_unit API how i can get, i do get but I got a second sensor not first


svc=events/update_units&params={"mode":"add","units":[{"id":11489,"detect":{"sensors":0}}]}&sid=c0816af7dfa8862ae026cf4a1499f2d8


svc=events/check_updates&params={"detalization":3}&sid=9e0f2c649220ff65229c68a56de69f3e


"11489": [
        {
            "sensors": {
                "2": {
                    "from": {
                        "t": 1615747447,
                        "y": 24.7718658447,
                        "x": 46.633014679
                    },
                    "to": {
                        "t": 1620026997,
                        "y": 24.7718448639,
                        "x": 46.6330413818
                    },
                    "m": 1620026997,
                    "f": 0,
                    "type": 4,
                    "value": 4.141
                }
            }
        }
    ]
}

83

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

1. If you need to attach map to the exported PDF file, you need to pass parameter "attachMap":1, "hideMapBasis":0

"hideMapBasis":1 means tracks and markers are shown on the blank background
"extendBounds":1 means option Squeeze in all graphics

For example, parameters for request  report/export_result

{"compress":0,"attachMap":1,"hideGoogleLinks":0,"extendBounds":0,"hideMapBasis":0,"pageOrientation":"landscap","pageSize":"a4","pageWidth":"0","coding":"utf8","delimiter":"semicolon","headings":1,"outputFileName":"Volvo_awesome_!gtest_Eco_driving_03-05-2021_14-38-20","format":2}

2.The sensor engine operation is not included to 'sensors' event detector.  To get data from this sensor type you need to get event type 'ignition'
So instead detector 'sensors' in request events/update_units just add detect 'ignition' - "detect":{"ignition":0} or "detect":{"ignition":1} as you already know the sensor id.

Diana Cheley
Wialon Hosting Expert
Gurtam