Skip to content

Fix BRP084 dsiot energy consumption reporting - #142

Open
kengggg wants to merge 1 commit into
fredrike:masterfrom
kengggg:fix-brp084-energy-consumption
Open

Fix BRP084 dsiot energy consumption reporting#142
kengggg wants to merge 1 commit into
fredrike:masterfrom
kengggg:fix-brp084-energy-consumption

Conversation

@kengggg

@kengggg kengggg commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • Register BRP084 dsiot energy consumption history after status parsing.
  • Fall back to aggregate today_total_energy_consumption for today_energy_consumption when split cool/heat counters are unavailable.
  • This addresses a downstream Home Assistant symptom where BRP084 devices can show zero daily energy despite aggregate dsiot week_power.datas data being present.

Details

BRP084 dsiot devices already parse aggregate weekly power data from week_power.datas; today_total_energy_consumption uses the last aggregate value as kWh. Some devices/firmware do not expose split curr_day_cool / curr_day_heat counters, so the inherited today_energy_consumption implementation returns 0 by summing two unavailable split values.

This keeps the inherited split-counter behavior when either cool or heat data exists, and only falls back to aggregate total energy when both split counters are unavailable.

The BRP084 status path also overrides the base update path, so this PR registers energy consumption history after BRP084 status parsing. That gives the estimated power path history to work from after aggregate energy changes.

Related: #119 is a broader BRP084 energy PR that adds yearly energy and optional cool/heat breakdown support. This PR is intentionally narrower and preserves aggregate-only behavior for devices that expose datas but not split counters.

Testing

  • Existing BRP084 fixture with datas=[100,200,300,400,500,600,700] now asserts:
    • today_total_energy_consumption == 0.7
    • today_energy_consumption == 0.7
    • history total for today is 0.7
  • Added sanitized real-shape regression with datas=[7300,8400,9900,7000,3000,900,900], expecting 0.9.
  • uv run pytest tests/test_daikin_brp084.py -q -> 49 passed
  • uv run pytest tests/test_energy_consumption.py tests/test_power_sensor.py -q -> 11 passed, 3 skipped
  • uvx ruff check pydaikin/daikin_brp084.py tests/test_daikin_brp084.py -> passed
  • Full uv run pytest -q -> 210 passed, 10 skipped

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.61%. Comparing base (788da58) to head (95eac7d).

Files with missing lines Patch % Lines
pydaikin/daikin_brp084.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
+ Coverage   85.60%   85.61%   +0.01%     
==========================================
  Files          12       12              
  Lines        1341     1349       +8     
==========================================
+ Hits         1148     1155       +7     
- Misses        193      194       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kengggg
kengggg force-pushed the fix-brp084-energy-consumption branch from 67995c6 to ca3495f Compare August 6, 2026 16:03
@kengggg
kengggg force-pushed the fix-brp084-energy-consumption branch from ca3495f to 95eac7d Compare August 6, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant