I’ve attached a workflow file that will hopefully help get you started. You’ll definitely want to tweak it to fit for your use:
set-daily-count-develop.flow (4.2 KB)
Here’s an explanation of the nodes used:
-
Device: State Trigger - Activates any time the selected device sends a device state report containing any attribute other than the
newCountattribute that we’ll be defining downstream. For this example, let’s say the “total cycles since boot” attribute is calledtotalCountand is available on the initial payload atdata.totalCount. -
Storage: Get Value Node) - We’re using workflow storage to store the previously reported
totalCountvalue, from the previous execution of this workflow. Let’s call thislastTotalCountand place it on the payload asworking.lastTotalCount. -
Math Node - Here I used
max( ( {{ data.totalCount }} - {{ working.lastTotalCount }} ), 1 ). This determines the difference betweendata.totalCountandworking.lastTotalCount. The result is stored asworking.newCount.- This example uses the
maxfunction to ensure the result is always at least1, that way if the machine is reset and thetotalCountattribute goes back to, say,0or1, you never have a resulting value of less than1when subtracting the previously reportedlastTotalCountvalue. Of course, you’ll want to adjust this logic to your use-case.
- This example uses the
-
Device: Update Node - Creates a new attribute on the device called
newCount, if the attribute doesn’t already exist on the device. -
Device: State Node Output Node - Sets the
newCountattribute value on the device from{{working.newCount}}. -
Storage: Set Value Node - Now that we’re done referencing the old
working.lastTotalCountvalue from workflow storage, we’re going to update it to the newly reported value we received on the payload atdata.totalCount.
Now you have a newCount attribute on the device. In a Bar Chart (or other time series dashboard block), you can set the Aggregation to Sum, which will add up all of the newCount values reported within the selected Duration (e.g. 24 hours):
Hopefully this is helpful! If you have any other questions, please don’t hesitate to ask.

