Best Practice: Template sensors vs. Min/Max for energy dashboard (how to deal with changing hardware)

Hi all! I have read a few discussions about using template sensors instead of direct entity references (e.g., power meter entities) when tracking energy for the energy dashboard. I’m looking for advice on the best way to handle hardware changes.

Example with solar power inverters:

  • I had three different inverters until now, each as a separate entity in HA.
  • Two of these inverters no longer exist physically and are disabled in HA, which results in errors (invalid state) for those entities. However the history and the energy dashboard work as intended as the historical data is shown correctly. The third one is up and running.

I’d like to future-proof the setup for hardware-changes, so I’m considering possible solutions:

  1. Individual template sensor for each inverter
    Once the original entity is deactivated I can just insert a constant 0 in the template and all is well.
  2. One template sensor for all inverters
    Each time there is a change in hardware I simply update the template to point at the new entity/the new device.
  3. Combine-sensor (Min/Max) for all inverters
    Use the max of all current, past and future entities.

Long story, two questions:

  • Is there a specific reason to use template sensors over Min/Max?
  • Which approach would you consider as best practice?

I don’t use either. I use a utility meter defined in YAML. I can change the source sensor for that at will. It also allows me to define peak and off-peak tariffs.