home-assistant/core · error · AlexaSecurityPanelAuthorizationRequired

AUTHORIZATION_REQUIRED

AUTHORIZATION_REQUIRED

Error message

You must disarm the system before you can set the requested arm state.

What it means

Alexa.SecurityPanelController.Arm enforces Amazon's rule that a panel armed_away cannot transition directly to another armed state. If the alarm_control_panel entity's state is ARMED_AWAY and the directive requests a different arm state, AlexaSecurityPanelAuthorizationRequired (AUTHORIZATION_REQUIRED) is raised before any service call.

Source

Thrown at homeassistant/components/alexa/handlers.py:1127

    config: AbstractConfig,
    directive: AlexaDirective,
    context: ha.Context,
) -> AlexaResponse:
    """Process a Security Panel Arm request."""
    entity = directive.entity
    service = None
    arm_state = directive.payload["armState"]
    data: dict[str, Any] = {ATTR_ENTITY_ID: entity.entity_id}

    # Per Alexa Documentation: users are not allowed to switch from armed_away
    # directly to another armed state without first disarming the system.
    # https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-securitypanelcontroller.html#arming
    if (
        entity.state == alarm_control_panel.AlarmControlPanelState.ARMED_AWAY
        and arm_state != "ARMED_AWAY"
    ):
        msg = "You must disarm the system before you can set the requested arm state."
        raise AlexaSecurityPanelAuthorizationRequired(msg)

    if arm_state == "ARMED_AWAY":
        service = SERVICE_ALARM_ARM_AWAY
    elif arm_state == "ARMED_NIGHT":
        service = SERVICE_ALARM_ARM_NIGHT
    elif arm_state == "ARMED_STAY":
        service = SERVICE_ALARM_ARM_HOME
    else:
        raise AlexaInvalidDirectiveError(DIRECTIVE_NOT_SUPPORTED)

    await hass.services.async_call(
        entity.domain, service, data, blocking=False, context=context
    )

    # return 0 until alarm integration supports an exit delay
    payload: dict[str, Any] = {"exitDelayInSeconds": 0}

    response = directive.response(

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Disarm first ('Alexa, disarm'), then issue the new arm command.
  2. Update routines to chain disarm -> arm when changing arm levels.
  3. Confirm nobody should be changing the arm state and treat the error as the expected safety behavior.
Defensive patterns

Strategy: validation

Validate before calling

from homeassistant.components import alarm_control_panel as acp

if (state.state == acp.AlarmControlPanelState.ARMED_AWAY
        and requested_arm_state != 'ARMED_AWAY'):
    await hass.services.async_call(
        'alarm_control_panel', 'alarm_disarm', {'entity_id': eid, 'code': code},
        blocking=True,
    )

Type guard

def needs_disarm_first(current_state: str, requested: str) -> bool:
    return current_state == 'armed_away' and requested != 'ARMED_AWAY'

Try / catch

try:
    await process_directive(directive)
except AlexaSecurityPanelAuthorizationRequired:
    _LOGGER.info('Disarm required before switching from armed_away on %s', eid)

Prevention

When it happens

Trigger: Saying 'arm stay' or 'arm night' while the panel is currently armed_away; scripted Alexa routines that arm to a different level without a prior disarm.

Common situations: House armed in away mode, then a voice assistant or geofence routine tries to switch to home/night arming; users unaware of the disarm-first requirement.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/2be9ad4124cf1ed0. Report an issue: GitHub.