Skip to content

Fix availableEnergyCapacity display unit in periodic_requests example#21

Merged
eman merged 1 commit intomainfrom
fix-energy-units
Oct 17, 2025
Merged

Fix availableEnergyCapacity display unit in periodic_requests example#21
eman merged 1 commit intomainfrom
fix-energy-units

Conversation

@eman
Copy link
Copy Markdown
Owner

@eman eman commented Oct 17, 2025

Problem

The periodic_requests.py example was incorrectly displaying availableEnergyCapacity as a percentage (e.g., "Available Energy: 709.0%"), which doesn't make sense since 709% is not a valid percentage value.

Root Cause

According to the documentation in docs/DEVICE_STATUS_FIELDS.rst, the availableEnergyCapacity field represents:

  • Units: Watt-hours (Wh)
  • Description: Available energy capacity - remaining hot water energy available in Watt-hours

This is an energy measurement, not a percentage.

Solution

Changed the display format in the on_device_status callback from:

print(f"  Available Energy: {status.availableEnergyCapacity:.1f}%")

To:

print(f"  Available Energy: {status.availableEnergyCapacity:.0f} Wh")

Results

Before: Available Energy: 709.0% (confusing)
After: Available Energy: 709 Wh (correct)

Verification

  • Reviewed all other examples to ensure no similar issues exist
  • Confirmed that other percentage displays (e.g., dhwChargePer) are correctly used
  • Code passes linting and formatting checks

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • Documentation update (example fix)

This is a minor correction that improves example accuracy and user understanding.

…s example

The availableEnergyCapacity field represents energy in Watt-hours (Wh),
not a percentage. Updated the display format from '{value}%' to '{value} Wh'.

This prevents confusing output like 'Available Energy: 709.0%' which
doesn't make sense for a percentage value.
@eman eman merged commit 81b78d1 into main Oct 17, 2025
10 checks passed
@eman eman deleted the fix-energy-units branch October 17, 2025 21:03
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