Workflow: apply command to the device that triggered the command


#1

We are implementing a control system, where a device state triggers a command (through a conditional).
We have figured out that we can issue the command in the “Device Command” box for
“Use Device ID(s) specified on the current payload” on the JSON “relayId” field. Is that the
correct way to do this, ie. is this a permanent solution?

Thanks.


#2

Hi,

I would recommend using triggerId, when using a Device State Trigger. The triggerId will always be the device ID that you triggered when you reported state whereas the relayId is the ID of whatever caused the state to trigger. For example, if you are using the device simulator to test your workflow and report device state periodically then the relayId would be the device itself and relayType would be device. However, if you used another workflow to send state to a device, then the relayId would be that of the workflow and the relayType would be flow.

Hope this helps,
Erin


#3

Thank you, that works too.
BTW, we need to simulate many sensors in our control system, dozens, hundreds.