Skip to content

consumer rfid - #4170

Merged
LKuemmel merged 3 commits into
masterfrom
feature_consumer_rfid
Nov 10, 2026
Merged

LKuemmel merged 3 commits into
masterfrom
feature_consumer_rfid

Conversation

@LKuemmel

@LKuemmel LKuemmel commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Implement RFID authorization and lifecycle management for MQTT-backed consumers.

New Features:

  • Add RFID-based authorization for configurable MQTT consumers, including tag matching, lockout, expiration, and optional reset after charging ends.

Bug Fixes:

  • Clarify chargepoint RFID rejection messages to indicate that a tag is not assigned to a profile or vehicle.

Enhancements:

  • Expose RFID state, timestamps, reset settings, and authorization status through consumer data and MQTT topics.
  • Clear processed RFID input through consumer modules while preserving authorization state and reset it when RFID control is inactive.
  • Support RFID input and clearing in generic MQTT consumers and forward RFID state through the consumer store.

Tests:

  • Add coverage for RFID authorization, expiration, power-end resets, disabled modes, MQTT handling, state storage, and configuration serialization.

@LKuemmel
LKuemmel added this pull request to stack #4171 October 22, 2026 10:42
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch 2 times, most recently from 3ceb62d to dd95f20 Compare October 23, 2026 08:44
@LKuemmel
LKuemmel requested a lite review from Copilot October 23, 2026 09:45

Copilot AI 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.

🟡 Changes recommended

Consumer usage transitions can retain stale RFID authorization, and a parameterized store test fails with a missing call import.

2 open issues
What changed in this PR

Adds end-to-end RFID authorization support for MQTT consumers, including tag acquisition, validation, expiry, reset behavior, state publication, and configuration handling.

Changes:

  • Adds RFID configuration, runtime state, authorization, timeout, and reset logic.
  • Extends MQTT consumers and stores to receive, publish, and clear RFID data.
  • Refactors internal chargepoint client context management and updates RFID messaging.
File Description
packages/​modules/​internal_chargepoint_handler/​internal_chargepoint_handler.py Uses ExitStack to manage unique client contexts.
packages/​modules/​consumers/​generic/​mqtt/​consumer.py Adds MQTT RFID parsing and clearing.
packages/​modules/​consumers/​generic/​mqtt/​consumer_test.py Tests MQTT RFID state handling and clearing.
packages/​modules/​common/​store/​_consumer.py Publishes consumer RFID state to broker topics.
packages/​modules/​common/​store/​_consumer_test.py Tests RFID state forwarding.
packages/​modules/​common/​configurable_consumer.py Adds the configurable RFID-clear callback.
packages/​modules/​common/​component_state.py Extends consumer state with RFID fields.
packages/​helpermodules/​update_config.py Registers consumer RFID topics.
packages/​helpermodules/​setdata.py Adds validation for consumer RFID topics and values.
packages/​control/​consumer/​rfid.py Implements RFID authorization and expiration logic.
packages/​control/​consumer/​rfid_test.py Tests RFID authorization, reset, and timeout behavior.
packages/​control/​consumer/​consumer.py Integrates RFID processing into the consumer control loop.
packages/​control/​consumer/​consumer_data.py Adds RFID configuration and runtime data fields.
packages/​control/​chargepoint/​rfid.py Updates an RFID assignment error message.

Review effort: Lite

Comment thread packages/control/consumer/consumer.py Resolved
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from 8f0598f to e1f21e2 Compare October 23, 2026 12:55
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch 2 times, most recently from 9bff351 to b6ecdfa Compare October 26, 2026 11:29
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from 0d3ff73 to bb59938 Compare October 27, 2026 10:45
@LKuemmel
LKuemmel requested a review from ndrsnhs October 27, 2026 10:49
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from bb59938 to bf4b647 Compare October 29, 2026 08:30
@LKuemmel
LKuemmel removed this pull request from stack #4171 October 29, 2026 08:53
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from bf4b647 to ebaa224 Compare October 29, 2026 08:56
@LKuemmel
LKuemmel added this pull request to stack #4212 October 29, 2026 08:57
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from ebaa224 to 64472b4 Compare October 29, 2026 08:59
Base automatically changed from feature_refactor_internal_chargepoint_handler to Beta November 3, 2026 12:36
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch 2 times, most recently from 03acfa0 to 06a7535 Compare November 3, 2026 13:17
@LKuemmel
LKuemmel removed this pull request from stack #4212 November 3, 2026 13:17
@LKuemmel
LKuemmel changed the base branch from Beta to master November 3, 2026 13:17
@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from 06a7535 to 4ad7a73 Compare November 3, 2026 13:48
@LKuemmel
LKuemmel added this pull request to stack #4257 November 3, 2026 13:50
@ndrsnhs
ndrsnhs requested a lite review from Copilot November 4, 2026 14:30

Copilot AI 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.

🔵 Needs a closer look

The new test module uses call without importing it, causing every test invocation to fail with NameError before validating the store behavior.

No open issues 🎉

2 resolved since last review

Review effort: Lite

@LKuemmel
LKuemmel force-pushed the feature_consumer_rfid branch from 4ad7a73 to 8d740ef Compare November 10, 2026 13:26
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add consumer RFID configuration, input and authorization state, reset modes, and the module protocol that the mixin relies on.

  • packages/control/consumer/consumer_data.py L36-40, L66-69, L128-140 (+3 small edits)

Extend the shared consumer state interface with the RFID tag and its timestamp so modules can return scanned tags.

  • packages/modules/common/component_state.py L298-299, L318-319

API

Expose an optional RFID-clearing callback on configurable consumers so control code can acknowledge and clear module input.

  • packages/modules/common/configurable_consumer.py L36-37, L46, L109-112

Uses of the API

Connect the generic MQTT consumer to the RFID state and clearing callback, returning received tags and publishing clears to the MQTT input topics.

  • packages/modules/consumers/generic/mqtt/consumer.py L18-21, L43-53 (+3 small edits)

Implementation

Implement consumer RFID matching, input clearing, authorization expiry and reset-after-power-end behavior.

  • packages/control/consumer/rfid.py L1-61

Integrate the RFID mixin into Consumer, update it during operation, and stop control output when RFID authorization is required but absent.

  • packages/control/consumer/consumer.py L7-127 (4 small edits)

Clarify the chargepoint rejection message to explain that the tag is not associated with a profile or vehicle at that point.

  • packages/control/chargepoint/rfid.py L74

Forward non-null consumer RFID state to the broker without clearing the pending module input.

  • packages/modules/common/store/_consumer.py L34-37

Configuration

Add RFID topic validation and retain the new consumer RFID topics during configuration updates.

  • packages/helpermodules/setdata.py L1298-1307, L1326-1327, L1332
  • packages/helpermodules/update_config.py L228-233, L397-398

Tests

Test consumer RFID state clearing, configuration decoding, tag matching, expiry, power-end reset, and authorization behavior.

  • packages/control/consumer/rfid_test.py L1-257

Test that consumer state publishing forwards RFID values only when present.

  • packages/modules/common/store/_consumer_test.py L1-18

Test MQTT RFID reception and that tags are cleared only when the clear callback is invoked.

  • packages/modules/consumers/generic/mqtt/consumer_test.py L1-38

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

@LKuemmel
LKuemmel merged commit 075c6ef into master Nov 10, 2026
2 checks passed
@LKuemmel
LKuemmel deleted the feature_consumer_rfid branch November 10, 2026 13:33
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.

3 participants