Skip to content

HEMS Pro: also probe I2C bus 0 for RTC - #33639

Merged
andig merged 4 commits into
evcc-io:masterfrom
deadrabbit87:fix/i2c_checkHemsPro
Sep 12, 2026
Merged

andig merged 4 commits into
evcc-io:masterfrom
deadrabbit87:fix/i2c_checkHemsPro

Conversation

@deadrabbit87

Copy link
Copy Markdown
Contributor

Problem

checkHemsPro() opens the DS1307 RTC at a hardcoded I2C bus number (bus 1). This works on every Raspberry Pi, since I2C1 is the general-purpose header bus by RPi convention — but other SBCs number their I2C controllers differently, with no such guarantee.

Reproduced on a Banana Pi BPI-M2 Zero: the RTC is wired and responds correctly, but on bus 0, not bus 1 (bus 1 there is the SoC's internal HDMI DDC bus). As a result checkHemsPro() always returns "", and HEMSPRO=1 hardware auto-authorization never succeeds on that board.

Fix

Try bus 1 first, so Raspberry Pi behavior is unchanged (succeeds on the first attempt). Only if that fails, fall back to bus 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N94JCMESPj2NP6qxc4rbE7

deadrabbit87 and others added 2 commits September 10, 2026 20:26
Merge the duplicate/broken checkHemsPro functions left over from the
previous commit into one, keeping the string return signature expected
by auth.go while probing I2C bus 1 then bus 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N94JCMESPj2NP6qxc4rbE7
@github-actions github-actions Bot added the bug Something isn't working label Sep 10, 2026
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 10, 2026

@sourcery-ai sourcery-ai Bot 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.

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 ✨

@andig

andig commented Sep 11, 2026

Copy link
Copy Markdown
Member

Isn't the HEMS Pro always on Raspi?

@deadrabbit87

deadrabbit87 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

No, due to supply shortages of the Raspberry, the HEMS PRO should be also shipped with the banana pi.

cc @AhmadDerZerstoerer

Leftover from merge conflict resolution, tripped gofmt/gci in CI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017QKb7RRCCTvcawHqiiy86k
@sourcery-ai
sourcery-ai Bot dismissed their stale review September 11, 2026 15:51

Sourcery withdrew this approval because the latest commits introduced blocking findings.

@andig andig added devices Specific device support and removed bug Something isn't working labels Sep 12, 2026
@andig
andig merged commit 266fe27 into evcc-io:master Sep 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devices Specific device support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants