Sending commands to groups of devices 5.7

Track-trace2a year ago

Today i did test sending commands to a group.

So far i could not make it work. let me show what i did to test it.

Installed traccar 5.7 Other (manual installation required) (clean)
made it work with mysql database.

-Added group: Tracker
-Added devices
-From device details added the devices to group tracker
-Added saved commands

Saved commands are linked to the Group.
Devices are linked to the group (see image).
Any device added to the group has now saved commands in the popup window.

From the device popup window saved commands can be sent and work.
For instance poweroff. Device shuts down.

Now All devices are online again.

Then going to settings / groups. select Group Tracker and click on the sent command button (red circle)
Then opens Settings / Command window. From the Send custom command window type poweroff and press send button.

Nothing happens, neither any entry in traccar log.

https://ibb.co/1XbrtZ6

Am i doing anything wrong ?

Anton Tananaeva year ago

What protocol do your devices use? And are you sure the format is correct?

Track-trace2a year ago

From the image popup window above we can see it are trackers that use watch protocol.

-The command poweroff is the correct command. I can send the command as saved command and it works.
-I can also send the same command through the device popup window as custom command. Then it works.
https://ibb.co/4Rxpn6f

This log output:

2023-04-18 22:03:15  INFO: [T6bc5766b: watch > 89.200.42.33] 5b53472a383830393030323330392a303030382a706f7765726f66665d
2023-04-18 22:03:17  INFO: [T6bc5766b: watch < 89.200.42.33] 5b33472a383830393030323330392a303030382a706f7765726f66665d

Doing the same through Group window and selecting send command /settings/group/1/command
and filling in the same command: poweroff
Then nothing happens and no info in the log.

Anton Tananaeva year ago

What do you see in the API request/response?

Track-trace2a year ago

When i send the command poweroff through Groups i see this payload and response:

https://ibb.co/qkXy6NY

and this response.

https://ibb.co/mSYmBfz

Track-trace2a year ago

I have removed some devices from the group. Now only 2 device are added to the group and both are online.

When i sent the command i see this in the log.

2023-04-18 23:01:19  INFO: [T51031429] id: 8809002412, command type: custom sent
2023-04-18 23:01:19  INFO: [T99e39607] id: 8809002412, command type: custom sent
2023-04-18 23:01:19  INFO: [T51031429: watch > 89.200.12.161] 5b53472a383830393030323431322a303030382a706f7765726f66665d
2023-04-18 23:01:19  INFO: [T99e39607: watch > 89.200.5.130] 5b53472a383830393030323431322a303030382a706f7765726f66665d
2023-04-18 23:01:21  INFO: [T99e39607: watch < 89.200.5.130] 5b33472a383830393030323431322a303030382a706f7765726f66665d

After the command one device shuts down.

It looks like it sends the command twice to the same device (but has different ip in the log at the same time)

Anton Tananaeva year ago

I double checked the code and it seems correct.

On the screenshots you show the payload, but not the rest of the response. Specifically the response code is the important part.

Track-trace2a year ago

Not sure what am i missing here. The screenshot shows the response for both send?groupid=1 and groups

https://ibb.co/Jv2kqCg

What do you mean with the rest of the response code that you are missing ?
Can you show me what i should send exactly.

Anton Tananaeva year ago

Open the first tab "Headers".

Track-trace2a year ago

Tested with Three devices in the Group. In traccar log you can see the command logged three times but for one device only device id: 8809002412

Four images.

https://ibb.co/nBxPXCV Group Headers
https://ibb.co/9W1Mv69 send?groupid=1 Headers
https://ibb.co/F4RvYgT response
https://ibb.co/hWYWq09 raccar log

Track-trace2a year ago

This traccar log file

https://ibb.co/hWYWq09

Anton Tananaeva year ago

Seems like some issue with device IDs, but the commands are sent, from what I can see.

Track-trace2a year ago

Yes apparently the device ID's are not correctly used for sending the group command.

https://ibb.co/jZNxTNy

Here you can clearly see in the screenshot of the log that with three devices each device get treated as device 8809002412

You can also see (based on the device IP, colors red and blue) that the the same command for device 8809002412 is also send to the ip of the other two devices. Both device numbers 8809002309 and 2503298857 also receive this command: [SG*8809002412*0008*poweroff] which is not their device id.

(according to the log).

Anton Tananaeva year ago
Track-trace2a year ago

Yes, that solved it, Thanks!