# Setting up MQTT with the HL78 & AT commands

**URL:** <https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826>\
**Category:** HL78\
**Created:** [August 14, 2024, 2:04pm UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826 "2024-08-14T14:04:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![l.vaniperen](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@l.vaniperen](https://forum.sierrawireless.com/u/l.vaniperen)\
**Post date:** [August 14, 2024, 2:04pm UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/1 "2024-08-14T14:04:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/e/e883df6da289e51ef8f2657b294f4fb447a71fce.png)

Which AT commands do you need? i keep getting bad session id errors.

AT+KMQTTCFG=1,0,“[test.mosquitto.org](http://test.mosquitto.org)”,1883,3,1  
AT+KMQTTCNX=1  
AT+KMQTTSUB=1,“Publish”,0  
AT+KMQTTPUB=1,“Publish”,0,0,“TEST”

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [August 14, 2024, 2:36pm UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/2 "2024-08-14T14:36:54Z")

</div>

which module are you using?  
Which FW are you using?

---

<div class="post-metadata">

**Author:** ![l.vaniperen](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@l.vaniperen](https://forum.sierrawireless.com/u/l.vaniperen)\
**Post date:** [August 21, 2024, 8:33am UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/3 "2024-08-21T08:33:14Z")

</div>

Hi, sorry for the late response.

The module is: HL7812  
The FW is: HL7812.5.5.14.0-23-12

 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/0/007cb2d5f0ad7c32f5f0a448fada77df23db05f6.png)

What do you need to get a session ID? Do i need to get certificates or something?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [August 21, 2024, 8:48am UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/4 "2024-08-21T08:48:39Z")

</div>

i saw that other user can make it work:

> [@HL7810, MQTT Certs and ERROR code 907](https://forum.sierrawireless.com/t/hl7810-mqtt-certs-and-error-code-907/30941):
>
> Hi, I have an hl7810 modem and try to have aws iot connection. I think I need a help to write certs, I did like this: As u know when U create a thing on the aws iot, it will give you 2 root(ca1 and ca2) certs and 3 different certs ( public, private and dev pem certs). How many of them should I use? What I did sequently, AT+KCERTSTORE=0,1188,0 rootCA1 AT+KCERTSTORE=1,1224,0 pem.crt(device) AT+KPRIVKSTORE=0,1675 and private key and then this is my mqtt config: AT+KMQTTCFG=1,1,“[XXXXXXx…](http://XXXXXXx.eu-west-1.amazonaws.com)

---

<div class="post-metadata">

**Author:** ![l.vaniperen](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@l.vaniperen](https://forum.sierrawireless.com/u/l.vaniperen)\
**Post date:** [August 22, 2024, 8:31am UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/5 "2024-08-22T08:31:38Z")

</div>

Yes i see,

But this example uses Amazon Web Services which i don’t want to use and uses encryption&Authentication which i want to use in the future but not now.  
So i will not need certificates.  
Using the reference guide it says to give the following AT command:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/1/1aa9ecfb7a29878517424dd72e790bdb823b642e.png)

But this also isn’t working.  
Do you maybe have another example for just using MQTT AT commands?  
Or do you know what commands i need before it should work?

Thanks in advance! 🙂

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [August 22, 2024, 9:49am UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/6 "2024-08-22T09:49:47Z")

</div>

I don’t see problem with the following:

```auto

at+kcnxcfg=1,"GPRS","iot.swir"

OK
AT+KMQTTCFG=1,0,"test.mosquitto.org",1883,3,"hl78.1234",120,0,1,"test.hl78","network lost",0,0,"username","password"

+KMQTTCFG: 1

OK
ati3
HL7812.5.4.12.1

OK

```

---

<div class="post-metadata">

**Author:** ![l.vaniperen](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@l.vaniperen](https://forum.sierrawireless.com/u/l.vaniperen)\
**Post date:** [August 22, 2024, 10:27am UTC](https://forum.sierrawireless.com/t/setting-up-mqtt-with-the-hl78-at-commands/32826/7 "2024-08-22T10:27:14Z")

</div>

Omg thank you so much! i forget setting the APN and getting the IP i think!

I got it working!

 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/b/b839707d59486bd0308d2de7ac81f4b9228f46c0.jpeg)
