Skip to content

feat(sensor): expose solar power, charge power and CT diagnostics - #79

Open
AnDevX wants to merge 3 commits into
HA-AndersenEV:mainfrom
AnDevX:feat/solar-sensors
Open

feat(sensor): expose solar power, charge power and CT diagnostics#79
AnDevX wants to merge 3 commits into
HA-AndersenEV:mainfrom
AnDevX:feat/solar-sensors

Conversation

@AnDevX

@AnDevX AnDevX commented Aug 21, 2026

Copy link
Copy Markdown

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

  • ruff check / ruff format — clean
  • pytest — 301/301 passing (updated entity-count assertions in
    test_sensor.py for the 6 new entities × 2 test devices)
  • Verified against a live A3: new sensors read plausible values
    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

AnDevX added 2 commits August 21, 2026 09:05
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and sysSolarEnergyDelta (kW/kWh) from deviceStatus.
  • Add diagnostic live sensors for sysSolarCT, sysGridCT, and cfgCTConfig.
  • 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.

Comment thread custom_components/andersen_ev/sensor.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants