- Chart a temperature sensor's reading over time (more on this later)
- Restore an Item to the state it had prior to openHAB closing down or restarting
- Use the state of an Item in the past, or some aggregate of the state of an Item in the past (e.g. average since one hour ago) in automation rules (more on this later).
One special persistence strategy is `restoreOnStartup` which will update the Item with the most recently saved Item state when openHAB starts up or otherwise refreshes the Item.
The good news here is that if you don't know what you may want to use persistence for, you can just keep the defaults and move to the next step.
See the documentation for the specific persistence add-on for what the default strategy is.
This default can be overridden.
Unfortunately, configuration of persistence strategies is still text-based.
See the [Persistence docs]({{base}}/configuration/persistence.html) for full documentation, and see the installation page for the method you used to install openHAB for a table listing file locations.
For example, a common approach would be to use [`MapDB`]({{base}}/addons/persistence/mapdb/) only for those Items that should be restored on startup, [`rrd4j`]({{base}}/addons/persistence/rrd4j) with an `everyChange` and every minute strategy for number and binary (Switch, Contact) type Items that are to be charted, and [`Influxdb`]({{base}}/addons/persistence/influxdb) with an `everyUpdate` strategy for analysis with external tools.
openHAB ships with [`rrdj4`]({{base}}/addons/persistence/rrd4j) as the default persistence database and comes with a default persistence strategy of `everyChange`, `everyMinute`, and `restoreOnStartup` for every supported Item.
However, the way it achieves this (replacing ten readings with the average of the ten readings as the data gets older) makes the database not work for all Item types.
If you need to `restoreOnStartup` unsupported Item types, `MapDB` might be a better choice for you.
The reason one would set up both the Model discussed in the previous tutorial and Persistence is that it will make creating your user interfaces much easier and much more rich.
And just about anyplace you can interact with an Item in MainUI, there will be an "Analyze" button that will generate a chart based on the data saved in persistence.