In order to persist one or two values between reboot I need to set up one of the db addons?
Update: After posting, I continued to research.
I see that mapdb allows the persistence of item states. I have not found anything about saving the state of values defined with a “val” statement in a rule. For example, a simple counter variable that one might want to restore after a power outage, but never is represented as an Item.
They’re out there… somewhere. I summarized a few options in this post. Also read Rich’s followup. To read/write to a file, you could use executeCommandLine to do something from a shell, or use something from java.io.
Check the documentation here. There is also a tag in the forum you can read through, but most of it is older. Ping me if you have any questions. You may find it if you drill down enough, but look at the openhab-Jython repo. I have a few changes to add, including some more documentation. In the OH-Jython-Scripters lucid repo, you will find a link to a Slack channel where there is some more discussion.
I saw your post about Kotlin and it sounds interesting, but Jython is working well for me. I haven’t found any info yet on developing a binding with it, but will look into it more once I’ve migrated all of my rules, but I will probably look at adding LSP first.