# \[Solved\] Payload error - I'm stumped

**URL:** <https://forums.losant.com/t/solved-payload-error-im-stumped/1226>\
**Category:** Help\
**Created:** [November 6, 2018, 2:35pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226 "2018-11-06T14:35:48Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 2:35pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/1 "2018-11-06T14:35:48Z")

</div>

Why doesn’t this work?  
The javascript in my Workflow function does a perfectly lovely job tearing apart my incoming comma delimited payload.  
When I attempt to do a bit of math and assign the result to another attribute (which is an existing defined attribute for the device targeted) in a subsequent DeviceState, the data never makes it to the device. It shows in the Debug log as a number (red - at least that is what I _think_ red means) while all of the other payload.data nodes show as strings (green - happy?).  
I tried using a toString() thinking that was the issue. It didn’t help.

var parts = payload.data.data.split(’,’);  
payload.data.tVOC = parts[0];  
.  
.  
.  
payload.data.tVOC\_ppm = (payload.data.tVOC / 1000);

debug log…

- “tVOC”:“3453” . \<–green
- “tVOC\_ppm”:3.453 \<–red

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 2:55pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/2 "2018-11-06T14:55:32Z")

</div>

Could you include a screenshot of the debug log in question? Are you referring to the application debug log, or the workflow debug log?

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 3:19pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/3 "2018-11-06T15:19:38Z")

</div>

both…

 ![debug%20screenshot](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/1X/a47032e9403f813d7efeb3c061e81b0fbf46a83d.png)

and here is a little part of the workflow in question…

 ![%20screenshot%20workflow](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/1X/ecabef9dbf6246cc5d91b913c2241d5f3b84c750.png)

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 3:43pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/4 "2018-11-06T15:43:59Z")

</div>

It looks like not all the devices in your application that have the `tVOC` attribute have the `tVOC_ppm` attribute? If your workflow tries to report state for a device that doesn’t have the `tVOC_ppm` attribute, that value is just going to get silently on the floor. Could that be the problem you are seeing?

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 4:00pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/5 "2018-11-06T16:00:28Z")

</div>

Don’t think so. I’m testing with just a handful of devices that do have tVOC\_ppm as a defined attribute

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 4:05pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/6 "2018-11-06T16:05:54Z")

</div>

Could you watch your [Application Communication Log](https://docs.losant.com/applications/overview/#communication-log) as the workflow reports state for a device? It will include information on exactly what information was passed through, and if any attributes were dropped.

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 4:23pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/7 "2018-11-06T16:23:09Z")

</div>

![aplog%20screenshot](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/1X/019e32160e78e49ec00adc4894dd670fbe34401a.png)

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 4:33pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/8 "2018-11-06T16:33:39Z")

</div>

That screenshot indicates that everything is ok, and I just took a look at some of your devices, and `tVOC_ppm` seems to be reporting just fine? I see values for `tVOC_ppm` in the state history for multiple of your devices? Is there a particular device where you are expecting to see values that you are not?

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 4:39pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/9 "2018-11-06T16:39:24Z")

</div>

Because I couldn’t get it to work I created a separate Workflow as shown below. Currently that one is enabled. I believe that’s why you are seeing the tVOC\_ppm fields getting update. If I turn it off the workflow that has the [particle.io](http://particle.io) trigger on it doesn’t update this tVOC\_ppm attribute.

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

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 4:40pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/10 "2018-11-06T16:40:55Z")

</div>

(it’s just kind of kludgy having to run this second workflow just to update another attribute)

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 4:47pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/11 "2018-11-06T16:47:23Z")

</div>

I don’t think that your second workflow is reporting the values I’m seeing. For example, in the device state log for one of your devices, I see a historical device state report with a `tVOC_ppm` attribute that says it was reported by your `Bluebird` workflow, which is the one straight from the particle integration. If it was your second workflow, the historical state report would say it was reported by the `tVOC ppm` workflow.

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 4:54pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/12 "2018-11-06T16:54:11Z")

</div>

I’ve disabled the tVOC\_ppm workflow.

Device 48005… is on my bench and reporting once a minute.

The tVOC\_ppm had a conditional in it that said if the tVOC\_ppm attribute was null then update it.  
Now that this workflow has been disabled I am not seeing that attribute getting populated anymore.  
I don’t believe that my Bluebird workflow is working…

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 4:58pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/13 "2018-11-06T16:58:48Z")

</div>

actually I think it is working…I think this was me not moving Data Explorer to the most recent event! duh…

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 4:58pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/14 "2018-11-06T16:58:53Z")

</div>

I just watched that device report state, and it reported a `tVoc` of 0 and a `tVoc_ppm` of 0?

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 5:02pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/15 "2018-11-06T17:02:32Z")

</div>

Great! I was definitely getting confused because it seemed to be working as far as I could tell.

---

<div class="post-metadata">

**Author:** ![David\_Armitage](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/david_armitage/32/1060_2.png) [@David\_Armitage](https://forums.losant.com/u/David_Armitage)\
**Post date:** [November 6, 2018, 5:04pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/16 "2018-11-06T17:04:39Z")

</div>

thank you for walking this through with me. Sorry for the dumb user error not noticing that I wasn’t at the current record…

---

<div class="post-metadata">

**Author:** ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)\
**Post date:** [November 6, 2018, 5:13pm UTC](https://forums.losant.com/t/solved-payload-error-im-stumped/1226/17 "2018-11-06T17:13:08Z")

</div>

Not a problem, glad we got to the bottom of it.
