Insertion of timeseries energy readings for a new integration

I’ve developed a new integration for the Combined Energy monitoring platform (white-labelled by Solahart in Australia and other companies overseas).

I have got all devices (that I have access to) working with data flowing into home assistant, but I am struggling to get correct entries with energy readings to populate into the energy dashboard.

The API returns data in Wh in 5sec, 30sec, or 30min increments. The integration has been set up to request 5-second increments, polls every 30 seconds and the resulting 5-second ranges are summed to provide the correct ~30 range. I have compared the summed value to the official dashboard and confirmed it is correct. The API does not provide a daily total.

After reviewing the sensor docs it would seem that the class off TOTAL with a last reset would be the most appropriate. However, that ends up spamming the log with Detected new cycle for sensor... messages which doesn’t seem like the right approach.

I have looked at how other integrations are doing this, but they all seem to have a daily total to utilise. Is the last reset approach correct, or is there a better way?

I have experimented with using a last_updated attribute; this looked to be working but after coming back from a break for the last couple of hours zero energy is being reported.

The specific sensor code is in my current working branch

Would like to knock this last issue off as the rest of the new integration is working great, and I need to get working on the test cases.