Thanks, exactly what I’m looking for. Though I get an error as shown below - any ideas?
Edit: OK, sorry about this - as a newbie I triggered the automation from the UI which apparently doesn’t attach the trigger… Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘to_state’ - Configuration - Home Assistant Community (home-assistant.io)