I’ve got a python script which would really benefit from knowing some info from previous runs of the script, so I would like to be able to save/restore state values somewhere.
My guess is that this is done in one of three ways:
- Define entities (which aren’t associated with any device) and manipulate them with hass.states, maybe? I’ve seen an integration which adds support for variables, but is there nothing like this already built into HA?
- Maybe there’s some API for each script to have it’s own persistent key-value store associated with it’s script name?
- As a last option, maybe we can save values (via pickle?) to a local file, but I’m loathe to start saving things into a common file-system location.
What’s the accepted way of preserving state across python_script executions?