Skip to content

Clear session observations that Zaptec sends without a value - #425

Open
rhammen wants to merge 1 commit into
custom-components:masterfrom
rhammen:fix/issue-200-clear-session-observations
Open

rhammen wants to merge 1 commit into
custom-components:masterfrom
rhammen:fix/issue-200-clear-session-observations

Conversation

@rhammen

@rhammen rhammen commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Zaptec ends a charging session by sending observations 721 (SessionIdentifier) and 722 (ChargerCurrentUserUuid) with no Value/ValueAsString field at all. state_to_attrs skips entries without a value, so the attributes kept the previous session's values indefinitely.

This explains the report in #200 (comment): charger_current_user_uuid appearing not to update with the RFID tag, while AuthenticationCode did. 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: Pulse is 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 appear valueless in the charger state after a session ends, 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

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>
@rhammen

rhammen commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Corrected the last line of the description: "within seconds of session end" was inferred from recorder history, which records when Home Assistant polled rather than when Zaptec sent the observation, so the timing was not something I actually measured. The valueless observations and the clearing behaviour are unchanged — only that claim was unsupported.

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