1

Get route associated with a unit

Topic: Get route associated with a unit

Hello,

I was trying a lot different options to get to which route is associated with a unit, but I can not find a way to solve my problem.
Can someone guide me please?

My goal is to know when a unit belongs to the 2DIR route or to route 3-1 (of somes routes, we have six routes), as seen in the image.

https://forum.gurtam.com/misc.php?action=pun_attachment&item=8859&download=0

-------
I've tried the Nimbus API, but I can not get the unit associated with a route.

I'm testing the remote API in different ways and I can not get it either, now I'm trying this way:


data = {
     "spec": {
         "itemsType": "avl_unit",
         "propValueMask": "*",
         "propName": "sys_name",
         "sortType": "sys_name"
     },
         "force": 1,
         "flags": 1 | 65536,
         "from": 0,
         "to": 0
}

Based on the recommendation of another post https://forum.gurtam.com/viewtopic.php?id=5390
But it's not working.

Any advice will be welcome
Thank you

2

Get route associated with a unit

Re: Get route associated with a unit

There is two different ways to get unit bindings:

1. If you need to keep information about bindings in actual state you can use MQTT. In this case you get information about unit position (
no more than once a minute) and also ID of current route. You will recieve new messages immediately.

2. If you need to get bindings for example once per 5 minutes you can request rides by NimBus API (https://sdk.wialon.com/products/nimbus/ … _id__rides). Filter active ones. Ride contains info about unit assigned on it and also about timetable. And after it you should go through all routes and check wich one contains this timetable.

Also if you describe what kind of information you whanted to get, possibly we could add some extra request to our API. For example getting actual units of pointed route.

Development Department
Gurtam
3

Get route associated with a unit

(edited by gustavodbs 21/01/2019 15:35:54)

Re: Get route associated with a unit

Thank you very much for you help! Now I will try to associate the routes with the rides endpoint.

Regarding the MQTT, is its use free? I was seeing the example of github, but it is to connect with flespi.io and it has a cost, my client only has hired the wialon hosting service.

The objective we have is the following:
1 - Show in an application the position of the units
2 -View routes and stops
3 - Filter the units that are associated with the routes or stops.
4 - Obtain the estimated time of arrival of a unit, to a stop

So far we were able to show the units in real time (point 1) and only visualize the routes (point 2), but not the relationship between units and routes/stops.

Currently my server is making a query to the positions of the units every 5 seconds and the application is connected to my server through websocket.

https://forum.gurtam.com/misc.php?action=pun_attachment&item=8860&download=0

Attached examples of the application that consumed the processed data


zuve wrote:

There is two different ways to get unit bindings:

1. If you need to keep information about bindings in actual state you can use MQTT. In this case you get information about unit position (
no more than once a minute) and also ID of current route. You will recieve new messages immediately.

2. If you need to get bindings for example once per 5 minutes you can request rides by NimBus API (https://sdk.wialon.com/products/nimbus/ … _id__rides). Filter active ones. Ride contains info about unit assigned on it and also about timetable. And after it you should go through all routes and check wich one contains this timetable.

Also if you describe what kind of information you whanted to get, possibly we could add some extra request to our API. For example getting actual units of pointed route.

4

Get route associated with a unit

(edited by zuve 21/01/2019 16:30:09)

Re: Get route associated with a unit

Regarding the MQTT, is its use free? I was seeing the example of github, but it is to connect with flespi.io and it has a cost, my client only has hired the wialon hosting service.

For NimBus locator we generate special flespi token. It's free and only for reading. You can get it from browser console by typing APP_CONFIG.flespi_token in locator app. To start getting messages you should subscribe on topic nimbus/locator/{locator_hash}/#. Locator hash you can get from locator link or APP_CONFIG.

Development Department
Gurtam
5

Get route associated with a unit

Re: Get route associated with a unit

zuve wrote:

Regarding the MQTT, is its use free? I was seeing the example of github, but it is to connect with flespi.io and it has a cost, my client only has hired the wialon hosting service.

For NimBus locator we generate special flespi token. It's free and only for reading. You can get it from browser console by typing APP_CONFIG.flespi_token in locator app. To start getting messages you should subscribe on topic nimbus/locator/{locator_hash}/#. Locator hash you can get from locator link or APP_CONFIG.


Thank you! I have been able to connect to the MQTT and I will definitely change the query every 5 seconds, by this connection to obtain the position of the units.

I have obtained the following response:
https://forum.gurtam.com/misc.php?action=pun_attachment&item=8863&download=0

I assume that the "tt" key would be the TimeTable and need to iterate through the routes' timetables?


Would there be any documentation on the use of Locator and MQTT? Or is only the channel "nimbus / locator / {locator_hash} / #." enabled?

6

Get route associated with a unit

(edited by zuve 21/01/2019 17:13:14)

Re: Get route associated with a unit

Sorry, forget to explain. The profit from using MQTT is that you shouldn't iterate route timetables anymore. Attribute 'r' contains route ID.

Development Department
Gurtam
7

Get route associated with a unit

Re: Get route associated with a unit

zuve wrote:

Sorry, forget to explain. The profit from using MQTT is that you shouldn't iterate route timetables anymore. Attribute 'r' contains route ID.

Awesome, thank you very much!!
With this I have solved the problem.

One last question, is there any way to get the waiting time or the distance between a unit and a stop from the API?
If this is not possible, I will simply obtain the distance of the current position of the unit and the point of the stop.

8

Get route associated with a unit

Re: Get route associated with a unit

Would there be any documentation on the use of Locator and MQTT? Or is only the channel "nimbus / locator / {locator_hash} / #." enabled?

For now we have no plans to describe usage of MQTT with Locator. It's quite internal thing, so we can't guarantee that data format doesn't change.
And yes, with such token you has access only to nimbus/locator/{locator_hash}/# channel.

One last question, is there any way to get the waiting time or the distance between a unit and a stop from the API?

At the moment there is no such endpoint. But may be we will make it in future.

Development Department
Gurtam
9

Get route associated with a unit

Re: Get route associated with a unit

zuve wrote:

Would there be any documentation on the use of Locator and MQTT? Or is only the channel "nimbus / locator / {locator_hash} / #." enabled?

For now we have no plans to describe usage of MQTT with Locator. It's quite internal thing, so we can't guarantee that data format doesn't change.
And yes, with such token you has access only to nimbus/locator/{locator_hash}/# channel.

One last question, is there any way to get the waiting time or the distance between a unit and a stop from the API?

At the moment there is no such endpoint. But may be we will make it in future.

I understand
Thank you very much for the help! My problem is solved

Thank you,
regards!