husqvarna_automower_ble: Support the LawnMowerActivity.IDLE (#183142)

Signed-off-by: Alistair Francis <alistair@alistair23.me>
This commit is contained in:
Alistair Francis
2026-09-26 20:21:20 +02:00
committed by GitHub
parent 305840f592
commit cf37367d01
2 changed files with 11 additions and 5 deletions
@@ -71,8 +71,7 @@ class AutomowerLawnMower(HusqvarnaAutomowerBleEntity, LawnMowerEntity):
if state == MowerState.PAUSED:
return LawnMowerActivity.PAUSED
if state in (MowerState.STOPPED, MowerState.OFF, MowerState.WAIT_FOR_SAFETYPIN):
# This is actually stopped, but that isn't an option
return LawnMowerActivity.ERROR
return LawnMowerActivity.IDLE
if state == MowerState.PENDING_START and activity == MowerActivity.NONE:
# This happens when the mower is safety stopped and we try to send a
# command to start it.
@@ -150,18 +150,25 @@ OPERATIONAL_STATES = [
@pytest.mark.parametrize(
("mower_states", "mower_activities", "expected_state"),
[
# MowerState ERROR, FATAL_ERROR, OFF, STOPPED, WAIT_FOR_SAFETYPIN -> Mapped to
# LawnMowerActivity.ERROR
# MowerState ERROR, FATAL_ERROR -> Mapped to LawnMowerActivity.ERROR
(
[
MowerState.ERROR,
MowerState.FATAL_ERROR,
],
list(MowerActivity),
LawnMowerActivity.ERROR,
),
# MowerState OFF, STOPPED, WAIT_FOR_SAFETYPIN -> Mapped to
# LawnMowerActivity.IDLE
(
[
MowerState.OFF,
MowerState.STOPPED,
MowerState.WAIT_FOR_SAFETYPIN,
],
list(MowerActivity),
LawnMowerActivity.ERROR,
LawnMowerActivity.IDLE,
),
# MowerState PAUSED -> Mapped to LawnMowerActivity.PAUSED
([MowerState.PAUSED], list(MowerActivity), LawnMowerActivity.PAUSED),