mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 14:29:21 -04:00
husqvarna_automower_ble: Support the LawnMowerActivity.IDLE (#183142)
Signed-off-by: Alistair Francis <alistair@alistair23.me>
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user