Workflow Reentrant Loop For Device

Hi, I am trying to place the proper value for pressure sensor.
from Gateway I am getting the raw value, and I am just trying to divide by 100. Using math node I managed to do it.
On debug window shows correct value.

Adding a device state node, pop up an error like "Workflow Reentrant Loop For Device ".
The question I have after I read the help documentations is the following

I have the data.Pressure attribute.
In device state node I place the value again in the same attribute. and then error pop up.
And the only value shown in data is Pressure. all the rest are missing.

I am not getting the idea what do I need to place in value field . Thanks in advance

So “Workflow Reentrant Loop For Device” means that the workflow is actually ending up in an infinite loop - where the workflow is triggered by a device state, that workflow then changes that devices state, the same workflow is triggered again by that change, and then tries to set the state again (it is on this last bit that we throw the error, to prevent the loop from continuing).

It sounds like you do want to modify the state report when the state is initially reported, but you don’t want to change the state again when the workflow fires again due to the changed state. You will need to add a conditional node, to make sure you are only hitting the change device state node when it is an original state report from the device. The easiest way to check for this is to compare against the relayType field on the payload - if the value is flow, that means that the workflow was triggered due to state changes made by a workflow, and in that case you don’t want to continue and set the state again.

I’m going to add a task on our side to add some information on that error to our documentation, to explain what causes it and how to prevent it. Hope this helps!

1 Like