mirror of
https://github.com/home-assistant/core.git
synced 2025-09-12 00:01:43 +02:00
Fix husqvarna_automower_ble activity mapping (#151228)
This commit is contained in:
@@ -73,6 +73,10 @@ class AutomowerLawnMower(HusqvarnaAutomowerBleEntity, LawnMowerEntity):
|
||||
if state in (MowerState.STOPPED, MowerState.OFF, MowerState.WAIT_FOR_SAFETYPIN):
|
||||
# This is actually stopped, but that isn't an option
|
||||
return LawnMowerActivity.ERROR
|
||||
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.
|
||||
return LawnMowerActivity.ERROR
|
||||
if state in (
|
||||
MowerState.RESTRICTED,
|
||||
MowerState.IN_OPERATION,
|
||||
|
@@ -156,7 +156,7 @@ OPERATIONAL_STATES = [
|
||||
# Operational states are mapped according to the activity
|
||||
(
|
||||
OPERATIONAL_STATES,
|
||||
[MowerActivity.CHARGING, MowerActivity.NONE, MowerActivity.PARKED],
|
||||
[MowerActivity.CHARGING, MowerActivity.PARKED],
|
||||
LawnMowerActivity.DOCKED,
|
||||
),
|
||||
(
|
||||
@@ -174,6 +174,17 @@ OPERATIONAL_STATES = [
|
||||
[MowerActivity.STOPPED_IN_GARDEN],
|
||||
LawnMowerActivity.ERROR,
|
||||
),
|
||||
# Special case for MowerActivity.NONE
|
||||
(
|
||||
[MowerState.IN_OPERATION, MowerState.RESTRICTED],
|
||||
[MowerActivity.NONE],
|
||||
LawnMowerActivity.DOCKED,
|
||||
),
|
||||
(
|
||||
[MowerState.PENDING_START],
|
||||
[MowerActivity.NONE],
|
||||
LawnMowerActivity.ERROR,
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_mower_activity_mapping(
|
||||
|
Reference in New Issue
Block a user