Automation: "global variables" and sensor states

Not sure if this is exactly what you’re aiming for, but I use a slider as a “number holder” to remember the state of my front porch. This example shows how to set and retrieve the value: