@Remko sorry to bother you again, any more ideas to my problem ?
Sorry… On a business trip for a few weeks, not really having a chance to look at it…
Sure no problem, when you are back if you have time then let me know if you have ideas, thx
Sorry for the late reply, I just didn’t get to this again.I have been reading the thread from top to bottom again and I do not understand why it is incorrect.
First to the battery…I cannot say anything about that. It seems that the sensors are correctly defined and the values come directly from the Modbus, so not much I can say about that.
I do not understand the configuration of your energy dashboard and the sensors you are using there. So could you please post the config of the energy dashboard and also post the yaml definition of the sensors your are using there? The first 2 I also do not understand…both AC and DC sensors…?
The weird thing is that it does not show a line in the graph for the “solar to grid”, which you should have.
Maybe you can also post some history graphs of the sensors.
I am not sure if I can help, but I can have a look at it.
No worries, thank you for taking the time to get back to me.
My sensors for Energy Dashboard :
- platform: integration
source: sensor.pv_dc_power
name: "Solar Energy Yield DC"
unit_prefix: k
round: 2
- platform: integration
source: sensor.pv_ac_power_fronius
name: "Solar Energy Yield AC"
unit_prefix: k
round: 2
- platform: integration
source: sensor.battery_charge_power
name: Battery Charge
unit_prefix: k
round: 2
- platform: integration
source: sensor.battery_discharge_power
name: Battery Discharge
unit_prefix: k
round: 2
- platform: integration
source: sensor.power_import
name: Power Import kWh
unit_prefix: k
round: 2
- platform: integration
source: sensor.power_export
name: Power Export kWh new
unit_prefix: k
round: 2
Templates sensors :
- sensor:
- name: "Total Power"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.energy_from_grid_l1_now'),
states('sensor.energy_from_grid_l2_now'),
states('sensor.energy_from_grid_l3_now')]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.energy_from_grid_l1_now'),
states('sensor.energy_from_grid_l2_now'),
states('sensor.energy_from_grid_l3_now')] }}
- name: "Power Export"
unique_id: power_export
device_class: power
unit_of_measurement: 'W'
state: >
{% if (((states('sensor.grid_l1') | float(0)) + (states('sensor.grid_l2') | float(0)) + (states('sensor.grid_l3') | float(0))) < 0) %}
{{(((states('sensor.grid_l1') | float(0)) + (states('sensor.grid_l2') | float(0)) + (states('sensor.grid_l3') | float(0))) * -1 )}}
{% else %}
0
{% endif %}
- name: "Power Import"
unique_id: power_import
device_class: power
unit_of_measurement: 'W'
state: >
{% if (((states('sensor.grid_l1') | float(0)) + (states('sensor.grid_l2') | float(0)) + (states('sensor.grid_l3') | float(0))) > 0) %}
{{(states('sensor.grid_l1') | float(0)) + (states('sensor.grid_l2') | float(0)) + (states('sensor.grid_l3') | float(0))}}
{% else %}
0
{% endif %}
and the battery :
battery_discharge_power:
device_class: power
friendly_name: "Battery Discharge"
unit_of_measurement: "W"
value_template: "{{ max(0, 0 - states('sensor.battery_power_system') | float) }}"
battery_charge_power:
device_class: power
friendly_name: "Battery Charge"
unit_of_measurement: "W"
value_template: "{{ max(0, states('sensor.battery_power_system') | float) }}"
Energy dashboard config :
The reason for DC and AC is that i have two inverters, one is AC and the other one is DC coupled meaning. I have a Fronius which is AC coupled and a Victron which is DC coupled. In the end i just produce from both. What you see on Victron status is the total of both.
Here is the status today so far from HASS:
and here is what Victron is saying :
System Overview:
Consumption:
Solar:
- We can see that the Solar Production in HASS vs Victron are correct
- Victron (from grid) 0.1 kWh vs 0.4 kWh in hass. To grid is not even shown in Hass (probably what you mention that there is no line between Solar and Grid).
- The Total power consumed by house does not match either Victron (consumption) 7.7 kWh vs 8.6 kWh in hass. These discrepancy get’s bigger during the day especially if we return to grid.
- On the battery side Victron (to battery) 2.0 kWh vs 2.0 kWh in hass so that seems correct but the Victron (from battery) 5.9 kWh vs 6.5 kWh in hass is not correct.
I can’t seem to figure out what the problem is, i am sure there is a logical explanation.
/donnib
I do not have much time to analyse in detail, but one mistake I see is this:
You currently have both the import and export as “Grid Consumption”. The Export should be defined as “Return to Grid”.
That definitely messes up the values in the Energy Dashboard. So maybe change that, look at it tomorrow and post the values tomorrow…
True, i did not notice that myself. Good catch. I have fixed it. I’ll return tomorrow to let you know how it goes.
This is another interesting thing. I actually think there may be a difference between what Victron reads and what the sensor.battery_power_system gives you. I have noticed in my configuration that SolarEdge reads the value which actually is outputted by the battery, but in my configuration I take into effect what actually “enters” my house. And…there is a big difference there. In my case I found out it has to do with the effectivity of the battery; there is a substantial loss between what is outputted directly (before it gets converted to AC) and what AC value I actually get. Solaredge chooses to ignore this and not make it visible to the end user, in my case I wanted to see that so I have some discrepancies between what SolarEdge shows and what my Energy Dashboard shows.
I did find the epxlanation in my case, so I am happy with how it is.
Anyhow, let’s see the values you get tomorrow and see where we are at.
Ok so here is the data for today :
- To grid : 6.9 kWh vs 6.1 kWh
- From Grid : 0.2 kWh vs 0.4 kWh
- Production : 19 kWh vs 17.7 kWh
- Consumption : 9.6 kWh vs 10.7 kWh
- From Battery : 2.6 kWh vs 4.1 kWh
- To Battery : 5.4 kWh vs 5.4 kWh
and here is the data for yesterday where data seems to be closer to each-other why i can’t explain, eg. why it was close the other day than today :
- To grid : 1.6 kWh vs 2.4 kWh
- From Grid : 12 kWh vs 12.8 kWh
- Production : 32 kWh vs 31.6 kWh
- Consumption : 32 kWh vs 32.1 kWh
- From Battery : 7.3 kWh vs 8.5 kWh
- To Battery : 17 kWh vs 18.4 kWh
hmm…that is interesting. At least it looks a lot better now and the values do seem pretty close, but the question remains…where do the differences come from? Honestly…I do not know. In the end you are using the direct values coming from the Modbus sensors, so they should be accurate. What I do not know, is how often the Modbus values get updated/read. In my configuration I set the update interval to 3 seconds I believe (a LOT of values, so had to exclude things from the recorder), this 3 seconds give me almost instantanious values, so my results look pretty good.
If the update interval is longer (every minute for example) the readings get less accurate of course. So maybe that is part of the explanation.
Another explanation may be that Victron uses different values internally or uses a different algorithm to get the values, this I do not know of course.
In the end, the configuration and setup of your sensors is correct. I cannot see anything wrong with that, so it must be due to either:
- the values from modbus
- the update interval from the modbus values
- the algorithms used in the background to sum the values
One thing you could have a look at to try out; you are also using the “integration” platform to calculate the kW value out of the W sensors. There are some options to influence how the Riemann Sum is calculated by using either “left” or “right” values. Maybe because of the update intervals you would need to use either one of those options to get more accurate values. You can read up on it in this thread and experiment with that:
I do not know what else could be wrong or how to improve it honestly.
I also have a Victron and it took me a few weeks to integrate the Energy dashboard. I am not a developer and understanding Modbus was a challenge. The data also vary a bit from what the VRM measures and I think the scan_interval:
is the main reason. I have it set for the modbus grid sensors at 5 seconds. You don’t seem to have it at all or somewhere you have 20 s interval. I think the VRM shows data with more accuracy precisely because it measures it in real time and not in 5/20 second intervals. Somewhere I read that putting scan interval below 5s is dangers, so I never tried it.
Here is my comparison from yesterday:
Hi @petrnomad
can you provide your setup and how did you tweaked the numbers ?
I am in same spot and would like to get as close as possible data to VRM.
thanks a lot