Device value spilling over midnigt

I have a device reading the accumulated value to the next day. Unfortunately the value is spilling over to the next day because of a delay in update. Can I somehow ignore the first hour using my template?

My template looks like this:

template:
  - sensor:
    - name: Egenförbrukning
      state: >
        {%
        set data = {
          "production": states("sensor.gosungrow_virtual_5039286_1_1_1_p1")|float,
          "sold": states("sensor.accumulated_production_modeshogsvagen_51a")|float,
          "unit": state_attr("sensor.gosungrow_virtual_5039286_1_1_1_p1", "unit_of_measurement")
        }
        %}
        {{ data.production - data.sold }} {{ data.unit }}

Nevermind… fixed it.