The entity_id
option was deprecated many versions ago. You can simply remove it. However, the resulting Template Sensor will not be compatible with the Energy integration.
Why? Because it lacks this:
state_class: measurement
However, you cannot simply add that to the Template Sensor you posted because it uses the old-style method of configuring a Template Sensor (what is now known as the ‘legacy’ method). The ‘legacy’ style of Template Sensor doesn’t support the state_class
option.
You have to define the Template Sensor using the new ‘modern’ format as shown in the documentation for the Template integration. It supports the state_class
option.
There’s an example posted here with additional information: