WTH do some definitions use friendly_name vs name?

Most entity/sensor/etc definitions use “name” to reference the name displayed to users BUT then a FEW things, like sensor templates, use “friendly_name”.

It is always confusing to remember when to use one vs the other…invariable I type in “name” instead of the rarer form of “friendly_name”.

Example:

binary_sensor:
  - platform: template
    sensors:
      sun_up:
        friendly_name: "Sun is up"
        value_template: {{ state_attr('sun.sun', 'elevation') > 0 }}

Why is the above not just “name”!?

It is name for template. You are using the legacy format so that still uses the friendly_name because legacy stuff isn’t changed, it’s just there for backward compatibility. If you look at the non-legacy format you’ll see it uses name

1 Like