Clear session observations that Zaptec sends without a value - #425
Open
rhammen wants to merge 1 commit into
Open
Clear session observations that Zaptec sends without a value#425rhammen wants to merge 1 commit into
rhammen wants to merge 1 commit into
Conversation
Zaptec signals the end of a session by sending SessionIdentifier (721) and ChargerCurrentUserUuid (722) with no ValueAsString field at all. state_to_attrs dropped those entries, so the attributes kept the previous session's values indefinitely (reported on custom-components#200: the live NFC tag never updating, disagreeing with CompletedSession.AuthenticationCode). Map the two observations to an empty value instead of skipping them. Scoped to those ids: Pulse is the only other observation seen without a value, and it never carries one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Zaptec ends a charging session by sending observations 721 (
SessionIdentifier) and 722 (ChargerCurrentUserUuid) with noValue/ValueAsStringfield at all.state_to_attrsskips entries without a value, so the attributes kept the previous session's values indefinitely.This explains the report in #200 (comment):
charger_current_user_uuidappearing not to update with the RFID tag, whileAuthenticationCodedid. The attribute wasn't failing to update — it was never cleared, so it kept showing the previous session's token.Map those two ids to an empty value instead of skipping them. Scoped to 721/722:
Pulseis the only other observation seen without a value, and it never carries one.Verified on a Zaptec Go 2 (fw 3.3.0.0): both observations arrive valueless within seconds of session end, and the derived attributes now clear.
Part of #200; the "Authorized by" sensors follow in a separate PR on top of this.
🤖 Generated with Claude Code