Adapting this: How to automatically include and sum the values of multiple Utility Meter Sensors
Gives you:
value_template: >
{% set ns = namespace(states=[]) %}
{% for s in states.sensor %}
{% if s.object_id.endswith('_energy_power') %}
{% set ns.states = ns.states + [ s.state | float ] %}
{% endif %}
{% endfor %}
{{ ns.states | sum }}