Sensor templating for additional informations should be done with the the device or inside HA?

First of all … newbie question (less but a week with HA) , plz keep that in mind, perhaps it was asked already but I wasn’t able to dig it in here.

Assume I got some ESPs running with temp/humi whatsoever sensors.

Since wanting things such as dewpoint, humiindex, … perhaps even parallel output in °C aswell as °F I’m aware of these possible ways to do so:

a) add the code for the ESP itself so that calculations are all done by the ESPs?

b) I could keep the ESPcode clean by simply offering the sensordata doing such calculations within a sensors.yaml file.

Is this upon the users choice or is there a recommended way which offers advantages against the other?

No real advantage either way.