home-assistant/core · warning · HomeAssistantError

incorrect_door_state

incorrect_door_state

Error message

incorrect_door_state

What it means

Raised by the bosch_alarm door switch entity's async_turn_on: before sending the open command it checks self._door.is_cycling(), and while the door is mid open/close cycle the panel cannot accept new commands, so it raises HomeAssistantError with translation_key 'incorrect_door_state'. This is a local state guard, not an API failure.

Source

Thrown at homeassistant/components/bosch_alarm/switch.py:118

    ) -> None:
        """Set up a switch entity for a door on a bosch alarm panel."""
        super().__init__(hass, panel, door_id, unique_id, config_entry_id)
        self.entity_description = entity_description
        self._attr_unique_id = f"{self._door_unique_id}_{entity_description.key}"

    @property
    @override
    def is_on(self) -> bool:
        """Return the value function."""
        return self.entity_description.value_fn(self._door)

    @override
    async def async_turn_on(self, **kwargs: Any) -> None:
        """Run the on function."""
        # If the door is currently cycling, we can't send it
        # any other commands until it is done
        if self._door.is_cycling():
            raise HomeAssistantError(
                translation_domain=DOMAIN, translation_key="incorrect_door_state"
            )
        await self.entity_description.on_fn(self.panel, self._door_id)

    @override
    async def async_turn_off(self, **kwargs: Any) -> None:
        """Run the off function."""
        # If the door is currently cycling, we can't send it
        # any other commands until it is done
        if self._door.is_cycling():
            raise HomeAssistantError(
                translation_domain=DOMAIN, translation_key="incorrect_door_state"
            )
        await self.entity_description.off_fn(self.panel, self._door_id)


class PanelOutputEntity(BoschAlarmOutputEntity, SwitchEntity):
    """An output entity for a bosch alarm panel."""

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Wait for the door cycle to finish (poll is_cycling / door state) before issuing the next command.
  2. Debounce the automation — guard with a condition on the switch/door state.
  3. If the door physically stopped but state says cycling, reload the integration to resync door state from the panel.

Example fix

# before
await hass.services.async_call("switch", "turn_on", {"entity_id": "switch.door"})
# after
if not switch._door.is_cycling():
    await hass.services.async_call("switch", "turn_on", {"entity_id": "switch.door"})
Defensive patterns

Strategy: validation

Validate before calling

if switch._door.is_cycling():
    raise ServiceValidationError("door_is_moving")  # wait instead of commanding

Type guard

def door_ready_for_command(switch_entity) -> bool:
    """True when the door is not mid open/close cycle."""
    door = getattr(switch_entity, "_door", None)
    return bool(door) and not door.is_cycling()

Try / catch

try:
    await switch.async_turn_on()
except HomeAssistantError as err:
    if err.translation_key == "incorrect_door_state":
        await asyncio.sleep(DOOR_TRAVEL_SECONDS)  # then retry once

Prevention

When it happens

Trigger: Calling switch.turn_on (e.g. door open action) on a Bosch door while it is still travelling from a previous open/close command; rapid double commands in automations; door state not yet reported as settled by the panel.

Common situations: Automation firing twice on one event, garage-door style timing where users press again before travel completes, race between command and panel status update.

Related errors


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