Rule - Variable or Dictionary - Save Previous Sate of Multiple Items?

There will be a sunrise in the morning, so things are looking up!

What you are describing is one of the things that you can implement through a persistence service. You can configure it to backup the state of specific Items and then restore those states when OH starts back up. Is there are reason why you are not using persistence for this, or is this the first you are aware of it?

It is also possible to read and write data to the file system from a rule. There are some posts in the forum, like this…

If you’re using Jython, it is real easy to use the native stuff… Chapter 5: Input and Output — Definitive Guide to Jython latest documentation, or you can use Java.