Workflow Reentrant Loop For Device

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