feat(sensor): expose solar power, charge power and CT diagnostics - #79
Open
AnDevX wants to merge 3 commits into
Open
feat(sensor): expose solar power, charge power and CT diagnostics#79AnDevX wants to merge 3 commits into
AnDevX wants to merge 3 commits into
Conversation
sysSolarPower, sysSolarEnergyDelta, sysChargePower, sysSolarCT, sysGridCT and cfgCTConfig were already requested in the GraphQL device status query and present in every poll response, but never turned into entities - only their grid equivalents were. Adds six AndersenEvLiveSensor entities reusing the existing class unchanged. sysSolarPower lives in deviceStatus, not chargeStatus, so it reports continuously rather than only during a charge session, making this a whole-house solar monitor with no new API calls or config changes.
Kettle test against a live A3 (car unplugged, ~2.9kW kettle) showed sensor.*_system_grid_power spiking to ~2.9, confirming the declared KILO_WATT unit is correct rather than mislabelled watts. Replaces the prior "unverified" caveat comment with the confirmed result.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes additional live-status fields already returned by the Andersen EV GraphQL device status poll as Home Assistant sensor entities, expanding the integration’s live monitoring to include solar/charge power and CT clamp diagnostics without adding new API calls or configuration.
Changes:
- Add live sensors for
sysSolarPower,sysChargePower, andsysSolarEnergyDelta(kW/kWh) fromdeviceStatus. - Add diagnostic live sensors for
sysSolarCT,sysGridCT, andcfgCTConfig. - Update sensor entity-count assertions in tests to account for the new entities across multiple devices.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| custom_components/andersen_ev/sensor.py | Adds six new AndersenEvLiveSensor entities for solar/charge power and CT diagnostics; includes explanatory comments about unit differences between deviceStatus vs chargeStatus fields. |
| custom_components/andersen_ev/tests/test_sensor.py | Updates assertions to reflect the increased number of created sensor entities (including additional live sensors). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
sysSolarPower, sysSolarEnergyDelta, sysChargePower, sysSolarCT, sysGridCT and
cfgCTConfig are already requested in the GraphQL device status query and present
in every poll response, but were never turned into entities — only their grid
equivalents were.
Adds six entities reusing the existing AndersenEvLiveSensor class unchanged:
sys_solar_power, sys_charge_power, sys_solar_energy_delta, sys_solar_ct,
sys_grid_ct, cfg_ct_config.
sysSolarPower lives in deviceStatus, not chargeStatus, so it reports
continuously rather than only during a charge session — this turns the
integration into a whole-house solar monitor with no new API calls, no new
dependencies, and no config changes.
Also resolves an open question about sysGridPower's declared unit: a kettle
test against a live A3 (~2.9kW kettle, car unplugged) showed
system_grid_power spike to ~2.9, confirming KILO_WATT is correct rather than
mislabelled watts.
Test plan
test_sensor.py for the 6 new entities × 2 test devices)
cross-checked against the Andersen app (solar 0.24 vs app's 0.2,
grid 0.01 vs app's 0), and the kettle test above confirmed units