Friendly_name_template for sensort doesn't work

i’ve created a command_line sensor and want to get the friendly_name from json value.
The icon_template works well but the shown name is still the entity_id.

My customize_glob.yaml:

  unit_of_measurement: "%"
  icon_template: "{{ value_json.icon }}"
  friendly_name_template: "{{ value_json.friendly_name }}"

Any idea wants wrong with this config? Thanks :slight_smile:

Edited: following Tom’s post below

Sorry, this does not look correct.
I don’t think you can use wild cards in names like that, and if you could your sensor is incorrectly defined
Templates are self referential only, The values do not persist
Where did you get these templates?
What does jinja interpreter evaluate these to? (developer tools - template)

We have a feature request for friendly name template, but I don’t think it is yet implemented
So again I’d like to know where you got this from?

Yeah you can for customisation globs. See the bottom example here:

I was a bit surprised the icon template worked though. I don’t see how using value_json... in the customisation section is tied to the command line sensor. But if it works…

@schluggi what does the output of your command line sensor look like?

Here the output. You can use value and value_json in the jinja template.

{ 'icon': 'mdi:hotel', 'value': 34, 'friendly_name': 'Pong (Bed)' } 

The customisation globs works well and as seen in the docs, friendly_name_template is a possible sensor argument.

I also tried to define the friendly_name via arguments but this doesn’t work either :frowning:

Well I learnt something here today, I’ll follow this thread and try and learn more

Yeah I realise that you can use those variables in your command line sensor but in customize?

What should i say, icon_template works well.

After testing i can say friendly_name_template doesn’t work at all. Not in customize_glob.yaml and also not in customize.yaml even without a “real template”. In configuration.yaml it’s not allowed to use: [firendly_name_template] is an invalid option for [sensor.command_line].

Can anyone confirm this? If not, please post your configuration/customization.
Or in other words: How can i use friendly_name_template?

You realized that you had a spelling error ( firendly_name_template instead of friendly_name_template)?