Cloning devices

Is there any way to clone the same device in two or more applications, so that they receive the states synchronously?

I have an edge agent X connected to my application, which has a device Y attached to it that receives the states via modbus. I want to clone device Y in another application, without having to repeat the process of creating a workflow to receive the states via modbus.

Thank you.

We don’t have a way to directly push one state report to two devices across multiple applications, but there are some easy workarounds.

Let’s say you have Application A with Device A, which is running the Gateway Edge Agent, is pulling data from the Modbus registers of your hardware, and is publishing that data to Losant over the MQTT broker. Let’s call the value it is reporting “temperature” and say it’s a number attribute.

Alongside that, you have Application B with Device B, and let’s assume that Device B also has a “temperature” attribute (of the number type) that you’d like to receive the same data being reported for Device A.

First, in Application B …

  1. Create a webhook.
  2. Create an application workflow.
  3. Add a Webhook Trigger configured to execute on requests to the webhook you created.
  4. Connect a Device: State Node and configure it to report data for Device B, and pull the state data off the body of the webhook request.

Then, in Application A …

  1. Create an application workflow.
  2. Add a Device: State Trigger and configure it to fire whenever a state report is received for Device A.
  3. Connect an HTTP Node making a POST request to the webhook URL you created in Application B. Make sure that the state data is included in the body of the request.

This could easily scale to multiple devices with disparate attributes through the use of the templating engine and firing the Device State Trigger by matching device tags.