FWIW, I created a python_script to save/restore lights & switches. It’s described in this topic, and can be obtained from here. If you think this might help you, and you have questions, just let me know.
2 Likes