Help with energy sensor templates - Negative to positive

Please format your pasted config as per: How to help us help you - or How to ask a good question

The legacy template sensor format does not support state_class. You should be using the new format for template sensors as the legacy template sensor format is no longer receiving new features.