Persist value of a variable

I created a simple automation that announces when LG washer is finished and would like to persist a variable of the cycle used: (example: Towels) and include this in the announcement after the cycle completes.

What happens is once the washer completes, the state of the cycle switches from “Towels” to “-”.
So how can store the state attribute value before the washer completes and then recall it?

Have you looked at Variables+History from HACS?

Thank you, I’ll take a look.
It also just dawned on me that I could probably create an input_text helper and store the value using the following:

service: input_text.set_value
  value: "{{ state_attr ('sensor.front_load_washer', 'current_course' ) }}"
  entity_id: input_text.washer_cycle
1 Like