To control online current ignition state it can be used request events/check_updates
http://sdk.wialon.com/wiki/en/sidebar/r … ck_updates
1. First (after login) it needs to add required units to session via request svc=events/update_units
http://sdk.wialon.com/wiki/en/sidebar/r … date_units
https://hst-api.wialon.com/wialon/ajax.html?svc=events/update_units¶ms={"mode":"add","units":[{"id":21080147,"detect":{"ignition":0,"trips":0}},{"id":21728414,"detect":{"ignition":0,"trips":0}}]}&sid=02abb0c22bb8a9cc5df633a630bcbbfb
"units" - units array where 'id' - unit's id, 'detect' - required events types, in our case only "ignition":0 and trips "trips":0, 0 means all ignition sensors, if you know that unit has only 1 ignition sensor, you can set up '0'.
If there is several ignition sensors it's better to set up sensor's id. But sure it depends on appropriate business task. For trips is always 0 ("trips":0).
It needs to specify for each units 'id' each 'detect' type.
2. After required units has been added to session, we can monitor online ignition state via request events/check_updates which can be executed for example every 2 sec or rarely , it depends on how often the device sends data to the server
https://hst-api.wialon.com/wialon/ajax.html?svc=events/check_updates¶ms={"detalization":3}&sid=023078baa1df1ea0da05cd4cbc9a02cb
"detalization":3 means that server will return JSON information for flags plus
First response
{"21080147":[{"ignition":{"1":{"from":{"t":1590045850,"y":43.79845047,"x":-99.7432632446},"to":{"t":1590046021,"y":43.79845047,"x":-99.7432632446},"m":1590046021,"f":0,"state":0,"type":1,"hours":175782,"switches":2,"value":0}}}]}
21 May 2020 07:24:10 - 21 May 2020 07:27:01 = time from / to
"state":0 - ignition is Off
So during 2 min 51 sec ignition has being Off
Next request svc=events/check_updates
Response
{} - empty answer means nothing changes as there is not yet new messages coming
new message with time 05-21-2020 07:33:36 coming, due to several second event has been recalculated
{"21080147":[{"ignition":{"1":{"from":{"t":1590045850,"y":43.79845047,"x":-99.7432632446},"to":{"t":1590046416,"y":43.79845047,"x":-99.7432632446},"m":1590046416,"f":0,"state":0,"type":1,"hours":175782,"switches":2,"value":0}}}]}
21 May 2020 07:24:10
21 May 2020 07:33:36
Ignition switched to On , new messages with time 05-21-2020 07:36:02 coming , new interval with state = 1 has been calculated
{"21080147":[{"ignition":{"1":{"from":{"t":1590046562,"y":43.79845047,"x":-99.7432632446},"to":{"t":1590046562,"y":43.79845047,"x":-99.7432632446},"m":1590046562,"f":0,"state":1,"type":1,"hours":175782,"switches":3,"value":1}}}]}
21 May 2020 07:36:02
21 May 2020 07:36:02
messages still coming with ignition On, event with state =1 recalculated with every new messages (delay can be about 1-3 sec, but if device sends data from black-box memory, the delay for recalculation can be more, even about 1 hour)
{"21080147":[{"ignition":{"1":{"from":{"t":1590046562,"y":43.79845047,"x":-99.7432632446},"to":{"t":1590046706,"y":43.79845047,"x":-99.7432632446},"m":1590046706,"f":0,"state":1,"type":1,"hours":175926,"switches":3,"value":1}}}]}
{}
{"21080147":[{"ignition":{"1":{"from":{"t":1590046562,"y":43.79845047,"x":-99.7432632446},"to":{"t":1590046767,"y":43.79845047,"x":-99.7432632446},"m":1590046767,"f":0,"state":1,"type":1,"hours":175987,"switches":3,"value":1}}}]}
{"21080147":[{"ignition":{"1":{"from":{"t":1590046562,"y":43.79845047,"x":-99.7432632446},"to":{"t":1590046777,"y":43.79845047,"x":-99.7432632446},"m":1590046777,"f":0,"state":1,"type":1,"hours":175997,"switches":3,"value":1}}}]}
So after every request events/check_updates you will get {} answer which means nothing was change or recalculation with new time or state.
On your side you can calculate difference between time from/to as duration of current state.