Send command (block) by notification v5.8

Trackera year ago

Greetings,
Is there something to prevent the use of the command sending function via notification? Example to block when leaving the geofence with the Command options of the xml? The user has permission but not blocking all devices. Grateful!

Anton Tananaeva year ago

What troubleshooting have you done? Please provide more details.

Trackera year ago

To block the vehicle when leaving the geofence, I did the following: I created a saved command like turn off the engine, created a notification that left the geofence, and associated it with the blocking command as well as with the device in question. I was successful for some devices like TK coban 311, BMS-1(GT06), but for the J16 I was not successful. I even created a custom command, I associated it but it doesn't block, looking at the log in real time I see the command (engineStop) being sent but it doesn't block. Thanks

Anton Tananaeva year ago

If you see that the command is sent and the format is correct, but it still doesn't work, that probably indicates a device issue.

Trackera year ago

The curious thing is that if you send the command without using the notification trigger, the device is blocked normally.

Description text

Anton Tananaeva year ago

It could be that the device doesn't like the order of the messages.

Trackera year ago

yes, it is a possibility. Is there any difference in the logic of direct sending and sending via notification trigger?

Anton Tananaeva year ago

What kind of logic are you thinking about?

Trackera year ago

What would that order be?
"The device may not like the order of the messages."

I speak here on this point.

@Singleton
public class NotificatorCommand implements Notificator {

    private final Storage storage;
    private final CommandsManager commandsManager;

    @Inject
    public NotificatorCommand(Storage storage, CommandsManager commandsManager) {
        this.storage = storage;
        this.commandsManager = commandsManager;
    }

    @Override
    public void send(<b>Notification notification, User user, Event event, Position position</b>) throws MessageException {

        if (notification == null || notification.getCommandId() <= 0) {
            throw new MessageException("Saved command not provided");
        }

        try {
            Command command = storage.getObject(Command.class, new Request(
                    new Columns.All(), new Condition.Equals("id", notification.getCommandId())));
            command.setDeviceId(event.getDeviceId());
            commandsManager.sendCommand(command);
        } catch (Exception e) {
            throw new MessageException(e);
        }
    }
Anton Tananaeva year ago

I'm talking about timing, not logic.

Trackera year ago

I see an error in my mysql table and also that the command was Stop was sent and then Resume was sent, would it be something for not validating the conditions for blocking and for security send Resume?

Description text

Description text

Trackera year ago

What is the use of this tc_commands_que table that I see that it is being populated?

Trackera year ago

Regards Anton,

The block command sent via the notification trigger does not appear to be the same as when sent with the block command alone.

Command sent by notification/fence

2023-07-25 12:32:08  INFO: [Te192af86] id: 868022033191631, command type: engineStop sent
2023-07-25 12:32:09  INFO: [Te192af86] id: 868022033191631, time: 2023-07-25 12:32:07, lat: -24.24002, lon: -46.89008, speed: 12.4, course: 57.0
2023-07-25 12:32:09  INFO: [Te192af86: gt06 > 200.169.127.1] 787805120150e9f90d0a
2023-07-25 12:32:09  INFO: [Te192af86: gt06 > 200.169.127.1] 787812800c0000000052656c61792c312300009dee0d0a

Command sent by lock button

2023-07-25 12:41:58  INFO: [Te192af86] id: 868022033191631, command type: engineStop sent
2023-07-25 12:41:58  INFO: [Te192af86: gt06 > 200.169.127.1] 787812800c0000000052656c61792c312300009dee0d0a
2023-07-25 12:41:58  INFO: [Te192af86: gt06 < 200.169.127.1] 787816150e0000000052454c41592031204f4b00010196ba4c0d0a
2023-07-25 12:41:58  INFO: [Te192af86] id: 868022033191631, time: 2023-07-25 12:41:47, lat: -24.24043, lon: -46.89113, course: 15.0, result: RELAY 1 OK
Anton Tananaeva year ago

Looks the same to me:

787812800c0000000052656c61792c312300009dee0d0a
Trackera year ago

the device response?
I'm at a loss for this problem, I can't understand why it doesn't block and the device doesn't respond to the command through the fence. Is there any alternative I could follow? Thanks