Skip to content

feat(1P): add state_class measurement to External CT Power sensor - #152

Merged
Lewa-Reka merged 1 commit into
Lewa-Reka:mainfrom
SupermotoJerry:feature/external-ct-power-state-class
Oct 11, 2026
Merged

Lewa-Reka merged 1 commit into
Lewa-Reka:mainfrom
SupermotoJerry:feature/external-ct-power-state-class

Conversation

@SupermotoJerry

@SupermotoJerry SupermotoJerry commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds state_class: "measurement" to the External CT Power sensor (register 172)
for single-phase hybrid inverters.

Without a state_class, Home Assistant doesn't record long-term statistics for this
sensor, so it can't be used in the Energy dashboard (e.g. via a Riemann sum integration)
or in statistics graphs. This matches the other power sensors that already got a
state_class in #116.

Changes relate to

  • Docs
  • Deye 3P LP
  • Deye 3P HV
  • Deye 1P LP
  • Other

🤖 Generated with Claude Code

Summary by Sourcery

Bug Fixes:

  • Enable Home Assistant long-term statistics for the single-phase hybrid inverter External CT Power sensor.

External CT Power (register 172) had device_class: power but no state_class,
so Home Assistant kept no long-term statistics for it. Add state_class:
measurement to match the other power sensors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds Home Assistant's measurement state class to the single-phase hybrid inverter External CT Power sensor (register 172), allowing long-term statistics, statistics graphs, and Riemann-sum Energy dashboard integrations.

File-Level Changes

Change Details Files
Enable long-term statistics and Energy dashboard compatibility for the External CT Power sensor.
  • Set the sensor state class to measurement while preserving its existing power device class and scaling configuration.
pv_inverter/packages/deye_hybrid_1p/grid.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@Lewa-Reka
Lewa-Reka merged commit 9f4f6c9 into Lewa-Reka:main Oct 11, 2026
3 checks passed
@SupermotoJerry
SupermotoJerry deleted the feature/external-ct-power-state-class branch October 11, 2026 06:27
Bonabrux added a commit to Bonabrux/esphome-deye-inverter that referenced this pull request Oct 14, 2026
… 3389-1515)

New entry point pv_inverter/deye_hybrid_1p_lv_v118.yaml next to the existing
1P one, so users on older firmwares are unaffected. Reuses inverter/load/pv
from deye_hybrid_1p; includes the AC power ratio scaling (Lewa-Reka#123), External CT
Power state_class (Lewa-Reka#152) and Battery Current scale (Lewa-Reka#128) fixes.

Shared-register switches (248, 274-279, 280, 326) write via read-modify-write
so toggling one bit no longer clears the others.
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