@Cameron-Payne
Hello and welcome!
Great to hear your success :)
About saving the state you shoud look at this ;) https://www.mysensors.org/download/sensor_api_20#saving-state And there are more infos about the API.
Shortly save your state when it change, and load it in your setup.