Repository navigation
Answer zero-MAC CT probes with the configured CT MAC - #726
Closed
kvanbiesen wants to merge 5 commits into
Closed
kvanbiesen wants to merge 5 commits into
kvanbiesen wants to merge 5 commits into
Conversation
- Set version in pyproject.toml, uv.lock and ha_addon/config.yaml - Pin ESPHome external_components ref to v2.3.1 - Finalize CHANGELOG for v2.3.1
An unpaired Venus E Mini (VNSEM-0) probes with ct_mac=000000000000. With CT_MAC set, those probes were ignored as a MAC mismatch; with it empty, the emulator echoed 000000000000 back. Either way pairing failed, while a real CT003 answers with its own MAC and pairs instantly. Accept empty/all-zero CT MACs when CT_MAC is configured, so the reply carries the configured MAC like a real CT. Requests naming a different non-zero MAC are still ignored, and an empty CT_MAC behaves as before.
Contributor
|
I moved this pull request onto If you branched off git fetch origin
git rebase --onto origin/develop origin/main
git push --force-with-leaseIf you branched off |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 7
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add validation for empty MAC address in CT002Component. for venus mini with firmware 301. To have same fix as the py version
Author
|
Darn, i fucked up the PR, just update the 2 files ct002.cpp and ct002.py and i accidently added the main one |
5 tasks done
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.
Problem
A Marstek Venus E Mini (
VNSEM-0) cannot be paired with the CT003 emulator. Selecting the AstraMeter CT in the Marstek app and pressing configure ends in "configuration failed", with nothing in the AstraMeter log. A real CT003 pairs with the same battery instantly, and a Venus E 2.0 (HMG-50) pairs with the emulated CT without problems.Cause
An unpaired battery probes for a CT with an all-zero CT MAC:
Neither
CT_MACmode answers that probe the way a real CT does:`
CT_MAC000000000000as its own MAC02b250aabbcc)A real CT answers with its own MAC. The Venus E Mini apparently uses that reply to confirm the CT it was told to pair with exists. The Venus E 2.0 doesn't hit this because it already probes with the bound MAC, even during inspection:
Change
When
CT_MACis configured,CT002._ct_mac_matchesnow also accepts requests whose CT MAC is empty or000000000000. The existing response path (self.ct_mac or request.ct_mac) then answers with the configured MAC, so the emulator identifies itself like a real CT.CT_MACempty: unchanged (still answers everything and echoes the request's MAC).CT_MACset: requests naming a different non-zero CT MAC are still ignored, so multiple CTs on one network keep working.Testing
Tested on real hardware with AstraMeter
develop, CT003 emulation,CT_MACset to the managed cloud CT's MAC:ct_mac=000000000000in inspection mode, and configure in the Marstek app fails.fields=['HME-3', '02b250aabbcc', 'VNSEM-0', ...]), configure succeeds immediately, and the battery leaves inspection mode and is steered normally.Notes / possible follow-up
With Marstek cloud registration (
[MARSTEK]), AstraMeter already knows the managed CT's MAC. DefaultingCT_MACto that value when it's left empty would make Venus E Mini pairing work without any manual configuration. I've left that out of this PR to keep the change minimal.Checklist
[0 ] Base branch is
develop, notmain-> its in main cause i can test that one more easely, easy to port to develop ofc[ x]
uv run ruff format . && uv run ruff check . && uv run mypy src/ && uv run pytest[ x] Python ↔ ESPHome parity held for shared CT002 behaviour, or does not apply (CONTRIBUTING.md)
[0 ]
web/changes: rebuilt the dashboard bundle (cd web && npm run build:dashboard) and committed it[ 0] User-visible change: one bullet under
## Nextin CHANGELOG.mdSummary by CodeRabbit