Guys, I have an MQTT message that comes in from a Arduino to my Node-red. This String when received is essentially a binary representation of the state of output pins on the Arduino - so i might see a value like 176, 160, 200 etc - Each of these cases represents a different state (on or off) of a group of 8 pins on my Arduino.
I am currently getting this info and using the change node to interpret these and subsitutue plain english for display on my dashboard. All works well.
These values come in once per minute - regardless of whether or not they have changed - so i could just see the same number over and over again during the day
I would now like to try and record when i see a transition of values - lets say 176 represents Solar On, Circulating Pump on and 160 represents Solar on No Circulating pump (house may have overheated for instance)
So i would like to track the last value received, compare that to the current value and if there is a change then store that information to give me essentially runtimes for pumps etc etc
My first stage is to detect the transition - would a reasonable approach be to set a global variable that represents the last received value and then compare that, if there is a change i could then write the relevant information to a DB of some type ? This would essentially be time sequence data when interpreted - so Solar on at 9:30, Solar off at 11:30 etc - would sqlite be the right engine for this ? There would be at most 7 entities to track and maybe 100 transitions (max) in the space of a day.