# Batch Reporting Device State via losantmqtt Python library fails

**URL:** https://forums.losant.com/t/batch-reporting-device-state-via-losantmqtt-python-library-fails/5441
**Category:** Help
**Tags:** mqtt, device
**Created:** [March 27, 2024, 6:10pm UTC](https://forums.losant.com/t/batch-reporting-device-state-via-losantmqtt-python-library-fails/5441 "2024-03-27T18:10:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Logan\_Parker](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/logan_parker/32/4860_2.png) [@Logan\_Parker](https://forums.losant.com/u/Logan_Parker)
#### Post date: [March 27, 2024, 6:10pm UTC](https://forums.losant.com/t/batch-reporting-device-state-via-losantmqtt-python-library-fails/5441/1 "2024-03-27T18:10:26Z")

</div>

I have devices in the field which I would like to configure to do batch reporting, where they sample data and return an array of payloads. It seems as though this is a supported feature, as there is mention of it in the [docs](https://docs.losant.com/devices/state/#batch-reporting).

I’m mostly wondering if it’s possible to continue using the losantmqtt library in python for this, as it seems that reporting the device state only supports single payloads (at least with the send\_state method).

Currently my state is reported something like this:

```auto
data = [{'data': {'ABC': 1}, 'time': '2024-03-27T17:46:58.380Z'}, {'data': {'ABC': 1}, 'time': '2024-03-27T17:47:01.392Z'}, {'data': {'ABC': 1}, 'time': '2024-03-27T17:47:05.408Z'}, {'data': {'ABC': 1}, 'time': '2024-03-27T17:47:09.429Z'}]
device.send_state(data)

```

Is there support for this that I am missing, or will I need to implement a lower level MQTT library to do this?

---

<div class="post-metadata">

### Author: ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)
#### Post date: [March 27, 2024, 6:16pm UTC](https://forums.losant.com/t/batch-reporting-device-state-via-losantmqtt-python-library-fails/5441/2 "2024-03-27T18:16:14Z")

</div>

Hey @Logan_Parker,

You are correct that the `send_state` function is assuming a single state report. To send multiple states, you can access the underlying MQTT client directly and publish the array:

```python
import json

device._mqtt_client.publish(device._state_topic(), json.dumps(data))

```

---

<div class="post-metadata">

### Author: ![Logan\_Parker](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/logan_parker/32/4860_2.png) [@Logan\_Parker](https://forums.losant.com/u/Logan_Parker)
#### Post date: [March 27, 2024, 7:18pm UTC](https://forums.losant.com/t/batch-reporting-device-state-via-losantmqtt-python-library-fails/5441/3 "2024-03-27T19:18:30Z")

</div>

Hey Brandon,

Thanks for that - I figured I was likely using the send\_state function incorrectly. I appreciate the quick response!
