Template sensors can have a friendly_name_template to derive their name lets say from a JSON response.
But for template switches the friendly_name_template does not work. Why?
Because it wasn’t written to include one.
Ok, I changed homeassistant/components/template/switch.py to handle friendly_name_template. Now it works.