Ever since I have PV panels on my house I lost insight into our actual power usage during the time our PV panels produce energy. To overcome that I decided to create a template sensor with the following template:
In which solaredge_local is the local reading of my Solaredge inverter and the power_production and power_consumption are local readings of my smartmeter.
This works like a charm for most of the day but sometimes I get negative values for power usage followed by a unusual high spike.
I think this is due to the age of the data of two sources. After all, the solaredge_local and my smartmeter readings are from different sources which are not retrieved at exactly the same time.
The solaredge data is updated every 30 seconds, while my smartmeter updates approximately every 10 seconds.
Does any of you smart guys have a good solution for this problem?
Thanks a lot. Would you advise me to add this to the template sensor only or to the both specific entities the template is using to calculate the actual usage?
I thought a template sensor get’s updated when the sensor data changes. If the template uses 2 different entities the template is updated when either of the entity is changed.
So I would suggest to add the scan_interval on the source. I think what would be sufficient.
I’m not using the power outputs of my smart meter because of the same problems you’re having. I went for the total kWh values from both the smart meter as the solar_edge.
I’ve made the following calculation to determine the internal (house) usage (all in kWh):