Basically this seems to work correctly.
Total energy produced (50.7) + energy purchased from grid (7.2) - energy sold to grid (40.0)
=> 17.9 home consumption
Total Energy Generated (50.7) - Energy Sold to Grid (40.0)
=> 10.7 self-consumption PV
The daily sensors look like this:
utility_meter:
solar_panel_production_daily:
source: sensor.solaredge_ac_energy_kwh
name: Solar Panel Production Daily
cycle: daily
solar_house_consumption_daily:
source: sensor.eigenverbrauch_pv_kwh
name: Solar House Consumption Daily
cycle: daily
energy_house_consumption_daily:
source: sensor.hausverbrauch_strom_kwh
name: Energy House Consumption Daily
cycle: daily
energy_imported_power_daily:
source: sensor.energy_netzbezug
name: Energy Imported Power Daily
cycle: daily
solar_exported_power_daily:
source: sensor.energy_einspeisung
name: Solar Exported Power Daily
cycle: daily
What is striking?
solar_panel_production_daily = correct
solar_exported_power_daily = correct
solar_house_consumption_daily = incorrect it should be 9,x
energy_house consumption daily = incorrect, the energy fed into the grid is apparently not deducted here
energy_imported_power_daily = correct
I can’t understand the error, why some values in the daily cycle are correct but others are not. The overall values that serve as a basis all seem to be correct?
I had similar issues with the calculation of such values.
Usually - I observed this especially in the following cases:
Sensor Solaredge (api response) will be updated aprox every 15 minutes.
other sensors might be updated more frequently.
now, your calculations will be done whenever one of the sensor states will change - so it might be, that one of the sensor has already updated, but the sensor from solaredge not.
This will lead to a slightly wrong value, considered the actual time…
When your Utility Meter is now reading these values, this can also cause wrong calculations in the utility meter…
btw: are you using the solaredge Api integration or the modbus integration?
So mabye as an information:
The Sensors from the “binsentu/solaredge-modbus” integration can be used directly in the energy dashboard for quite a while now.
I think at some point last year after the energy dashboard was integrated, this has been fixed by the devs
So there is no need to create any custom sensor anymore.
Despite of that, I would recommend to add the “availability” option to your sensor - in case of restarting HA or something like that, your sensor could show incorrect data.
I am also not quite sure about your “state” configuration:
If - Total Energy is Unavailable → Use Total Energy.
Else - Show Total Energy as Float.
the configuration should probably something like this:
- sensor:
- name: "Energy Netzbezug"
unique_id: '"Energy_Netzbezug"'
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
state: {{ states('sensor.total_energy') }}
availability: >
{{ states('sensor.total_energy') not in ['unknown', 'unavailable', 'None'] }}
you can see how the value regularly jumps back and forth. Without NetConsumption, this will have triggered +0.1 each time.
The value also agrees with the PV self-consumption value from the Energy Dashboard for the last hour
(the value is so high because my e-car is charging )
Ah okey
I am using solaredge with a solaredge meter - so I could get imported and exported power directly from the solaredge integration - which would allow similar calculations - but in my case, the sensors would update at the same time…
Anyway - the Solaredge sensors (production) can be used directly in the energy dashboard - so for this, there’s no need to creat a custom sensor anymore.
For Netzbezug & so on, I am still not sure if your “state” is really correct… because in my eyes, the if / else given there seems not to make sense … (but i might be wrong)…
If the “net_consumption” which you have added does solve your initial issue, then that’s good