<?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>nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91529/nrf-cloud-mqtt-fota</link><description>Hi! 
 I am trying to subscribe to nrf cloud with topic &amp;quot; prod/&amp;lt;TEAM_ID&amp;gt;/&amp;lt;DEVICE_ID&amp;gt;/jobs/rcv&amp;quot;. After that I get Disconnect event in the MQTT handler. 
 Topic &amp;quot;prod/&amp;lt;TEAM_ID&amp;gt;/m/#&amp;quot; works perfectly, no disconnections. 
 Device shadow is updated as: 
 FOTA</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Sep 2022 07:04:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91529/nrf-cloud-mqtt-fota" /><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/386521?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 07:04:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33d27c63-654a-45b0-8f2d-a6ed4c49c038</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;I reached out to the nRF Cloud team to have them look at this case. The issue is due to the wrong usage of device ID i.e. you are trying to &lt;a href="https://docs.nrfcloud.com/Reference/Devices/Types/#account-device"&gt;fetch information from the account device&lt;/a&gt;, which is basically a device to monitor other devices in the account.&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;An account device has MQTT permissions to monitor the message traffic of all devices associated with your account. You can use the certificate for this device to connect to the nRF Cloud MQTT broker and monitor device traffic for debugging purposes, or set up your own MQTT message bridge.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The account device is not eligible for FOTA, which is the reason this fails.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What you should do is use the device ID which is the name you gave the device in nRF Cloud during &lt;a href="https://docs.nrfcloud.com/Reference/DeviceManagement/Provisioning/"&gt;device provisioning&lt;/a&gt;. You will need to change the device ID in you application as well. Our nRF Cloud team tested this and confirms this on their side.&lt;br /&gt;&lt;br /&gt;Let me know how that works for you!&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/386287?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 06:56:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:063c85b1-e5e2-4363-aec6-2906a329b227</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello, my apologies, I have been on the road with our Nordic Tech Tour team. Are you able to share your project so that I can test on my side? We can convert this ticket to private if you feel more comfortable.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/386067?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2022 22:56:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a84fea4-da74-4e66-9157-7be70faf222b</guid><dc:creator>Vadimka</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;Oslash;yvind,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;any updates?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/385120?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2022 21:09:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3519d4b6-c80c-46f9-a89c-706058371869</guid><dc:creator>Vadimka</dc:creator><description>&lt;p&gt;Thank you for the information. Yes I read all this articles during project. I use TLS, CA crtificate, client certificate and private key. MQTT client can&amp;#39;t connect to the broker without them.&lt;/p&gt;
&lt;p&gt;My MQTT client connects successfully to the NRF cloud broker. Also it successfully subscribes to all messages topic(&lt;span&gt;prod/&amp;lt;TEAM_ID&amp;gt;&lt;/span&gt;/m/#). But when I try to subscribe to fota notifications(&lt;span&gt;prod/&amp;lt;TEAM_ID&amp;gt;/&amp;lt;DEVICE_ID&amp;gt;/jobs/rcv&lt;/span&gt;) or publish request for fota jobs(&lt;span&gt;prod/&amp;lt;TEAM_ID&amp;gt;/&amp;lt;DEVICE_ID&amp;gt;/jobs/req) MQTT client got MQTT_EVT_DISCONNECT event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you test these topics on your side with nRF Connect 1.9.1 SDK(We&amp;nbsp;are not able to migrate our project every time when new version of SDK appears)?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your assistance.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/384979?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2022 09:56:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d50291a0-7dce-430e-aa3c-7373953c58e2</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My apologies for the late reply.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Have you&amp;nbsp;read the nRF Cloud documentation &amp;quot;&lt;a href="https://docs.nrfcloud.com/Guides/GettingStarted/FOTA#mqtt-preparations"&gt;Getting started with FOTA&lt;/a&gt;&amp;quot;? As described in the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/libraries/networking/nrf_cloud.html#nrf-cloud"&gt;nRF Cloud library in SDK documentation&lt;/a&gt;, the nRF Cloud implementation supports&amp;nbsp;TLS secured MQTT as the communication protocol with more information provided under&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/libraries/networking/nrf_cloud.html#firmware-over-the-air-fota-updates"&gt;Firmware over-the-air (FOTA) updates&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In nRF Connect SDK v2.0.x we have added the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/nrf/samples/nrf9160/nrf_cloud_mqtt_multi_service/README.html#nrf9160-nrf-cloud-mqtt-multi-service"&gt;nRF9160: nRF Cloud MQTT multi-service sample&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/384875?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2022 22:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6553bc9-6330-43aa-9271-82578bbbfdb0</guid><dc:creator>Vadimka</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;Oslash;yvind,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here how it looks in&amp;nbsp;&lt;/span&gt;&lt;span&gt;Debug Terminal:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:09.301,513] &#x1B;[0m&amp;lt;inf&amp;gt; Waterguard: Setup Complete&#x1B;[0m
[00:00:16.713,684] &#x1B;[0m&amp;lt;inf&amp;gt; mqtt_simple: MQTT client connected&#x1B;[0m
[00:00:16.715,332] &#x1B;[0m&amp;lt;inf&amp;gt; mqtt_simple: Publishing: {&amp;quot;state&amp;quot;:{&amp;quot;reported&amp;quot;:{&amp;quot;device&amp;quot;:{&amp;quot;serviceInfo&amp;quot;:{&amp;quot;fota_v2&amp;quot;:[&amp;quot;APP&amp;quot;],&amp;quot;ui&amp;quot;:null}}}}}&#x1B;[0m
[00:00:16.715,362] &#x1B;[0m&amp;lt;inf&amp;gt; mqtt_simple: to topic: $aws/things/account-813d19e6-4222-4eeb-9d38-c0aa2c710f43/shadow/update len: 70&#x1B;[0m
[00:00:16.722,991] &#x1B;[0m&amp;lt;inf&amp;gt; mqtt_simple: Subscribing to: prod/813d19e6-4222-4eeb-9d38-c0aa2c710f43/m/# len 45&#x1B;[0m
[00:01:22.145,843] &#x1B;[0m&amp;lt;inf&amp;gt; nrf_cloud_fota: Topic: prod/813d19e6-4222-4eeb-9d38-c0aa2c710f43/account-813d19e6-4222-4eeb-9d38-c0aa2c710f43/jobs/req&#x1B;[0m
[00:01:22.145,904] &#x1B;[0m&amp;lt;inf&amp;gt; nrf_cloud_fota: Payload (4 bytes): [&amp;quot;&amp;quot;]&#x1B;[0m
[00:01:31.967,163] &#x1B;[0m&amp;lt;inf&amp;gt; mqtt_simple: MQTT client disconnected: -128&#x1B;[0m
[00:01:31.967,224] &#x1B;[1;31m&amp;lt;err&amp;gt; mqtt_simple: mqtt_input: -128&#x1B;[0m
[00:01:31.967,224] &#x1B;[0m&amp;lt;inf&amp;gt; mqtt_simple: Disconnecting MQTT client...&#x1B;[0m
[00:01:31.967,285] &#x1B;[1;31m&amp;lt;err&amp;gt; mqtt_simple: Could not disconnect MQTT client: -128&#x1B;[0m&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/384374?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2022 17:20:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73433362-fa24-4941-aaf5-214a39037886</guid><dc:creator>Vadimka</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;&amp;Oslash;yvind,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I use nrf connect 1.9.1.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It is my custom application on the custom board. Here is some code from it:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;code&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define CONFIG_MQTT_FOTA_JOB_RCV &amp;quot;prod/813d19e6-4222-4eeb-9d38-c0aa2c710f43/account-813d19e6-4222-4eeb-9d38-c0aa2c710f43/jobs/rcv&amp;quot;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int subscribe(void)
{
struct mqtt_topic subscribe_topic = {
.topic = {
.utf8 = (uint8_t *)CONFIG_MQTT_FOTA_JOB_RCV,
.size = strlen(CONFIG_MQTT_FOTA_JOB_RCV)
},
.qos = MQTT_QOS_1_AT_LEAST_ONCE
};

const struct mqtt_subscription_list subscription_list = {
.list = &amp;amp;subscribe_topic,
.list_count = 1,
.message_id = 103
};

LOG_INF(&amp;quot;Subscribing to: %s len %u&amp;quot;, CONFIG_MQTT_SUB_TOPIC,
(unsigned int)strlen(CONFIG_MQTT_SUB_TOPIC));

return mqtt_subscribe(&amp;amp;client, &amp;amp;subscription_list);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void mqtt_evt_handler(struct mqtt_client *const c,
const struct mqtt_evt *evt)
{
int err;

err = nrf_cloud_fota_mqtt_evt_handler(evt);
if (err == 0) {
/* Event handled by FOTA library so we can skip it */
return;
} else if (err &amp;lt; 0) {
printk(&amp;quot;nrf_cloud_fota_mqtt_evt_handler: Failed! %d\n&amp;quot;, err);
}

switch (evt-&amp;gt;type) {
case MQTT_EVT_CONNACK:
if (evt-&amp;gt;result != 0) {
LOG_ERR(&amp;quot;MQTT connect failed: %d&amp;quot;, evt-&amp;gt;result);
break;
}

LOG_INF(&amp;quot;MQTT client connected&amp;quot;);
err = subscribe();
//err = nrf_cloud_fota_subscribe(); // &amp;lt;---- The bug is here
if(err) LOG_INF(&amp;quot;FOTA subscribe errorr: %d&amp;quot;, err);
break;

case MQTT_EVT_DISCONNECT:
LOG_INF(&amp;quot;MQTT client disconnected: %d&amp;quot;, evt-&amp;gt;result);
break;

case MQTT_EVT_PUBLISH: {
const struct mqtt_publish_param *p = &amp;amp;evt-&amp;gt;param.publish;

LOG_INF(&amp;quot;MQTT PUBLISH result=%d len=%d&amp;quot;,
evt-&amp;gt;result, p-&amp;gt;message.payload.len);
err = publish_get_payload(c, p-&amp;gt;message.payload.len);

if (p-&amp;gt;message.topic.qos == MQTT_QOS_1_AT_LEAST_ONCE) {
const struct mqtt_puback_param ack = {
.message_id = p-&amp;gt;message_id
};

/* Send acknowledgment. */
mqtt_publish_qos1_ack(&amp;amp;client, &amp;amp;ack);
}

if (err &amp;gt;= 0) {
data_print(&amp;quot;Received: &amp;quot;, payload_buf,
p-&amp;gt;message.payload.len);
/* Echo back received data */
//data_publish(&amp;amp;client, MQTT_QOS_1_AT_LEAST_ONCE,
// payload_buf, p-&amp;gt;message.payload.len);
} else if (err == -EMSGSIZE) {
LOG_ERR(&amp;quot;Received payload (%d bytes) is larger than the payload buffer &amp;quot;
&amp;quot;size (%d bytes).&amp;quot;,
p-&amp;gt;message.payload.len, sizeof(payload_buf));
} else {
LOG_ERR(&amp;quot;publish_get_payload failed: %d&amp;quot;, err);
LOG_INF(&amp;quot;Disconnecting MQTT client...&amp;quot;);

err = mqtt_disconnect(c);
if (err) {
LOG_ERR(&amp;quot;Could not disconnect: %d&amp;quot;, err);
}
}
} break;

case MQTT_EVT_PUBACK:
if (evt-&amp;gt;result != 0) {
LOG_ERR(&amp;quot;MQTT PUBACK error: %d&amp;quot;, evt-&amp;gt;result);
break;
}

LOG_INF(&amp;quot;PUBACK packet id: %u&amp;quot;, evt-&amp;gt;param.puback.message_id);
break;

case MQTT_EVT_SUBACK:
if (evt-&amp;gt;result != 0) {
LOG_ERR(&amp;quot;MQTT SUBACK error: %d&amp;quot;, evt-&amp;gt;result);
break;
}

LOG_INF(&amp;quot;SUBACK packet id: %u&amp;quot;, evt-&amp;gt;param.suback.message_id);
//readyForFota = true;
break;

case MQTT_EVT_PINGRESP:
if (evt-&amp;gt;result != 0) {
LOG_ERR(&amp;quot;MQTT PINGRESP error: %d&amp;quot;, evt-&amp;gt;result);
}
break;

default:
LOG_INF(&amp;quot;Unhandled MQTT event type: %d&amp;quot;, evt-&amp;gt;type);
break;
}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also tried to use&amp;nbsp;&lt;code&gt;nrf_cloud_fota_subscribe()&lt;/code&gt; function, but it worked the same.&lt;/p&gt;
&lt;p&gt;Topic &amp;quot;prod/813d19e6-4222-4eeb-9d38-c0aa2c710f43/m/#&amp;quot; works good with the same code&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf cloud mqtt fota</title><link>https://devzone.nordicsemi.com/thread/384307?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2022 11:09:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1af067a9-0d6f-432b-8d0f-111b0654b35b</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I will need more information on what is going on. What version of the nRF Connect SDK are you working on? What application are you running on you board?&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Please note that our team wiil be out of office on Friday, Sept 2nd and an answer will be provided Monday 5th.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>