It’s 4.56am here. I live in Italy. Don’t do this stuff if you’re not totally awake.
Energy Integration needs energy sensors. If you have power sensors, you need to calculate the energy. You can use the Riemann sum integral integration to do that.
If you need an example, here’s the configuration of the sensors for a Tesla PowerWall system (link) made by @briancmoses
Brian made a nice configuration to adapt/rename the existing power sensors using template sensors and also defined the corresponding energy sensors using the integral platform. You can learn a lot from his configuration.
sensor:
- platform: template
sensors:
grid_return_kw:
friendly_name: "Grid Return (kW)"
device_class: power
unit_of_measurement: kW
value_template: "{{ states('sensor.powerwall_site_now') | float | min(0) | abs | round(4) }}"
grid_consumption_kw:
friendly_name: "Grid Consumption (kW)"
device_class: power
unit_of_measurement: kW
value_template: "{{ states('sensor.powerwall_site_now') | float | max(0) | round(4) }}"
powerwall_charging_kw:
friendly_name: "Powerwall Charging (kW)"
device_class: power
unit_of_measurement: kW
value_template: "{{ states('sensor.powerwall_battery_now') | float | min(0) | abs | round(4) }}"
powerwall_discharging_kw:
friendly_name: "Powerwall Discharging (kW)"
device_class: power
unit_of_measurement: kW
value_template: "{{ states('sensor.powerwall_battery_now') | float | max(0) | round(4) }}"
- platform: integration
source: sensor.powerwall_solar_now
name: energy_solar
- platform: integration
name: energy_totalConsumption
source: sensor.powerwall_load_now
- platform: integration
name: energy_grid_consumption
source: sensor.grid_consumption_kw
- platform: integration
name: energy_grid_return
source: sensor.grid_return_kw
- platform: integration
source: sensor.powerwall_charging_kw
name: energy_powerwall_charging
- platform: integration
source: sensor.powerwall_discharging_kw
name: energy_powerwall_discharging