Skip to content

feat: add listen_WallConnectorTotals for wall_connector_totals events - #59

Merged
Bre77 merged 1 commit into
mainfrom
fm/pts-wall-connector-totals
Oct 12, 2026
Merged

Bre77 merged 1 commit into
mainfrom
fm/pts-wall-connector-totals

Conversation

@Bre77

@Bre77 Bre77 commented Oct 12, 2026

Copy link
Copy Markdown
Member

Adds TeslemetryStreamEnergySite.listen_WallConnectorTotals delivering a WallConnectorTotalsEvent (date verbatim, created_at, is_cache, totals: DIN -> Wh). Site id rides id. Adds SseTopic.WALL_CONNECTOR_TOTALS to SSE_ENERGY_TOPICS.

energy_totals and wall_connector_totals share one envelope and the decoded event has no topic name, so the listeners tell them apart by the totals keys (EnergyHistoryTotals field names vs DINs). listen_EnergyTotals now skips wall connector events instead of parsing them as all-None totals.

Tests: tests/test_energysite_events.py.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Teslemetry/coderabbit/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b6caee05-3a5d-4c8a-9e4a-de39eda60b45

📥 Commits

Reviewing files that changed from the base of the PR and between e80662c and 3d60127.


📒 Files selected for processing (4)
  • README.md
  • teslemetry_stream/const.py
  • teslemetry_stream/energysite.py
  • tests/test_energysite_events.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



📝 Walkthrough

Walkthrough

Adds a wall-connector totals event type and listen_WallConnectorTotals to energy-site streams. Energy-history totals and wall-connector totals are routed to separate listeners based on the event payload.

Changes

Wall Connector Totals

Layer / File(s) Summary
Totals event contract
teslemetry_stream/const.py
Adds the wall-connector totals topic and event parser. Adds a helper that identifies energy-history totals by their fields.
Energy-site listener routing
teslemetry_stream/energysite.py, tests/test_energysite_events.py, README.md
Filters totals events by site and payload type. Adds the wall-connector totals listener, tests for event parsing and listener separation, and listener documentation.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature


Merge Risk | ⚪ Minimal · up to 3d601

Merge Risk: ⚪ Minimal · up to 3d601

Wall Connector totals reach the new listener without disrupting energy-history totals. The change is ready to merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 3d601

The client preserves existing authentication, site filtering, and listener failure isolation. No introduced security weakness was demonstrated, but server-side permissions and payload compatibility for the new topic could not be verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The added client-side data path delivers connector identifiers and daily energy totals to supplied callbacks for a matching site. It uses the existing SSE connection and adds no device-command, credential-management, or persistent-write path in the production diff. Effective backend token and tenant scope remains unverified.

Trust Boundaries and Controls

  • observed — Bearer authentication and request construction remain centralized in the existing stream. Both totals listeners compare the normalized event ID with their site before conversion and callback delivery. This client-side routing check does not establish server authorization for the new topic.

Resilience and Maintainability Implications

  • observed — Central dispatch snapshots the listener registry and catches listener exceptions. Classifier, event-conversion, or callback failure can prevent that notification from reaching its consumer but does not terminate fan-out to other listeners. This failure-containment mechanism is unchanged.

Hardening Proposals

  • proposed — Confirm the producer contract for supported server versions: the new topic should inherit equivalent token, site, and tenant permissions, be accepted by the closed allowlist, and guarantee the key shapes assumed by the classifier. This is a validation proposal, not an observed authorization or routing vulnerability.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding listen_WallConnectorTotals for wall_connector_totals events.
Description check Passed The description accurately describes the new listener, event fields, topic registration, event classification, and related tests.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Bre77
Bre77 merged commit 5ea55dd into main Oct 12, 2026
15 checks passed
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.

1 participant