Try adding the line that I proposed in your configuration.yaml. This goes directly in your configuration.yaml and NOT under the sensor header. The template sensor I proposed is based on State-based Template Sensor-
template:
- sensor:
- name: "UPS Temperatura Reale"
unit_of_measurement: "°C"
device_class: temperature
state: >-
{{ states('sensor.riello_ups_temperature_real') | int / 10 }}
The result of this template is a new entity called sensor.ups_temperatura_reale that you can use in your lovelace dashboard.
Currently, there are 2 formats that you can use to create template sensor - Modern Template Sensor format and Legacy format.
Mine uses the modern format to configure Template Sensor (see here).
The one that you first want to use is called Legacy Sensor. If you want to fix your legacy sensor, change it like below. This code assumes that you don’t have sensor: !include sensors.yaml in your configuration.yaml file.
sensor:
- platform: template
sensors:
ups_temperatura_reale:
friendly_name: "UPS Temperatura Reale"
device_class: temperature
unit_of_measurement: "°C"
value_template: >-
{{ states('sensor.riello_ups_temperature_real') | int / 10 }}
I believe yours encountering error because the formatting is incorrect. Refer to the Legacy Sensor link that I provided.
No. As I said previously, your legacy format does not work because it is formatted incorrectly.
This is entirely up to you. Some want to tidy up their configuration.yaml file by splitting their configuration, while others may want to have it all in one place.
If you decide to split your configuration, please read this-