<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85515/nrf9160-using-json-in-mqtt-command-at-xmqttpub</link><description>We use nRF9160 on our own board. The firmware &amp;quot;Serial lte modem&amp;quot; is installed on the chip with connection to an external MCU. We connect to the broker through the MQTT command, then for the test we publish a message like: If we send just a string, everything</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Mar 2022 12:42:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85515/nrf9160-using-json-in-mqtt-command-at-xmqttpub" /><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/357153?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 12:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24220063-7e6b-4519-bbdc-d33519f6efdc</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;I see you have opened a new ticket where you have provided more information: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/85605/nrf9160-sending-messages-via-mqtt-larger-than-256-bytes"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/85605/nrf9160-sending-messages-via-mqtt-larger-than-256-bytes&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s close this one, and continue the conversation there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356873?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 12:19:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0df3f7c1-7160-4191-820b-3974e15d9afe</guid><dc:creator>Stas Jis</dc:creator><description>&lt;p&gt;Dear Didrik,&lt;br /&gt;I was able to send JSON in &amp;quot;date mode&amp;quot; and Qos = 1. &lt;br /&gt;However, I found that there is a limit on the length of the message body (256 bytes). Messages come to the broker divided into pieces of 256 bytes + the rest.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356829?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 10:20:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3380c982-e05e-4aa1-a1ea-4a112ceb041e</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;You need to add the QoS parameter to the command:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;AT#XMQTTPUB=&amp;quot;Rigel/ToServer/v2/Operational&amp;quot;,&amp;quot;&amp;quot;,1&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356646?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 14:10:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9d477a9-9885-45d9-87c7-c7e0e3e0b15f</guid><dc:creator>Stas Jis</dc:creator><description>&lt;p&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/didrik-rokhaug"&gt;Didrik&lt;/a&gt;, Thank for the help.&lt;br /&gt;Your instructions helped, JSON reached the server.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;AT#XMQTTPUB=&amp;quot;Rigel/ToServer/v2/Operational&amp;quot;
{&amp;quot;msg&amp;quot;:&amp;quot;Test Json publish&amp;quot;}
+++
OK&lt;/pre&gt;&lt;br /&gt;However, how did I get the publication confirmation, just like using QoS = 1:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;AT#XMQTTPUB=&amp;quot;Rigel/ToServer/v2/Operational&amp;quot;,&amp;quot;7b2274656d7065726174757265223a32302c2276616c7565223a38307d&amp;quot;,1,0
OK
#XMQTTEVT: 3,0&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356597?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 13:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6003f305-9002-440b-b1f6-c1121104689a</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can enter data mode by using AT#XMQTTPUB without any data.&lt;/p&gt;
&lt;p&gt;That way, any bytes you send over UART until you send the datamode terminator (&amp;quot;+++&amp;quot;, without any &amp;lt;CR&amp;gt; or &amp;lt;LF&amp;gt; line ending) will be sent to the broker on the topic specified.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html#mqtt-publish-xmqttpub"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html#mqtt-publish-xmqttpub&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356595?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 12:59:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24f4029a-b627-456f-a175-6a0c1ba32ebb</guid><dc:creator>Markus Tacker (he/him)</dc:creator><description>&lt;p&gt;Use&amp;nbsp;AT#XMQTTPUB with message set to &amp;quot;&amp;quot; to enter data mode:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/a654fb6ef602b05f69877e16143bbe6900ad6e73/applications/serial_lte_modem/src/mqtt_c/slm_at_mqtt.c#L623"&gt;github.com/.../slm_at_mqtt.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356593?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 12:54:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3644f702-7e9f-41e0-b0ba-bb8d02c0cb4c</guid><dc:creator>Stas Jis</dc:creator><description>&lt;p&gt;Markus,&lt;br /&gt;Is there a specific scenario for working with MQTT when using &amp;quot;data mode&amp;quot;?&lt;br /&gt;Right now, after connecting to the broker, I don&amp;#39;t get any result for &amp;quot;AT#XSEND&amp;quot; and I don&amp;#39;t understand how a direct data send can be without a command to publish data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356583?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 12:35:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f16dc412-fc63-4ad3-ac96-093ab4462ded</guid><dc:creator>Markus Tacker (he/him)</dc:creator><description>&lt;p&gt;Data mode puts the SLM in a state where any data you send to it is forwarded verbatim to the endpoint, until you sent the terminator.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There are example of using the data mode (albeit for other clients) &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/serial_lte_modem/doc/slm_testing.html#udp-client"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356571?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 12:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c6b4249-25c0-4622-9f65-0e417050c185</guid><dc:creator>Stas Jis</dc:creator><description>&lt;p&gt;Markus,&lt;br /&gt;Maybe I misunderstood, but &amp;quot;data mode&amp;quot; is not combined with AT commands? (including AT#XMQTTPUB).&lt;br /&gt;If all data in the &amp;quot;data mode&amp;quot; mode received from the MCU via the UART bus is considered arbitrary, then how to organize data upload and use MQTT without changing the &amp;quot;Serial lte modem&amp;quot; firmware code.&lt;br /&gt;Maybe there is some example?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356550?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 11:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de845b59-1c00-489b-b6fd-da09138a613a</guid><dc:creator>Markus Tacker (he/him)</dc:creator><description>&lt;p&gt;Yes, you could use the data mode:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/serial_lte_modem/doc/slm_data_mode.html"&gt;developer.nordicsemi.com/.../slm_data_mode.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356548?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 11:26:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a796b5da-75bf-46e5-8c31-7eb4c02bb345</guid><dc:creator>Stas Jis</dc:creator><description>&lt;p&gt;Markus,&lt;br /&gt;Is there any other option besides converting JSON to hexadecimal?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160, Using JSON in MQTT command AT#XMQTTPUB</title><link>https://devzone.nordicsemi.com/thread/356532?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2022 10:23:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:269582fb-0d58-4bc9-9c09-e0cfb2b842a3</guid><dc:creator>Markus Tacker (he/him)</dc:creator><description>&lt;p&gt;See&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/69166/nrf91-serial-lte-modem-mqtt-at-command-for-json-format"&gt;devzone.nordicsemi.com/.../nrf91-serial-lte-modem-mqtt-at-command-for-json-format&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>