History of sent commands

ezequiel3 years ago

Hi, I have a question. Is there a way to see the history of sent commands?
The commands received are shown in the events section.
I want to do the same, but for the sent commands.

Thanks!

Anton Tananaev3 years ago

You can see it in the server logs.

Christian3 years ago

I modified the source code of the CommandResource to create an event, when a request for a command was received. I only allow saved commands and it's no proof, that a command is actually sent to a device.

Event event = new Event(Event.TYPE_COMMAND, entity.getDeviceId());
LinkedHashMap<String, Object> payload = new LinkedHashMap<String, Object>(entity.getAttributes());
        
event.set(Event.KEY_TYPE, Context.getCommandsManager().getById(entity.getId()).getType());
event.getAttributes().put(Event.KEY_PAYLOAD, payload);
Context.getNotificationManager().updateEvent(event, null);