️ Revert the external energy statistic, keep the hourly fetch throttle #55

Merged
mat merged 1 commit from revert/external-energy-statistic into main 2026-07-13 15:39:46 +00:00
Owner

Backs out the opt-in external statistic comwatt:<device>_total_energy added in #18 (not wanted). Keeps the QUANTITY/HOUR fetch throttle (#3) and the robust total_wh accumulation for the existing sensor.<device>_total_energy entity.

Consequence: the hour-offset (#5, #42) is no longer addressed — those issues are reopened.

  • Removed: async_add_external_statistics push, _NewEnergyBucket, _async_push_energy_statistics, _pending_energy_buckets, the external-stats test, and after_dependencies: [recorder] (from #53, only needed for the removed recorder import).
  • Kept: 55-min fetch skip, _parse_bucket_ts + datetime dedup.

ruff + mypy clean, 43 tests pass.

Backs out the opt-in external statistic `comwatt:<device>_total_energy` added in #18 (not wanted). Keeps the QUANTITY/HOUR fetch throttle (#3) and the robust `total_wh` accumulation for the existing `sensor.<device>_total_energy` entity. Consequence: the hour-offset (#5, #42) is no longer addressed — those issues are reopened. - Removed: `async_add_external_statistics` push, `_NewEnergyBucket`, `_async_push_energy_statistics`, `_pending_energy_buckets`, the external-stats test, and `after_dependencies: [recorder]` (from #53, only needed for the removed recorder import). - Kept: 55-min fetch skip, `_parse_bucket_ts` + datetime dedup. ruff + mypy clean, 43 tests pass.
️ Revert the external energy statistic, keep the hourly fetch throttle
All checks were successful
Validate / lint-ruff (push) Successful in 7s
Validate / test-pytest (push) Successful in 2m59s
Validate / type-check-mypy (push) Successful in 3m7s
Validate / lint-ruff (pull_request) Successful in 7s
Validate / test-pytest (pull_request) Successful in 2m59s
Validate / type-check-mypy (pull_request) Successful in 3m6s
81180d1cf4
The #5/#42 hour-offset fix in #18 was delivered only as a new opt-in
external statistic (comwatt:<device_id>_total_energy) pushed via
async_add_external_statistics at the real bucket timestamp. The existing
sensor.<device>_total_energy entity was left unchanged, so the offset is
not actually fixed for that entity — only for users who repoint their
Energy dashboard at the new statistic. That extra statistic is not
wanted, so drop it.

Kept from #18:
- The QUANTITY/HOUR fetch throttle (skip the call while the cached total
  is < 55 min old) — this addresses #3 and stays.
- _parse_bucket_ts and the datetime-based dedup, which keep the running
  total_wh accumulation (the existing energy entity's value) robust
  against the API's real ISO 8601 timestamps.

Removed:
- async_add_external_statistics push, _NewEnergyBucket,
  _async_push_energy_statistics, _pending_energy_buckets.
- after_dependencies: [recorder] in the manifest (added in #53 only to
  satisfy hassfest for the now-removed recorder.statistics import).
- The external-statistics test.

The hour-offset (#5, #42) is therefore no longer addressed; those issues
are being reopened.
mat merged commit 2d8c0b5517 into main 2026-07-13 15:39:46 +00:00
mat deleted branch revert/external-energy-statistic 2026-07-13 15:39:46 +00:00
mat referenced this pull request from a commit 2026-07-13 15:52:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mat/homeassistant-comwatt!55
No description provided.