Help trying to create an entity from an attribute

Ive been trying to create a entity that shows another entities attribute value but I dont know how to format it in my config without a bunch of errors.

friendly_name: "Sunroof Status"
value_template: "{{ state_attr('sensor.cld17m_lock_2', 'sunroofstatus') }}"

configuration.yaml

template:
  - sensor:
      - name: "Sunroof Status"
        state: "{{ state_attr('sensor.cld17m_lock_2', 'sunroofstatus') }}"
2 Likes

Thank you!
I was trying to add it to platform template :man_facepalming: I don’t normally fiddle with the yaml.