Hi everyone, I created some sensors to monitor the energy dashboard, only it doesn’t give me good values (as you can see from the screenshot). What am I doing wrong?
SENSOR CODE:
template:
- sensor:
- name: "Battery Power Charging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, 0 - states('sensor.solarnet_batteria_di_alimentazione') | float(default=0)) }}"
- name: "Battery Power Discharging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, states('sensor.solarnet_batteria_di_alimentazione') | float(default=0)) }}"
- name: "Power Photovoltaics"
unit_of_measurement: W
device_class: power
state: "{{ states('sensor.solarnet_potenza_fotovoltaica') | float(default=0) }}"
- name: "Power Grid Import"
unit_of_measurement: W
device_class: power
state: "{{ states('sensor.solarnet_power_grid_import') | float(default=0) }}"
- name: "Power Grid Export"
unit_of_measurement: W
device_class: power
state: "{{ states('sensor.solarnet_power_grid_export') | float(default=0) }}"
sensor:
- platform: integration
source: sensor.battery_power_charging
name: "Total Battery Energy Charged"
unit_prefix: k
method: left
- platform: integration
source: sensor.battery_power_discharging
name: "Total Battery Energy Discharged"
unit_prefix: k
method: left
- platform: integration
source: sensor.power_photovoltaics
name: "Total Photovoltaics Energy"
unit_prefix: k
method: left
- platform: integration
source: sensor.power_grid_import
name: "Total Grid Import Energy"
unit_prefix: k
method: left
- platform: integration
source: sensor.power_grid_export
name: "Total Grid Export Energy"
unit_prefix: k
method: left