We have sensor readings coming into losant as attributes and a workflow triggered by a device state block, which creates an event if the reading is beyond a limit (using a latch block to prevent creating new events each time state is reported). An example of this would be a temperature sensor creating a HI Temp event, which works as expected. We would like to only allow a new event to be created for this specific sensor/condition if the user has acknowledged or resolved the previously created event. Currently when we have a process that ‘cycles’ up and down there can be multiple events created. Could you recommend a way to accomplish this?
We do something very similar in the recently released Asset Tracker template. There, we base whether to create a new event based not on whether a previous one was resolved, but whether there has been an event logged per shipment (which is tracked on the device).
In your case, I would forget about the Latch Node and use an Event: Get Node instead. Prior to deciding whether to log a new event, use the Event: Get Node to see if there exists a matching event in the “new” state, and only create the event if none are found.