The trigger-based template sensors are a great addition, improving a lot e.g. event-based sensors (no need for helpers and automations any more).
However, when HA reboots, sensors may remain unavailable, and their attributes absent, for a long time before a first event will populate these info.
An improvement would be to add variables such as initial and restore, the same way other core integrations have (e.g. counter).
We could then control whether we want a trigger-based template sensor to restore the last known values (state and attributes) when Home Assistant starts or its initial values when reloaded, for instance.
My suggestion applies to your original complaint :
As for “templates triggered by events”, that’s a very specific use-case and, until Trigger-based Template Sensors were recently introduced, completely unsupported by traditional Template Sensors.
Effectively, your Feature Request is to support a specific kind of trigger, namely an Event Trigger because the template cannot be evaluated at any time (like startup or reload) other than when the event actually occurs.
However, the Feature Request introduces concepts contrary to a Template Sensor’s fundamental behavior. The purpose of a Template Sensor is to evaluate its template to compute a value. The value is always calculated, never stored or initialized.
Anyway, good luck convincing the development team to modify the architecture of the Trigger-based Template Sensor.
So I registered two events, one is the restart and the other one is the data I am really interested in. I then query the platform of the event to distinguish between them. I use the restart event for initializing and the state event for my logic.