# ESP8266 i get command but payload is empty

**URL:** https://forums.losant.com/t/esp8266-i-get-command-but-payload-is-empty/2983
**Category:** Help
**Tags:** mqtt, device
**Created:** [May 29, 2020, 12:10am UTC](https://forums.losant.com/t/esp8266-i-get-command-but-payload-is-empty/2983 "2020-05-29T00:10:48Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)
#### Post date: [June 8, 2020, 9:39pm UTC](https://forums.losant.com/t/esp8266-i-get-command-but-payload-is-empty/2983/19 "2020-06-08T21:39:49Z")

</div>

@Raymond_phillips,

When debugging hardware issues, it’s helpful to isolate where the problem may be. In this case, your code does a lot more than simply connecting to Losant and receiving commands. Since the issue you’re communicating is about the device not receive the command, if you started from the example code, Do you get the same result? :

> <https://github.com/Losant/losant-mqtt-arduino/blob/master/examples/esp8266/esp8266.ino>

Next, after reading your message again, this sparked interest:

> [@Raymond\_phillips](#):
>
> i don’t get errors it blank the command from losant says it sent and the device revived it. the device does see the command and i can see the name of the command but when i try to print it to serial directly it just blank.

If you see the name of the command, you’re getting to this part of the code:

```auto
Serial.print("Command received: ");
Serial.println(command->name);

```

I grabbed it from here:

> [@Raymond\_phillips](#):
>
> ```auto
> // Called whenever the device receives a command from the Losant platform.
> void handleCommand(LosantCommand *command) {
> Serial.print("Command received: ");
> Serial.println(command->name);
> latch = true;
> 
> if (strcmp(command->name, "ledCommand") == 0) 
> {
> JsonObject& payload = *command->payload;
>   
> Serial.println("");
> 
> msgs[1] = payload["pattern"].as<String>();
> msgs[2] = payload["cycles"].as<String>();
> msgs[3] = payload["runTime"].as<String>();
> msgs[4] = payload["color1"].as<String>();
> msgs[5] = payload["color2"].as<String>();
> }
> 
> //commandChanged();
> }
> 
> ```

To help figure out what’s supposed to happen, what are you expecting to see when your command is run? Currently, you only have it configured to print and empty quote `Serial.println("");`.

---

_[View the full topic](https://forums.losant.com/t/esp8266-i-get-command-but-payload-is-empty/2983)._
