Trigger based template sensor to store global variables

A post was split to a new topic: Help with dishwasher automation