fix: PIN code handling improvements#345
Merged
guerrerotook merged 1 commit intoFeb 27, 2026
Merged
Conversation
c0225ef to
7448b94
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Follow-up fixes to the Securitas Direct integration’s PIN code feature (introduced/modified in #326), focusing on making PIN clearing work correctly in the options flow and hardening arm/disarm PIN enforcement behavior.
Changes:
- Update options flow PIN field to use
suggested_value(so clearing the field can persist) and ensure a missing submission clears the stored PIN. - Adjust arm-time PIN checking to skip validation when no PIN is configured.
- Update UI labels and add/ensure exception translation strings for invalid PIN errors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| custom_components/securitas/config_flow.py | Options flow: make PIN value “suggested” (not forced) and normalize missing PIN input to an explicit empty value. |
| custom_components/securitas/alarm_control_panel.py | Arm-time PIN check now bypasses when no PIN is configured; uses translated ServiceValidationError for invalid PIN. |
| custom_components/securitas/strings.json | Update label text for code_arm_required and include exception translation for invalid PIN. |
| custom_components/securitas/translations/en.json | English translation updates for the code_arm_required label and invalid PIN exception message. |
| custom_components/securitas/translations/es.json | Spanish translation updates for the code_arm_required label and invalid PIN exception message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use suggested_value instead of default for PIN field in options flow, allowing users to clear the PIN by emptying the field - Skip PIN check for arming when no PIN is configured (defense-in-depth) - Change default for code_arm_required to False (arm without PIN by default) - Clarify label: "Also require PIN code (if any) to arm alarm" - Add missing translation for invalid_pin_code ServiceValidationError - Fix docstring grammar in _check_code_for_arm_if_required - Sync strings.json and es.json with new keys Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7448b94 to
11ac519
Compare
guerrerotook
approved these changes
Feb 27, 2026
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.
Summary
Follow-up fixes to #326 (AndroidAuto / PIN code feature):
suggested_valueinstead ofdefaultfor the PIN field in the options flow, so clearing the field actually removes the PIN instead of silently restoring it_check_code_for_arm_if_requirednow skips the PIN check when no PIN is configured, even ifcode_arm_requiredis staleTruein the configcode_arm_requireddefaults toFalse(don't require PIN to arm)exceptions.invalid_pin_codetostrings.json,en.json, andes.jsonsoServiceValidationErrorrenders properly_check_code_for_arm_if_requiredTest plan
🤖 Generated with Claude Code
Relates to #326