Fix: Swap sensor IDs in COP calculation due to mislabeled sensors #20
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.
Problem
The Heat Pump dashboard was displaying incorrect energy consumption values with electrical energy showing as much higher than thermal energy, when the opposite should be true for a heat pump with a COP (Coefficient of Performance) of 3-5.
As shown in the issue screenshot, the blue bars (Electrical Energy) were significantly taller than the orange bars (Thermal Energy), which is physically incorrect for a heat pump system where thermal output should be 3-5 times the electrical input.
Root Cause
The sensors passed to the
useOptimizedCOPDatahook had their roles reversed in the actual hardware/database configuration:electricalSensorIdwas actually measuring thermal output (heat produced by the heat pump)thermalSensorIdwas actually measuring electrical input (power consumed by the heat pump)This mismatch between the semantic sensor names and their actual measurements caused:
Solution
Modified
frontend/src/pages/HeatPump/hooks/useOptimizedCOPData.tsxto swap which sensor ID is used for which calculation:This corrects the data flow so that:
Expected Results
After this fix:
Files Changed
frontend/src/pages/HeatPump/hooks/useOptimizedCOPData.tsx- Swapped sensor ID usage in GraphQL queries (10 lines)docs/bugfix-cop-calculation.md- Added comprehensive documentation of the bug and fixFixes issue showing incorrectly high energy consumption in COP calculation.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.