Energy dashboard configuration, possible daylight savings issue

Edit: I’m only allowed one image as a new user, so removed pictures and will attempt to add as comments.

I’m having some issues attempting to configure the energy dashboard in HA to show correct values, particularly during 0000-0100 every day - we are currently in British Summer Time (BST), so this would be 2300-000 UTC, which I suspect is affecting things.

For example, in the energy dashboard, I’m seeing a battery charge of 32.86kwh

Whereas the values of the underlying sensor used are correctly reset to 0000 at midnight (local/BST) as expected…

… for a ‘total increasing’ energy sensor, as I understand it - the values are sourced from the victron VRM web api; I’m calculating total battery charge as the sum of two values:

Derived from some REST sensors, config as listed at the end of the post.

However, for 0100-0200, the values appear to match (and are correct):

Dashboard, showing 8.1kwh of battery charge:

Sensor - 16.09kwh at 0200, and 8.01 at 0100 = total of ~8.1 during this hour slot.

I’d be grateful for any advice on how to get this information to report properly, as it’s throwing off my daily totals/stats.

Sensor config:

rest:
  - scan_interval: 60
    resource_template: https://vrmapi.victronenergy.com/v2/installations/193584/stats?end={{ int(as_timestamp(now()))-1 }}&interval=days&start={{ int(as_timestamp(now().date())) }}&type=live_feed
    headers:
      X-Authorization: Token 2cbb45c0958bc9050c9d50e68d05ca5afcb6195c4892977485d01a122e7206ad
    sensor:
      - name: "VRM totals"
        json_attributes:
         - grid_history_to
         - grid_history_from
         - total_solar_yield
        json_attributes_path: "$.totals"
        value_template: "OK"
  - scan_interval: 60
    resource_template: https://vrmapi.victronenergy.com/v2/installations/193584/stats?end={{ int(as_timestamp(now()))-1 }}&interval=days&start={{ int(as_timestamp(now().date())) }}&type=consumption
    headers:
      X-Authorization: Token <REDACTED>
    sensor:
      - name: "VRM consumption totals"
        json_attributes:
         - Bc # consumption FROM battery
         - Pc
         - Gc # consumption FROM Grid
        json_attributes_path: "$.totals"
        value_template: "OK"
  - scan_interval: 60
    resource_template: https://vrmapi.victronenergy.com/v2/installations/193584/stats?end={{ int(as_timestamp(now()))-1 }}&interval=days&start={{ int(as_timestamp(now().date())) }}&type=grid
    headers:
      X-Authorization: Token <REDACTED>
    sensor:
      - name: "VRM grid totals"
        json_attributes:
         - Gb # grid TO battery
         - Pc
        json_attributes_path: "$.totals"
        value_template: "OK"
  - scan_interval: 60
    resource_template: https://vrmapi.victronenergy.com/v2/installations/193584/stats?end={{ int(as_timestamp(now()))-1 }}&interval=days&start={{ int(as_timestamp(now().date())) }}&type=solar_yield
    headers:
      X-Authorization: Token <REDACTED>
    sensor:
      - name: "VRM grid solaryield"
        json_attributes:
         - Pb # solar TO battery
        json_attributes_path: "$.totals"
        value_template: "OK"

Adding back images:

Sensor showing reset at 0000 to 0 value:

Reading at 0100:

Reading at 0200:

Template sensor:

Correct values in dashboard 0100-0200:

The problem with this behaviour normally is that because of the update at 0:00:01 or smth. the sensor goes from a state from x to 0 and with that this is the difference the energy dashboard reads and saves.
You can use an Utility Meter with periodically resets to 0 to overcome this issue. And yes the history will not transfer, but if you really want to keep that you are in luck bc you have an template sensor you can edit the code to 0 and leave it in the dashboard settings and correct the faulty values und Developer Tools → Statistics