# \[Solved\] Device state data

**URL:** <https://forums.losant.com/t/solved-device-state-data/1388>\
**Category:** Help\
**Created:** [December 31, 2018, 5:55am UTC](https://forums.losant.com/t/solved-device-state-data/1388 "2018-12-31T05:55:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_K](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Steve\_K](https://forums.losant.com/u/Steve_K)\
**Post date:** [December 31, 2018, 5:55am UTC](https://forums.losant.com/t/solved-device-state-data/1388/1 "2018-12-31T05:55:41Z")

</div>

Greetings all,

I’m new to Losant and am in the process of connecting a 3rd-party gateway device.

I am able to connect via MQTT and see activity in the Device Log but my payload data is not being recognized.

My gateway is sending this:  
`{"mac": "00:0b:57:1c:3b:8a", "rssi": -30, "adv": "020106020a080f094b656774726f6e20314333423841", "scan": "1effffff49ef2331056501534e380000000000000000000000000000000000"}`

…but I receive the following error from Losant: “The `data` property must be an object”

Screenshot attached.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/1X/685a2d937420647c15288e2921f4f6b51b796a5d.png)

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Steve\_K](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Steve\_K](https://forums.losant.com/u/Steve_K)\
**Post date:** [January 1, 2019, 4:10am UTC](https://forums.losant.com/t/solved-device-state-data/1388/2 "2019-01-01T04:10:18Z")

</div>

After some further digging, I believe the issue lies with the way my 3rd party gateway is formatting the MQTT payload. It is not declaring ‘data’ as an object.

If the payload is formatted like so (using a manual MQTT client):  
`{"data":{"mac": "00:0b:57:1c:3b:8a", "rssi": -30, "adv": "020106020a080f094b656774726f6e20314333423841", "scan": "1effffff49ef2331056501534e380000000000000000000000000000000000"}}`

…then things work OK. While I understand why this is happening, the challenge will be implementing a fix given the gateway is an existing, legacy component.

Any chance Losant could accommodate the payload data in the form from the original post?

---

<div class="post-metadata">

**Author:** ![Erin\_Thompson](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/erin_thompson/32/501_2.png) [@Erin\_Thompson](https://forums.losant.com/u/Erin_Thompson)\
**Post date:** [January 2, 2019, 3:29pm UTC](https://forums.losant.com/t/solved-device-state-data/1388/3 "2019-01-02T15:29:08Z")

</div>

Hi Steve,

There is a way to work around this using a workflow. First, create a workflow using the [MQTT trigger](https://docs.losant.com/workflows/triggers/mqtt/) where you will want to choose the `Losant Broker` as your broker, and then set the topic. Next, add a [node to parse](https://docs.losant.com/workflows/logic/json-decode/) your message because it will come in as a string on the payload. Finally, add a [Device State Node](https://docs.losant.com/workflows/outputs/device-state/) to set the MQTT data as your device state data.

Hope that helps,  
Erin

---

<div class="post-metadata">

**Author:** ![Steve\_K](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Steve\_K](https://forums.losant.com/u/Steve_K)\
**Post date:** [January 2, 2019, 5:10pm UTC](https://forums.losant.com/t/solved-device-state-data/1388/4 "2019-01-02T17:10:54Z")

</div>

Erin,

Good info! I will try this out as you suggest.

Are there any gotchas or other concerns (e.g. with device management, etc.) by using this workaround vs. the conventional device attribute configuration method? Just trying to assess if I need to push the gateway vendor hard to bring them inline with your conventional format.

Thanks!

---

<div class="post-metadata">

**Author:** ![Steve\_K](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Steve\_K](https://forums.losant.com/u/Steve_K)\
**Post date:** [January 3, 2019, 4:30pm UTC](https://forums.losant.com/t/solved-device-state-data/1388/5 "2019-01-03T16:30:49Z")

</div>

Erin,

Thanks for the suggestion, it worked!

Should others try this, be aware that you can’t use the same topic format as you would normally use for devices (e.g. losant/DEV\_ID/state). The MQTT Trigger node requires that the topic does not use ‘losant’ in the name.
