Skip to content

Fix IndexError in get_current_energy when energy list is empty - #689

Merged
robbinjanssen merged 1 commit into
robbinjanssen:mainfrom
adamjernst:fix-empty-energy
Sep 11, 2026
Merged

Fix IndexError in get_current_energy when energy list is empty#689
robbinjanssen merged 1 commit into
robbinjanssen:mainfrom
adamjernst:fix-empty-energy

Conversation

@adamjernst

Copy link
Copy Markdown
Contributor

WG4 thermostats always report an empty energy list, and WG5 thermostats without a building id do too. get_current_energy() only guarded against None, so an empty list raised IndexError and crashed consumers such as the Home Assistant sensor platform. Treat an empty list like None and return 0.0.

WG4 thermostats always report an empty energy list, and WG5 thermostats
without a building id do too. get_current_energy() only guarded against
None, so an empty list raised IndexError and crashed consumers such as
the Home Assistant sensor platform. Treat an empty list like None and
return 0.0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Eer1ZnSZ8sz5oh8pq3AQT2
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d1701a2) to head (8a5f731).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #689   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          522       522           
  Branches        67        67           
=========================================
  Hits           522       522           

☔ 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.

@robbinjanssen robbinjanssen added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Sep 11, 2026
@robbinjanssen
robbinjanssen merged commit 8110943 into robbinjanssen:main Sep 11, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants