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
Could you include a screenshot of the debug log in question? Are you referring to the application debug log, or the workflow debug log?
both…
and here is a little part of the workflow in question…
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?
Don’t think so. I’m testing with just a handful of devices that do have tVOC_ppm as a defined attribute
Could you watch your Application 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.
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?
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 trigger on it doesn’t update this tVOC_ppm attribute.
(it’s just kind of kludgy having to run this second workflow just to update another attribute)
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.
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…
actually I think it is working…I think this was me not moving Data Explorer to the most recent event! duh…
I just watched that device report state, and it reported a tVoc
of 0 and a tVoc_ppm
of 0?
Great! I was definitely getting confused because it seemed to be working as far as I could tell.
thank you for walking this through with me. Sorry for the dumb user error not noticing that I wasn’t at the current record…
Not a problem, glad we got to the bottom of it.