Matter Energy: Fix powerConsumptionReport delta, rename energy parameter, and fix endpoint typo#3112
Open
sangheedotkim wants to merge 3 commits into
Open
Conversation
…ent state The energy delta calculation in `report_power_consumption_to_st_energy` was incorrectly reading the previous energy state from the "main" component regardless of whether the report was for imported or exported energy. This caused incorrect deltaEnergy values when multiple energy components were involved. Also update test_battery_storage.lua expectations to verify non-zero delta values (100 Wh) now that the correct component state is used.
…usage The parameter `latest_total_imported_energy_wh` in the `report_power_consumption_to_st_energy` function was misleadingly named since the function handles both imported and exported energy reporting (determined by the component id).
|
Invitation URL: |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 162e25e |
…te_handler Fix a typo in the `evse_supply_state_handler` function where `ib.endopint_id` was used instead of `ib.endpoint_id` when calling `device:endpoint_to_component()`. This typo would cause the handler to fail when looking up the correct component for the EVSE supply state.
hcarter-775
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Summary
This PR contains three small fixes for the Matter Energy driver:
Fix powerConsumptionReport delta calculation: The energy delta was incorrectly reading from the
"main"component instead of the actual component (importedEnergy/exportedEnergy), causing incorrectdeltaEnergyvalues (always 0 for non-main components).Rename energy parameter:
latest_total_imported_energy_wh→latest_total_energy_whsince the function handles both imported and exported energy.Fix typo:
ib.endopint_id→ib.endpoint_idinevse_supply_state_handler.Changes
drivers/SmartThings/matter-energy/src/init.lua:device:get_latest_state("main", ...)→device:get_latest_state(component.id, ...)latest_total_imported_energy_wh→latest_total_energy_whib.endopint_id→ib.endpoint_iddrivers/SmartThings/matter-energy/src/test/test_battery_storage.lua:deltaEnergyvalues (100 Wh)Type of Change
Checklist
Summary of Completed Tests