Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions custom_components/securitas/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(
self._attr_code_format: CodeFormat | None = None
if self._code:
self._attr_code_format = CodeFormat.NUMBER if self._code.isdigit() else CodeFormat.TEXT
self._attr_code_arm_required: bool = client.config.get(CONF_CODE_ARM_REQUIRED, True) if self._code else False
self._attr_code_arm_required: bool = client.config.get(CONF_CODE_ARM_REQUIRED, False) if self._code else False

self._attr_device_info: DeviceInfo = DeviceInfo(
identifiers={(DOMAIN, self._attr_unique_id)},
Expand Down Expand Up @@ -230,8 +230,8 @@ def update_status_alarm(self, status: CheckAlarmStatus | None = None) -> None:
)

def _check_code_for_arm_if_required(self, code: str | None) -> bool:
"""Check the code only if arming requires a code."""
if not self.code_arm_required:
"""Check the code only if arming requires a code and a PIN is configured."""
if not self._code or not self.code_arm_required:
return True
Comment thread
clintongormley marked this conversation as resolved.
return self._check_code(code)

Expand Down
3 changes: 2 additions & 1 deletion custom_components/securitas/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ async def async_step_init(
) -> FlowResult:
"""Step 1: General settings."""
if user_input is not None:
user_input.setdefault(CONF_CODE, DEFAULT_CODE)
self._general_data = user_input
return await self.async_step_mappings()
scan_interval = self._get(CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL)
Expand All @@ -286,7 +287,7 @@ async def async_step_init(

schema = vol.Schema(
{
vol.Optional(CONF_CODE, default=self._get(CONF_CODE, DEFAULT_CODE)): str,
vol.Optional(CONF_CODE, description={"suggested_value": self._get(CONF_CODE, DEFAULT_CODE)}): str,
vol.Optional(CONF_CODE_ARM_REQUIRED, default=code_arm_required): bool,
vol.Optional(CONF_PERI_ALARM, default=peri_alarm): bool,
vol.Optional(
Expand Down
4 changes: 2 additions & 2 deletions custom_components/securitas/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"use_2FA": "Use 2FA",
"country": "Country Code",
"code": "PIN Code (leave empty for no PIN)",
"code_arm_required": "Require PIN code to arm",
"code_arm_required": "Also require PIN code (if any) to arm alarm",
"PERI_alarm": "Is there a Perimetral alarm?",
"check_alarm_panel": "Check alarm panel's status in every request",
"scan_interval": "Update scan interval (sec)",
Expand All @@ -35,7 +35,7 @@
"init": {
"data": {
"code": "PIN Code (leave empty for no PIN)",
"code_arm_required": "Require PIN code to arm",
"code_arm_required": "Also require PIN code (if any) to arm alarm",
"PERI_alarm": "Is there a Perimetral alarm?",
"check_alarm_panel": "Check alarm panel's status in every request (not recommended)",
"scan_interval": "Update scan interval (sec)",
Expand Down
4 changes: 2 additions & 2 deletions custom_components/securitas/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"use_2FA": "Use 2FA",
"country": "Country Code",
"code": "PIN Code (leave empty for no PIN)",
"code_arm_required": "Require PIN code to arm",
"code_arm_required": "Also require PIN code (if any) to arm alarm",
"PERI_alarm": "Is there a Perimetral alarm?",
"check_alarm_panel": "Check alarm panel's status in every request",
"scan_interval": "Update scan interval (sec)",
Expand All @@ -35,7 +35,7 @@
"init": {
"data": {
"code": "PIN Code (leave empty for no PIN)",
"code_arm_required": "Require PIN code to arm",
"code_arm_required": "Also require PIN code (if any) to arm alarm",
"PERI_alarm": "Is there a Perimetral alarm?",
"check_alarm_panel": "Check alarm panel's status in every request (not recommended)",
"scan_interval": "Update scan interval (sec)",
Expand Down
4 changes: 2 additions & 2 deletions custom_components/securitas/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"use_2FA": "Usar 2FA",
"country": "Código de país",
"code": "Código PIN (dejar vacío si no hay PIN)",
"code_arm_required": "Requerir código PIN para armar",
"code_arm_required": "Requerir también código PIN (si lo hay) para armar alarma",
"PERI_alarm": "¿Hay una alarma perimetral?",
"check_alarm_panel": "Comprobar el estado del panel de alarma en cada solicitud",
"scan_interval": "Intervalo de actualización (seg)",
Expand All @@ -35,7 +35,7 @@
"init": {
"data": {
"code": "Código PIN (dejar vacío si no hay PIN)",
"code_arm_required": "Requerir código PIN para armar",
"code_arm_required": "Requerir también código PIN (si lo hay) para armar alarma",
"PERI_alarm": "¿Hay una alarma perimetral?",
"check_alarm_panel": "Comprobar el estado del panel de alarma en cada solicitud (no recomendado)",
"scan_interval": "Intervalo de actualización (seg)",
Expand Down
Loading