Page 1 of 1

P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Thursday 09 July 2026 13:02
by imautohuttraeger
I have a P1 device that gets the data via a dzvents script. It is working correctly apart from the cost calculation:

1st issue: At midnight, counters for usage and return are correctly set to zero, but the total costs are not.

2nd issue: Return costs should calculate with R1 tarrif, but they take T1 tarrif.

For ease of testing, I have set
Costs T1 = 2 €
Costs R1 = 1 €

Note: Right now, thanks to the solar battery, I’m almost 100% self-sufficient and only have return.

At first I have only detected this when I looked at the grid bubble of the energy dashboard, so I posted it in the respective thread.

viewtopic.php?p=334641#p334641

@waltervl kindly helped me there to identify this as a P1 problem.

Any idea what's behind that?

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Thursday 09 July 2026 13:13
by waltervl
Did you set the P1 cost calculation in the (Dynamic) price calculation section to High/Low? As that seems to be needed.
Then wait a day as it will only be used after activation. Calculations in the past will not be updated to the new setting.

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Thursday 09 July 2026 14:14
by imautohuttraeger
Yes, I did. However, let's wait another 24 hours. But I doubt that it can be the full solution, because this does not seem to be solving the fact that return kWh are calculated by the tarrif for usage.

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Saturday 11 July 2026 0:08
by imautohuttraeger
Minimum 24 hours have passed by with "high / low" in the settings for "P1 Electricity report display". It is showing the same result as "dynamic": Costs are not set to zero at midnight. So it doesn't matter which option I choose.

And T1 instead of R1 tarrif is still used for returned Energy.

I think as a next step, I will create a separate P1 device and look, if it has the same behaviour.

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Saturday 11 July 2026 11:12
by imautohuttraeger
imautohuttraeger wrote: Saturday 11 July 2026 0:08 [...]

I think as a next step, I will create a separate P1 device and look, if it has the same behaviour.
Now I have created a new virtual P1 device (dummy hardware) for testing. Result is the same: Return energy takes T1 tariff for usage energy to calculate the costs. Should be R1. So it is not caused by the particular device. Can easily been seen on the energy dashboard or the energy widget. And the daily costs are not set to zero at midnight.

Seems that I am the only one with this problem. Is the calculation of the grid costs really correct for everyone else than me?

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Saturday 11 July 2026 13:21
by waltervl
I think the most people have the same T1 and R1 tariff at the moment and no T2/R2 tarif anymore so it is not obvious.
In the Netherlands next year the T1 and R1 tariffs will differ so then your issue will become more obvious for the rest....

I will try to reproduce this soon.

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Saturday 11 July 2026 15:03
by imautohuttraeger
Ah - I understand. That might explain why this is not detected by other people, yet.

Interesting to know, that - at least for the time being - the re-payment situation for returned energy is so extremely fair in the Netherlands. Here in Germany it is not, unfortunately.

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Sunday 12 July 2026 11:03
by imautohuttraeger
Update:

With the help of Claude AI I could solve one of the two issues:
The script for delivering data to my virtual P1 device is amended in a way, that the costs are now set to zero at midnight. I guess this is not necessary when you have a real P1 connection to a hardware electric meter, because the daily costs are set to zero automatically.

However, the 2nd issue (payback for return energy is calculated with T1 tarrif rather than R1) still exists. I think this is independent of the way the P1 device receives the data (by hardware data cable or by script).

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Wednesday 15 July 2026 14:48
by imautohuttraeger

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Wednesday 15 July 2026 20:43
by waltervl
Just to confirm I see the same issue in my test environment and reacted to the GitHub issue.

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Wednesday 15 July 2026 20:48
by imautohuttraeger
šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘
.....

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Saturday 18 July 2026 10:12
by waltervl
Issue has been fixed by Gizmocuz in the next beta release!
One note: on updating to beta or the next stable release all costs in history will be recalculated with the tariffs as set in the settings. So first be sure you have the right tariff, then update :-)

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Sunday 19 July 2026 10:46
by imautohuttraeger
Does it mean, that the historic figures will always be calculated by the actual prices although the old prices where different?

Or is this re-calculation only made once because of the first update after the fix?

Re: P1 device: Return costs use T1 instead of R1 tarrif and total costs are not set to zero at midnight.

Posted: Sunday 19 July 2026 12:55
by waltervl
imautohuttraeger wrote: Sunday 19 July 2026 10:46 Does it mean, that the historic figures will always be calculated by the actual prices although the old prices where different?

Or is this re-calculation only made once because of the first update after the fix?
Recalculation of total price will only be done on update of Domoticz. After that the normal new calculation will be done.
The current and future history reports also only store the total price so differentiated T1/T2/R1/R2 prices are calculated from the latest tariffs.

So when you change the tariffs in the future the total price will always be correct based on history tariffs but the differentiated history prices will be calculated on the current tariffs. So there could be a gap....