Skip to content

fix(1P): correct Battery Current scale from 0.01A to 0.1A (register 191) - #128

Merged
Lewa-Reka merged 1 commit into
Lewa-Reka:mainfrom
SupermotoJerry:fix/battery-current-scale-1p
Oct 10, 2026
Merged

Lewa-Reka merged 1 commit into
Lewa-Reka:mainfrom
SupermotoJerry:fix/battery-current-scale-1p

Conversation

@SupermotoJerry

@SupermotoJerry SupermotoJerry commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes the scaling of the Battery Current sensor (register 191) for single-phase
hybrid inverters. Fixes #127.

The sensor was applying a multiply: 0.01 filter, but register 191 reports
battery current with a resolution of 0.1 A per LSB, so the reported current was
10x lower than the actual value.

As shown in #127, comparing battery current from inverter screen vs the inverter's
Modbus data:
Battery Power agreed perfectly between the two, but Battery Current
was exactly 10x too low. Since power was correct, only the current scale factor
was wrong. With multiply: 0.1 the current matches the BMS reading and is
consistent with Power = Voltage × Current.

Changes relate to

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

Summary by Sourcery

Bug Fixes:

  • Correct the single-phase hybrid inverter Battery Current sensor scaling to report register 191 values accurately in amperes.

@TheApsik TheApsik 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.

This parameter is related to the model of inverter. We need smart solution for this issue. I have a few ideas thatr may help:

  1. Specify by user inverter model(partially implemented)
  2. Auto detection. Dividing by power and voltage.

@SupermotoJerry

Copy link
Copy Markdown
Contributor Author

This parameter is related to the model of inverter. We need smart solution for this issue. I have a few ideas thatr may help:

  1. Specify by user inverter model(partially implemented)
  2. Auto detection. Dividing by power and voltage.
  1. Auto detection. Dividing by power and voltage.
  • this seems like a good idea except, Battery power could also be scaled incorrectly and if power is also scaled incorrectly this can cause issues.

See #123

register 190 (battery power) is scaled as 10W on my inverter. which is part of register 54 ac power scaling.

@SupermotoJerry
SupermotoJerry force-pushed the fix/battery-current-scale-1p branch from a1b4df9 to 523c69b Compare August 13, 2026 12:33
@Lewa-Reka

Copy link
Copy Markdown
Owner

@SupermotoJerry and @TheApsik thanks for all of this. Nice. Could you summarize it in simple words? Do we still need this if I merge #123?

I'm a bit confused and not sure if auto-detection works for all values or not.

@SupermotoJerry

Copy link
Copy Markdown
Contributor Author

@SupermotoJerry and @TheApsik thanks for all of this. Nice. Could you summarize it in simple words? Do we still need this if I merge #123?

I'm a bit confused and not sure if auto-detection works for all values or not.

Hi Lewa-Reka,

#123 is regarding power. #128 is only for current, but i think #128 we need to add a way to select inverter or auto select that changes the current based on the inverter.

#123 deals with a scaling value for power. it happens to cover alot of registers

image register 54 is used as a scale for the highlighted registers.

@Lewa-Reka

Copy link
Copy Markdown
Owner

@sourcery-ai review

@sourcery-ai

sourcery-ai Bot commented Oct 10, 2026

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

Reviewer's Guide

Updates the single-phase hybrid inverter Battery Current sensor scaling from 0.01 A to 0.1 A per register unit, fixing readings that were reported at one-tenth of the actual current.

File-Level Changes

Change Details Files
Correct the Battery Current sensor conversion to match register 191’s 0.1 A-per-LSB resolution.
  • Replace the conversion multiplier from 0.01 to 0.1.
  • Preserve the existing signed register type, current device class, precision, and icon configuration.
pv_inverter/packages/deye_hybrid_1p/battery.yaml

Assessment against linked issues

Issue Objective Addressed Explanation
#127 Correct the single-phase hybrid inverter battery current sensor scaling for register 191 from 0.01 A per LSB to 0.1 A per LSB, so reported current is accurate. ✅

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

Copy link
Copy Markdown
Owner

@SupermotoJerry thx!

@Lewa-Reka
Lewa-Reka merged commit cbb2f1d into Lewa-Reka:main Oct 10, 2026
10 checks passed
@SupermotoJerry
SupermotoJerry deleted the fix/battery-current-scale-1p branch October 11, 2026 02:06
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.

1P Battery Current Register scaling

3 participants