You can use properties for persistence purposes:
Is really a jewel to keep integrating functions like measuring Ampere-hours for days to survive a reboot:
- use thing.set_property(); in loop() to save the values
- use thing.get_property(); in setup() to reinitialize the values upon rebooting to where they were before booting.
But then, don’t forget to also put another thing.handle(); and a few ms delay upfront in the setup() to “wake” thinger.io!
If you have only a thing.handle(); later in loop(); you won’t get an error, but the thing.get_property(); in setup() will just return zeroes and your persistence is gone!
Been there, done that!