aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/api/resource/CommandResource.java6
-rwxr-xr-xtools/test-commands.py4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/api/resource/CommandResource.java b/src/main/java/org/traccar/api/resource/CommandResource.java
index 7ba1ee2b4..b69d4d9ac 100644
--- a/src/main/java/org/traccar/api/resource/CommandResource.java
+++ b/src/main/java/org/traccar/api/resource/CommandResource.java
@@ -28,6 +28,7 @@ import org.traccar.model.Command;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.Position;
+import org.traccar.model.QueuedCommand;
import org.traccar.model.Typed;
import org.traccar.model.User;
import org.traccar.model.UserRestrictions;
@@ -121,8 +122,9 @@ public class CommandResource extends ExtendedObjectResource<Command> {
permissionsService.checkPermission(Group.class, getUserId(), groupId);
var devices = DeviceUtil.getAccessibleDevices(storage, getUserId(), List.of(), List.of(groupId));
for (Device device : devices) {
- entity.setDeviceId(device.getId());
- result = result && commandsManager.sendCommand(entity);
+ Command command = QueuedCommand.fromCommand(entity).toCommand();
+ command.setDeviceId(device.getId());
+ result = result && commandsManager.sendCommand(command);
}
} else {
permissionsService.checkPermission(Device.class, getUserId(), entity.getDeviceId());
diff --git a/tools/test-commands.py b/tools/test-commands.py
index 6e310051a..7efd963b4 100755
--- a/tools/test-commands.py
+++ b/tools/test-commands.py
@@ -6,9 +6,9 @@ import binascii
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 5001))
#s.send(binascii.unhexlify('68680f0504035889905831401700df1a00000d0a'))
-s.send("imei:123456789012345,tracker,151030080103,,F,000101.000,A,5443.3834,N,02512.9071,E,0.00,0;")
+s.send(b"imei:123456789012345,tracker,151030080103,,F,000101.000,A,5443.3834,N,02512.9071,E,0.00,0;")
while True:
- print s.recv(1024)
+ print(s.recv(1024))
s.close()