-
Where are you putting this config?
-
Did you restart HA or just reload your config? The first time you use any new integration you need to restart. Then after that you can use reload.
EDIT: Also to prevent odd results when one or more sensors are unavailable you should use an availability template in each sensor, e.g.:
template:
- sensor:
- name: "Total Electricity Consumption"
unique_id: total_electricity_consumption
state: >
{{ (states('sensor.energy_consumption_tarif_1') | float(0)) + (states('sensor.energy_consumption_tarif_2') | float(0)) }}
availability: >
{{ has_value('sensor.energy_consumption_tarif_1') and has_value('sensor.energy_consumption_tarif_2') }}
unit_of_measurement: "kWh"
More here: Why an availability template is important for energy template sensors