Template of template (or : blueprint of template)?

Hello there,

I have zigbee bulbs that don’t work right away - I’m sure this will be fixed some way and I’ll open a dedicated subject about these enki bulbs (issue has already hapenned for ikea bulbs, so…) , but for now I’m wondering about HASS configuration.

To make those bulbs work , I had to make sure the brightness changes happen with a 0.001 transition. In order to do that, I created a"template light" for which I have several questions :

    e27_salon1:
        friendly_name: "Salon 1"
        value_template: >-
          {% if is_state('light.ampoule_e27_salon1_level_light_color_on_off', 'on') %}
            on
          {% else %}
            off
          {% endif %}
        color_template: "{{ state_attr('light.ampoule_e27_salon1_level_light_color_on_off', 'hs_color') }}"
        white_value_template: "{{ state_attr('light.ampoule_e27_salon1_level_light_color_on_off', 'white_value') }}"
        level_template: >-
          {% if is_state('light.ampoule_e27_salon1_level_light_color_on_off', 'on') %}
            {{ state_attr('light.ampoule_e27_salon1_level_light_color_on_off', 'brightness') }}
          {% else %}
            0
          {% endif %}
        
        turn_on:
          service: light.turn_on
          data:
            entity_id: light.ampoule_e27_salon1_level_light_color_on_off
            
        turn_off:
          service: light.turn_off
          data:
            entity_id: light.ampoule_e27_salon1_level_light_color_on_off
            
        set_level:
          service: light.turn_on
          data_template:
            entity_id: light.ampoule_e27_salon1_level_light_color_on_off
            brightness: "{{ brightness }}" 
            transition: 0.001
        set_temperature:
          service: light.turn_on
          data_template:
            entity_id: light.ampoule_e27_salon1_level_light_color_on_off
            color_temp: "{{ color_temp }}"
            transition: 0.2
        set_color:
          service: light.turn_on
          data_template:
            entity_id: light.ampoule_e27_salon1_level_light_color_on_off
            hs_color:
              - "{{ h }}"
              - "{{ s }}"
            transition: 2

Now the questions:

1 : as you can see, I’m repeating again and again the light entity ID : when I added a 2nd bulb… I copy/pasted all of this, and had to change the entity ID everywhere in the new template… same for 3rd bulb. And when I want to change something, I’ll have to edit all 3 (or more) template lights… Looking at blueprints, it looks like the perfect thing to “instantiate” a specific template, but I think blueprints only are meant for automations ? So : is there a way to have “custom templates” or template blueprints or templates of templates where I would only have to change on thing like a “target”, and where the other properties would be the same as the model ? Or maybe I’m not doing the thing correctly, if so I’m all ears

2 : if not : copy/pasting the light id everywhere is not very nice… is there a way for me to use some “variable” in the template and to refer to that same variable below ?

Thanks && regards (and thanks for this awwwwwsome piece of software ! :] )

The answer is “No” to both questions.

When faced with this issue, I just use my text editor’s search-and-replace function. It’s a trivial task to replace all instances of one string with another.