Hi all,
I have setup integration between my Victron inverter and HA via modbus and I can see the readings fine. However I seem to get some strange behaviour when trying to convert the readings in W from Victron to kWh to monitor on the energy dashboard. I see random jumps in the integration calculated values on the history/energy pages.
Modbus:
modbus:
- name: Victron
type: tcp
host: 192.168.2.10
port: 502
sensors:
- name: "Victron Battery Power"
unit_of_measurement: W
slave: 100
address: 842
Template sensors (to flip negative readings to a positive for discharge)
- sensor:
- name: "ESS_battery_discharge_power"
unique_id: sensortemplate.batterydischarge
device_class: power
unit_of_measurement: "W"
state: "{{ max(0, 0 - states('sensor.victron_battery_power') | float) }}"
- name: "ESS_battery_charge_power"
unique_id: sensortemplate.batterycharge
device_class: power
unit_of_measurement: "W"
state: "{{ max(0, states('sensor.victron_battery_power') | float) }}"
Integration sensors (used in energy dashboard)
sensor:
- platform: integration
source: sensor.ESS_battery_discharge_power
name: ESS Battery Discharge
unit_prefix: k
round: 2
- platform: integration
source: sensor.ESS_battery_charge_power
name: ESS Battery Charge
unit_prefix: k
round: 2
Now when I display these on history tab, I can see that periodically ‘ESS Battery Charge’ will jump a few kWh whereas its been getting a constant feed from ‘Victron Battery Power’. See the example below, it reported a charge at 1:20:32 of 1343W which stopped at 1:20:47, but for some reason the ESS Battery Charge has reported an increase of 4.32kWh (190.48 reported at 18:33 the previous evening, then 194.8 reported at 1:20:32). This coincides with solar charging stopping (a bit after 18:33)
In the image below you can see the last reported positive readings (charging) around 18:35pm, so ESS battery charge is rightly showing 0 until it gets some charge at 1:20:32, but I cant understand why it jumps 4kWh at that point.
Any ideas? It’s not been showing any update in charge overnight, quite rightly, and it seems the next spike after 1:20am seems to be added correctly (note the little increase far right to ESS Battery charge). It shouldnt be accumulating little changes in that time as Victron Battery Power has been reporting below 0.
This shows as a very obvious blip on the Energy Dashboard between 1-2am which never happened in reality.
From Victron reporting, it is showing the ~3kWh consumption from our hot water heater running at the time, but the line showing battery state does not move as its not being used at the time (running on cheap grid power).