Openremote Fleetmanagement - send to device not working

Hey, I need some advice because the “send to device” command isn’t working for me. The following message appears:

INFO    [ContainerExecutor-8208        ] atics.teltonika.TeltonikaMQTTHandler.API : Device 864275077662552 is not subscribed to topic, not posting message

Commands Topic is set correctly in the configuration: master/obdtrac02/teltonika/%imei%/commands

Data Topic is working, i get data from device.

image
image

Response from device fields shows errors too

image

Have I forgotten to set something? What could be the reason?

Good morning @PeterB ,

I can tell from your screenshot that it does work, since the error unknown command or invalid format is an actual message that is sent by the device itself as a response from the command.

Now, I haven’t really decoded the behavior that makes the device disconnect, but sometimes, when an invalid command is sent to the device, the device unsubscribes from the commands topic. There’s not exactly a trove of information for the behavior of MQTT around Teltonika devices, so it takes a bit of a deep dive to decode why the device disconnects from the MQTT topic.

Hope that helps!

Hey @panos, yes sometimes it disconnect but i always get this unknown command response. OR Log shows some errors but i dont know if it is a general problem or if it is related with the mentionend problem.

2025-11-22 14:40:15.477  INFO    [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Updating 34 attributes of CarCustomAsset with IMEI 864275078462630 at Timestamp Optional[Attribute{name='lastContact', type='dateAndTime', value='2025-11-22 14:40:13.0', timestamp='1763818813000'} ]
2025-11-22 14:40:20.028  WARNING [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : "{\"state\":{\"reported\":{\"ts\":1763818818000,\"pr\":0,\"latlng\":\"53.769340,10.718840\",\"alt\":20,\"ang\":340,\"sat\":10,\"sp\":69,\"evt\":0,\"239\":1,\"240\":1,\"21\":5,\"200\":0,\"69\":1,\"113\":100,\"30\":0,\"31\":21,\"32\":86,\"37\":70,\"759\":13,\"250\":1,\"181\":16,\"182\":9,\"66\":14788,\"67\":4105,\"68\":0,\"36\":1544,\"43\":0,\"49\":21012,\"241\":26202,\"16\":712670,\"389\":210660,\"390\":180,\"256\":\"WVWZZZ3CZCE012345\"}}}"
2025-11-22 14:40:20.028  WARNING [Thread-256 (ActiveMQ-cli..ads)] te.model.util.ValueUtil.MODEL_AND_VALUES : Failed to parse JSON
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('x' (code 120)): Expected space separating root-level values
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
	at com.fasterxml.jackson.core.JsonParser._constructReadException(JsonParser.java:2678)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:742)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportMissingRootWS(ParserMinimalBase.java:660)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._verifyRootSpace(ReaderBasedJsonParser.java:1800)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseNumber2(ReaderBasedJsonParser.java:1665)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseUnsignedNumber(ReaderBasedJsonParser.java:1363)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:777)
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:5125)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:5028)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3954)
	at org.openremote.model.util.ValueUtil.parse(ValueUtil.java:240)
	at org.openremote.model.util.ValueUtil.parse(ValueUtil.java:252)
	at org.openremote.model.util.ValueUtil.getValue(ValueUtil.java:388)
	at org.openremote.model.util.ValueUtil.getValueCoerced(ValueUtil.java:408)
	at telematics.teltonika.TeltonikaDataPayload.getAttributes(TeltonikaDataPayload.java:293)
	at telematics.teltonika.TeltonikaMQTTHandler.onPublish(TeltonikaMQTTHandler.java:408)
	at org.openremote.manager.mqtt.MQTTHandler.lambda$addPublishConsumer$3(MQTTHandler.java:193)
	at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:982)
	at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1135)
	at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:59)
	at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
	at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:69)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120)
2025-11-22 14:40:20.029  INFO    [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Updating 34 attributes of CarCustomAsset with IMEI 864275078462630 at Timestamp Optional[Attribute{name='lastContact', type='dateAndTime', value='2025-11-22 14:40:18.0', timestamp='1763818818000'} ]
2025-11-22 14:40:26.894  WARNING [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : "{\"state\":{\"reported\":{\"ts\":1763818824000,\"pr\":0,\"latlng\":\"53.770285,10.718187\",\"alt\":21,\"ang\":332,\"sat\":9,\"sp\":69,\"evt\":0,\"239\":1,\"240\":1,\"21\":5,\"200\":0,\"69\":1,\"113\":100,\"30\":0,\"31\":30,\"32\":85,\"37\":71,\"759\":13,\"250\":1,\"181\":17,\"182\":10,\"66\":14756,\"67\":4105,\"68\":0,\"36\":1587,\"43\":0,\"49\":21012,\"241\":26202,\"16\":712784,\"389\":210660,\"390\":190,\"256\":\"WVWZZZ3CZCE012345\"}}}"
2025-11-22 14:40:26.895  WARNING [Thread-256 (ActiveMQ-cli..ads)] te.model.util.ValueUtil.MODEL_AND_VALUES : Failed to parse JSON
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('x' (code 120)): Expected space separating root-level values
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
	at com.fasterxml.jackson.core.JsonParser._constructReadException(JsonParser.java:2678)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:742)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportMissingRootWS(ParserMinimalBase.java:660)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._verifyRootSpace(ReaderBasedJsonParser.java:1800)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseNumber2(ReaderBasedJsonParser.java:1665)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseUnsignedNumber(ReaderBasedJsonParser.java:1363)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:777)
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:5125)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:5028)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3954)
	at org.openremote.model.util.ValueUtil.parse(ValueUtil.java:240)
	at org.openremote.model.util.ValueUtil.parse(ValueUtil.java:252)
	at org.openremote.model.util.ValueUtil.getValue(ValueUtil.java:388)
	at org.openremote.model.util.ValueUtil.getValueCoerced(ValueUtil.java:408)
	at telematics.teltonika.TeltonikaDataPayload.getAttributes(TeltonikaDataPayload.java:293)
	at telematics.teltonika.TeltonikaMQTTHandler.onPublish(TeltonikaMQTTHandler.java:408)
	at org.openremote.manager.mqtt.MQTTHandler.lambda$addPublishConsumer$3(MQTTHandler.java:193)
	at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:982)
	at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1135)
	at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:59)
	at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
	at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:69)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120)
2025-11-22 14:40:26.895  INFO    [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Updating 34 attributes of CarCustomAsset with IMEI 864275078462630 at Timestamp Optional[Attribute{name='lastContact', type='dateAndTime', value='2025-11-22 14:40:24.0', timestamp='1763818824000'} ]

Here is a short log, car not moving and i only send command:

2025-11-22 14:51:14.329  WARNING [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : New AssetStateDuration
2025-11-22 14:51:14.329  INFO    [Thread-256 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Updating 24 attributes of CarCustomAsset with IMEI 864275078462630 at Timestamp Optional[Attribute{name='lastContact', type='dateAndTime', value='2025-11-22 14:51:09.0', timestamp='1763819469000'} ]
2025-11-22 14:52:37.296  WARNING [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : "{\"RSP\":\"unknown command or invalid format\"}"
2025-11-22 14:52:37.296  WARNING [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : The old value is empty!
2025-11-22 14:52:37.296  SEVERE  [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Could not parse Asset State Duration data
2025-11-22 14:52:37.296  SEVERE  [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : java.lang.Exception
2025-11-22 14:52:37.296  INFO    [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Updating 2 attributes of CarCustomAsset with IMEI 864275078462630 at Timestamp Optional.empty
2025-11-22 14:53:23.268  WARNING [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : "{\"RSP\":\"unknown command or invalid format\"}"
2025-11-22 14:53:23.268  WARNING [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : The old value is empty!
2025-11-22 14:53:23.268  SEVERE  [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Could not parse Asset State Duration data
2025-11-22 14:53:23.268  SEVERE  [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : java.lang.Exception
2025-11-22 14:53:23.268  INFO    [Thread-257 (ActiveMQ-cli..ads)] atics.teltonika.TeltonikaMQTTHandler.API : Updating 2 attributes of CarCustomAsset with IMEI 864275078462630 at Timestamp Optional.empty

Any idea what’s wrong there? Thanks in advance!

Hey @PeterB ,

These are not related to the problem at hand, and if I remember correctly, the latest version of the fleet-management repo should fix the errors you see in the logs.

I just tested it out with getgps (note that I am not using any spaces in the command at the start). Does that work?

@panos Yes i tried this command but it’s not working. Response is always the same. I use this structure: smslogin space smspassword space command
For example: usr 1234 getgps

Hey @PeterB ,

I’m not entirely familiar with the SMS commands, and I just read up on the concept of SMS login and password. Without an SMS password, I tried out getinfo and it worked, and then tried <space><space>getinfo, and I got the error you mentioned.

I would assume that authentication is not required for commands sent over MQTT, since the command is coming from the MQTT broker with SSL. I would try deactivating SMS password authentication on the device’s end. Teltonika documentation for sending device commands over MQTT here.

I will try out, i have a second device on my desk but this device is disconnected from topic.

DISCONNECT: Device obdtrac02 disconnected from topic
INFO    [ContainerExecutor-9910        ] atics.teltonika.TeltonikaMQTTHandler.API : Device 864275077662552 is not subscribed to topic, not posting message

I already restarted this device but dont know how to reconnect to the topic. GPRS is activated but seems there is no trigger to force and send data. Do you know how to force?

@PeterB what I do during development is remove the battery from the device itself and ensure it’s shut down, then plug it in again. Should make it re-subscribe to the correct topics.

Amazing, now it works! I followed the documentation, which says, “Type the command in the same way you would an SMS command.” That was a little confusing, so I assumed I had to enter my username and password. Even with a username and password set, the command still works!
Tutorial: Create your own Fleet Management System · openremote/fleet-management Wiki · GitHub

Is disconnecting from the topic a Teltonika problem or more of an Openremote/MQTT setting? It disconnects after about 10 minutes. Thank you very much for your help!

@PeterB glad you got it to work!

As I said, I haven’t been able to track down what forces the unsubscribe from the device’s end, and since documentation on the inner workings of tracker and its MQTT connection is scarce, it’s a bit difficult to track down what makes the device decide to unsubscribe.