First Kapacitor TICK script - need help with cumulative sum function

Hi, I am trying to learn and use TICK script in Kapacitor. I need to create a cumulative sum that increases during the day from zero as energy is consumed. Step 1 was a script that just creates a cumulative sum for each data record where data arrives each second but I am stuck after hours of trying and googling.

Input data
Time Energy
10:01 5
10:02 3
10:03 4
10.04 5
10.05 3

Output Required
10:01 5
10:02 8
10:03 12
10.04 17
10.05 20

This is my simple script but it is not producing the output I expect, in fact it produces no output. Is there anybody with TICK script skills that can offer some advice. Thanks
Paul
dbrp “paul_house_energy”.“autogen”

stream
|from()
.database(‘paul_house_energy’)
.measurement(‘watthours_solar’)
|eval(lambda: “integral.cumulativeSum”)
.as(‘integral’)
|influxDBOut()
.database(‘paul_house_energy’)
.retentionPolicy(‘autogen’)
.measurement(‘sum_watthours_solar’)
.precision(‘s’)