Cumulative Daily Sum of Sensor Values

I have a sensor which shows the current count of cars in a camera feed (via Frigate). The state of the sensor is just an integer value. There is also a corresponding binary sensor which indicates whether or not there are any cars currently detected in the feed (instead of a count).

How could I best keep a daily count of those detected objects? I’ve looked into history stats, and it’s almost what I’m looking for, but the problem is that it can’t add the values from the sensor. Even with setting type: count, I have to specify the state: field, which may be any number of positive integers.

My current approach is to use history stats with type: count on the binary sensor. This willl tell me “how many times today were there at least 1 car detected”. But how can I create a sensor that will tell me “How many cars were detected today in total”?

If the sensor state’s history from today looks like 0,1,0,2,0,1,0,3, then the binary sensor will have been triggered 4 times (when the sensor value is > 1). A history_stats sensor configured on that binary sensor entity will return a count of 4. But how could I get a similar count that is the sum of all the previous sensor values (1+2+1+3 = 7)?