I have been trying to figure out how to create a template sensor for quite a while, and the official template documentation never led me to the correct place. When I use the navigation box in the documentation, clicking on “Automation/Templates” takes me to the “Advanced Configuration/Templating” page.
I eventually found a YouTube video that consumed at least 10 minutes of my life before getting to the point.
All I really needed was to find an example like this:
template:
- sensor:
- name: station_temp_in_f
state: >
{{ "%.1f"|format((( states("sensor.station_temp") | float ) * 9/5 ) + 32) }}
unit_of_measurement: '°F'
state_class: measurement
device_class: temperature