I believe the difference between an entity attribute and a sensor (entity state) is that Home Assistant’s SQL database (History) does not keep the history of an attribute, but it keeps the state. So when you make a sensor from an attribute, it will cause the database to keeps its historic data.
Think of it this way, the developer of the integration thought it was an unnecessary waste of resources or cost to keep that data historically. If they thought it was essential to keep that data history, they would have made it a sensor instead of an attribute.
In your case, you would normally want to see a temperature history. I always add
secondary_info: last-updated
to all the sensors I view in the Lovelace so that I can see when they were updated. You might find that your thermostat current temperature is not producing a humanly sensible historic data.
You are trying to name an entity to sensor.media_player.frametv_title which can’t be done.
And I believe you have indentation issues also.
This is probably correct:
sensor:
- platform: template
sensors:
frametv_title:
friendly_name: FrameTV Media Title
entity_id:
- media_player.frametv
value_template: "{{ state_attr('media_player.frametv', 'media_title' }}"
Thanks for your quick help! I really appreciate it.
With your config I am getting the following error:
Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: unexpected '}', expected ')') for dictionary value @ data['sensors']['frametv_title']['value_template']. Got "{{ state_attr('media_player.frametv', 'media_title' }}". (See ?, line ?).
Alright, I’ve made use of the latest yaml and inspecting the sensor through Developer Tools → State it tells me that state = unknown. It’s been more than 24h since I added the stanza, and I’ve also restarted HA repeatedly.
Why might this not work? How should I diagnose the issue?
- platform: template
sensors:
thermostat_fan:
friendly_name: Thermostat fan
value_template: "{{ state_attr('climate.thermostat.attributes.fan', 'off') }}"
outdoors_temperature:
friendly_name: Outdoors temperature
value_template: "{{weather.thermostat.temperature}}"