Values resetting when wifi drops

Hello, I am having an issue with the wifi connection and storing variables in the particle relay board.

I have written a program for controlling heating using the particle relay board and also the do button from iftt. The do button switches on the heating for a set time say 30 minutes.

My issue is that my particle relay board disconnects and reconnects a lot from the wifi and each time this happens, the time for heating on gets reset to zero.

Anyone found problems with time.minute() causing the relay board to crash and reset the wifi, (because when I printed it to the console I noticed that sometimes it printed a very large number)?

Any ideas how to not lose a variable when the wifi disconnects and then reconnects?


If you’ve got some code for us to look at, that’d help a lot.