Repository navigation
v1.22.7 — BUH counter fix: wall-time + native-first
v1.22.7 — BUH counter fix: wall-time + native-first
🐛 What Was Wrong
runtime_buh_today was 2× too high when both BUH Step1 and Step2 were active. A prod-1 user reported 90 min of backup-heater runtime on a day the firmware counter showed 42.6 min.
Root cause: each tick added dt_s (30s) to both _buh_step1_s and _buh_step2_s, then the sensor summed them — 60s per 30s wall-time.
Related: ESPAltherma v2 exposes precise firmware counters (Stats: Backup heater today, Stats: Defrosts today, Stats: Compressor starts today) that were unused. We now prefer them with computed fallback.
✅ What Changed
Wall-time counter (core fix)
- New
_buh_total_s— max 1×dt_sper tick regardless of step1/step2 runtime_buh_todayreads_buh_total_sinstead ofstep1_s + step2_sstep1_s/step2_skept as diagnostic detail in attrs- Restore migration: pre-v1.22.7 payloads (no
buh_total_s) backfill viamax(step1, step2)
Native-first for ESPAltherma v2
New engine/runtime_source.py with strict resolvers:
| Counter | Priority |
|---|---|
| BUH today | Stats: Backup heater today (min) × 60 → computed |
| Defrosts today | Stats: Defrosts today → computed |
| Compressor starts | Stats: Compressor starts today → computed |
| Compressor runtime | computed primary (firmware resets on reboot) |
Each sensor exposes a source attribute (native / computed).
Hardening
- Strict
isinstance(attrs, dict)— reject MagicMock (float(Mock) == 1.0false positive) - Safe
isinstance(snap, dict)guards in sensor accessors
CI infrastructure
- Pre-push hook skips full pytest suite on branch-deletion pushes — from 500s+ to <2s.
Not changed
buh_excessivealert — 7-day ratio, not today's counter- COP / heat / electricity today — already use
power_sensor+cop_sensor - Defrost duration — no native field on ESPAltherma
- Compressor runtime — computed-primary per user preference
🧪 Testing & quality
- 5,960 tests pass, 100% coverage
- 20 new tests in
test_v1227_buh_walltime.py - Suite: 504s (was 528s, −4.5% via
--dist worksteal) - Ruff clean on changed files
- No regression — v1.22.6 FR / DAV3 / LWT card preserved
📊 Impact
| User | Before | After |
|---|---|---|
| Prod-1 (v2 ESPAltherma) | 5436 (90.6 min) |
2556 (42.6 min), source: native |
| v2 with Stats: | computed only | firmware-exact, source: native |
| v1 (no Stats:) | double-counted | wall-time computed, source: computed |
⚙️ Upgrade
No action required. Auto-updates via Marketplace (HA 2026.11+) or HACS.
After upgrade, runtime_buh_today corrects from next coordinator tick (~30s). Historical daily_summary per-cycle records unaffected.
🔗 Links
☕ Support
Daikin Cycle ML is free, local-only, and open-source. If it has helped you optimize your heat pump or save on energy costs:
