Add a friendly name template to the new template sensor format

Add a friendly name template to the new template sensor format. It’s the only thing missing from the legacy format.

I believe your wish is already granted (with one hitch).

If I do this:

  - name: "testing_{{ now().ctime()[:3] }}"
    unique_id: 'just_a_test'
    state: "{{ now().ctime() }}"

I get this:

However the hitch is I have lost control of the entity’s object_id. It has been automatically set to template_just_a_test (a concatenation of “template_” and the unique_id).

To regain control of it, I can modify it via the UI (not via its configuration).

From this:

to this:

and now it appears with my preferred object_id and templated friendly_name.


The only thing that remains to be seen is if its friendly_name will change to “testing_Thu” tomorrow. :slight_smile:


EDIT

Confirmed; it works (testing_Thu).

1 Like

Will this work to create unique_id for devices that don’t get one in their ‘native’ integration?

thank you

  • This topic is about dynamically defining a friendly_name for a Template Sensor.
  • Your question (I think) is about how to assign a unique_id to any entity (device?) generated by an integration that doesn’t normally assign a unique_id.

Where’s the connection between the two?

Surprised to see people continue to vote for this Feature Request when it’s already possible. :thinking: :man_shrugging: