-
Notifications
You must be signed in to change notification settings - Fork 47
Improve PIN code handling and add code_arm_required option #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
clintongormley
wants to merge
5
commits into
guerrerotook:main
from
clintongormley:fix/pin-and-const-cleanup
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c570491
PIN code is handled in better way
poupounetjoyeux 1c26d51
Support text PIN codes
poupounetjoyeux a8984d9
Update custom_components/securitas/translations/en.json
guerrerotook 5979076
Remove leftover arm_away_as_arm_night reference
clintongormley 23e617a
Fix review issues: backward compat, PIN preservation, translation
clintongormley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,10 +18,12 @@ | |||||||||||||||||||||||
| from homeassistant.helpers.entity import DeviceInfo | ||||||||||||||||||||||||
| from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||||||||||||||||||||||||
| from homeassistant.helpers.event import async_track_time_interval | ||||||||||||||||||||||||
| from homeassistant.exceptions import ServiceValidationError | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| from . import ( | ||||||||||||||||||||||||
| CONF_INSTALLATION_KEY, | ||||||||||||||||||||||||
| DEFAULT_SCAN_INTERVAL, | ||||||||||||||||||||||||
| CONF_CODE_ARM_REQUIRED, | ||||||||||||||||||||||||
| DOMAIN, | ||||||||||||||||||||||||
| SecuritasDirectDevice, | ||||||||||||||||||||||||
| SecuritasHub, | ||||||||||||||||||||||||
|
|
@@ -87,7 +89,6 @@ def __init__( | |||||||||||||||||||||||
| """Initialize the Securitas alarm panel.""" | ||||||||||||||||||||||||
| self._state: str = AlarmControlPanelState.DISARMED | ||||||||||||||||||||||||
| self._last_status: str = AlarmControlPanelState.DISARMED | ||||||||||||||||||||||||
| self._changed_by: str = "" | ||||||||||||||||||||||||
| self._device: str = installation.address | ||||||||||||||||||||||||
| self.entity_id: str = f"securitas_direct.{installation.number}" | ||||||||||||||||||||||||
| self._attr_unique_id: str = f"securitas_direct.{installation.number}" | ||||||||||||||||||||||||
|
|
@@ -121,6 +122,13 @@ def __init__( | |||||||||||||||||||||||
| self._update_unsub = async_track_time_interval( | ||||||||||||||||||||||||
| hass, self.async_update_status, self._update_interval | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| self._code: str | None = client.config.get(CONF_CODE, None) | ||||||||||||||||||||||||
| self._attr_code_format: CodeFormat | None = None | ||||||||||||||||||||||||
| if self._code: | ||||||||||||||||||||||||
| self._attr_code_format = CodeFormat.NUMBER if self._code.isdigit() else CodeFormat.TEXT | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+125
to
+130
|
||||||||||||||||||||||||
| self._code: str | None = client.config.get(CONF_CODE, None) | |
| self._attr_code_format: CodeFormat | None = None | |
| if self._code: | |
| self._attr_code_format = CodeFormat.NUMBER if self._code.isdigit() else CodeFormat.TEXT | |
| self._code: str | None = client.config.get(CONF_CODE, None) | |
| self._attr_code_format: CodeFormat | None = None | |
| if self._code: | |
| self._attr_code_format = CodeFormat.NUMBER if self._code.isdigit() else CodeFormat.TEXT |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's trailing whitespace at the end of this line that should be removed for code cleanliness.