In SenseTrendsSensor, the value is fetched using:
return round(self._gateway.get_stat(self._scale, self._variant_id), 1)
The start time for the trend is provided by:
def last_reset(self) -> datetime | None:
if self._attr_state_class == SensorStateClass.TOTAL:
return self._gateway.trend_start(self._scale)
return None
If get_stat or trend_start does not correctly align with the start of the day (midnight), or if the Sense API returns data with a timezone offset or missing the first hour, the resulting statistics in Home Assistant will not cover 12am–1am.
In investigating the sense pypy library,
trend_start parses the "start" field from the trend data using ciso8601.parse_datetime, which returns a UTC datetime unless the string includes a timezone.
get_stat retrieves a value from the trend data for a given scale and key, but does not perform any timezone conversion or alignment to local midnight.
Both methods use UTC datetimes and do not align to local midnight. If Home Assistant expects local time alignment, this could cause the first hour (12am–1am local) to be skipped if the API data is in UTC and not converted. You may need to check how Home Assistant interprets the "start" field and whether it converts it to local time before plotting.