Events Only Generated by Simulated Data

Hello! My dashboard receives data from both simulated devices and live devices. When the simulated devices generate an event, it populates the event list block as expected, but when one of the live devices enters an identical mode, there are no events generated. I am looking at the Event Node in the workflow, but cannot identify where this issue may be arising.

Any feedback would be greatly appreciated!

@Kyle_Wisbrock we’re happy to help, but could you provide an export file of the workflow in question? There’s not much we can do to help debug the issue without seeing your current implementation.

Hello Dylan,

I tried to attach the exported workflow to this comment, but I get an error that says “new users cannot upload attachments.”

Are there any other avenues of sharing the exported workflow?

Thank you,
Kyle

@Kyle_Wisbrock we just bumped your attachment limit up, so you should be able to put the file on this thread now. Can you please try again and see if it works?

simulate-and-update-device-develop.flow (25.7 KB)

That worked! Thank you Dylan.

Thanks; here’s where I think your problem lies. See attached …

  • Your Switch Node is routing based on the value of {{data.simulate}}
  • Your Virtual Button does not include that value in its default payload; however, since you said this was working when simulating devices, I am guessing you are invoking that Virtual Button with a different payload, possibly through an Input Controls Block, a Workflow Trigger Node, or through the Losant API directly.
  • Your Device: State Trigger, however, will never include a value at {{data.simulate}} – unless it triggers off a device reporting an attribute named “simulate” – and you are not adding one in the Mutate Node that follows it.
  • Therefore, your workflow is falling through to the “Default” case in your Switch Node, and that’s where it ends as there are no other nodes connected to that case. You can confirm this by attaching a Debug Node to that “Default” output and seeing if it fires when the workflow is invoked by the Device: State Trigger.

Let me know if that points you in the right direction.

Hello Dylan,

Good catch, the device data will never have a value at data.simulate. I am still relatively new to Losant, especially in terms of workflow development. How would you advise I update this workflow such that the events are triggered by live devices as well?

Let me know if you require any additional information.

Thank you,
Kyle

@Kyle_Wisbrock that depends on how these alarms would be triggered by device state reports. Can you tell me more about how you are determining these various alarm states? For example, are your devices reporting a string attribute value of “BatteryLow”? Or are they reporting a number attribute for the battery’s voltage level and, if it’s beneath a certain threshold, that should trigger a “BatteryLow” event?

@Dylan_Schuster For the low battery alert, when the device detects the battery voltage has dropped below a certain threshold, it will provide a low battery status in the payload. The dashboard is taking the “battery_health” attribute from the device payload and using that to determine whether it is “OK” or “NG”.

The Gas Alarm notification is similarly used by checking the “gas_alert” attribute from the device payload. If it is a 0, then the device is not in alarm. If it is a 1, then the device is in alarm. “gas_alert” is the attribute created for the simulated devices, which I believe was mutated to “AlarmActive” for the live devices.

Let me know if you need any more background information on these states. Thank you for your help, it is much appreciated.

So, you don’t have to do it this way, but if you’re past the point of needing to simulate conditions for testing, I would break up each individual case into its own workflow.

Taking the battery level example, I’d build a new workflow that …

  • Starts with a Device State Trigger that triggers only on your battery voltage attribute
  • Uses a Conditional Node to determine if the reported value is above or below the “healthy battery” threshold.
  • Connects an Event: Create Node out of the Conditional Node’s output for when the battery is not in a healthy state.

Also, you don’t necessarily need extra attributes on your device to reflect the battery’s state in a human-readable string. Using a variety of dashboard blocks (such as the Indicator Block), you can display that to your end users off of the raw battery voltage value.

Hello @Dylan_Schuster,

We were able to create a new workflow that allowed for events to be generated by live devices. It has been tested and validated. Thank you for your assistance, it is much appreciated.

Thank you,
Kyle

Glad to hear it! Please reach out if you have any additional questions.