For some reason you cannot set the entity_id of template sensors in YAML, you can set it in the UI. For other sensors you can also set the entity_id in YAML, this should also be possible for template sensors.
For some reason you cannot set the entity_id of template sensors in YAML, you can set it in the UI. For other sensors you can also set the entity_id in YAML, this should also be possible for template sensors.