Hi every one … this is my first post… because until now i never need help to solve something at home assistant. First of all i apologize for any mistakes i make … writing English.

I have a home assistant installation at Proxmox 7, all working fine from 2019 that i first start with home assistant…

Now what’s my problem … i have install solar collectors with vacuum tubes total 120 tubes for space heating. I keep my home warm all day with the sun only.

I have made all automations for Auto, Manual Mode, Checking System for Malfunctions and notify with the problem, Over heating protection, Frost protection and even calculate how much energy my water pumps are consume EVERY day.

My problem is that i want to measure how much energy i produce in kWh from my solar system.

I know the math to calculate how much energy i produce … below is the formula and explanation.

Calculate the kilowatt-hours (kWh) required to heat the water using the following formula: Pt = (4.2 × L × T ) ÷ 3600. Pt is the power used to heat the water, in kWh. L is the number of liters of water that is being heated and T is the difference in temperature from what you started with, listed in degrees Celsius.

My boiler is 300 liters and every day i rise it about 100 celsius TOTAL so formula is …

`{{ (4.2 * 300 * (100.2) / 3600 ) }} kWh`

My problem is that i can’t find a way to make a template sensor to measure ONLY the increase temp that a sensor measure. For example the above formula say that “T is the difference in temperature from what you started with, listed in degrees Celsius” this is my T3 sensor that is at the top of my boiler.

But how can i measure when this sensor is rise up and down because when temperature of the sensor is above 70 celsius the automation send this hot water to the radiator inside my house. So this temperature is start to rise around 08:00 from around 35 celsius and inside the day when get 70 celsius then temperature at sensor T3 drop around 50 celsius. Then start to rise again … this can be repeat for 3-8 times every day. Below is a today Graph from Grafana that show what i need to measure…i mark it with RED line.

So how can i measure from sensor “sensor.sonoff_t3_boiler_temp” its previews state value and compare it with the current value and if it is above zero (0 celsius) then to ADD this difference of the value to a template sensor for example or any other type of variable. Something like the below …

‘{{ trigger.to_state.state | float - trigger.from_state.state | float > 0.01 }}’

I hope i give you understand what exactly is my problem and help me someone how to solve it.

I am sorry about any mistakes if i make while writing this post, also i appreciate for your time reading or try to help solve my problem.

Thanks in advance

A Home Assistant enthusiastic.

Insomnia.