Template to calculate daily vehicle mileage

I have a Total Vehicle Mileage entity, of which I would like to calculate the total mileage covered daily.

This will be calculated using the following formula:-

Current Total Vehicle Mileage - Total Vehicle Mileage captured at beginning of the day = Vehicle Mileage covered daily

I am trying to template this calculation but struggling to determine the syntax to capture the Total Vehicle Mileage captured at beginning of the day.

Could someone be kind enough to point me in the right direction?

Did you try a utility meter with cycle daily?

Not quite sure how this would work based on the mileage of the vehicle not being a unit of power.

Could you explain how this could be used?

As far as I understand, it doesn’t matter what unit the source sensor data has.

I’d give it a try:

utility_meter:
  daily_energy_offpeak:
    source: sensor.your_total_vehicle_mileage_entity
    cycle: daily

Thanks, i’ll give it a try.