I like to test on a global.var before the last change.
So if the last var before change is 0 and it is now 3, I like to know that the last value was 0.
Is this possible in NodeRED?
Or do I need to make a var for the last status?
I like to test on a global.var before the last change.
So if the last var before change is 0 and it is now 3, I like to know that the last value was 0.
Is this possible in NodeRED?
Or do I need to make a var for the last status?
You can always test a global variable before you change it. or you can create one that holds two values like this:
var blah = { oldvar: “foo”, newvar: “bar”}
then you would save it as a global, and each time you change it you would retrieve it from global, assign newvar to oldvar and then assign your new value to newvar.
You are talking about storing state information and you have an embarrassing number of options. You could write them to:
For my money MQTT is the best bet. If you have HA and Node Red then you really should have MQTT running as well and pointing MQTT Explorer at it is so easy to watch what is going on, on the fly.
A file is prone to locking snags and a db may be too much “stuff”.