I have built a simple application which connects to my IoT temp sensor device and sends an email based on the temp--warm, just right, and cold. To do this I've used the IBM IoT node for connecting to my IoT device, and then processed the data with case statements to fall into the three buckets: warm, just right, and cold. From there I generate an email and send the temp category to my email address.
However, my temp sensor is measuring and sending data every 1 second so my app is sending an email every 1 second--which is too often. Instead I'd like to only send an email when there is a transition between the three temperature states. Naturally, I'd like to implement this with a state machine or the case statement processing block. This requires that I have both data points: the current temp measurement and the last recorded measurement. What is the best way to go about storing the last recorded temp measurement and are there any tips on the node flow I should use?