diff --git a/deebot_client/capabilities.py b/deebot_client/capabilities.py index 77955a28..d916d8a3 100644 --- a/deebot_client/capabilities.py +++ b/deebot_client/capabilities.py @@ -227,7 +227,7 @@ class CapabilityBaseStation: [bool | None, auto_empty.Frequency | str | None], auto_empty.Frequency, ] - status: CapabilityEvent[BaseStationEvent] + state: CapabilityEvent[BaseStationEvent] @dataclass(frozen=True, kw_only=True) diff --git a/deebot_client/events/base_station.py b/deebot_client/events/base_station.py index 39e609e1..13c90931 100644 --- a/deebot_client/events/base_station.py +++ b/deebot_client/events/base_station.py @@ -7,11 +7,11 @@ from .base import Event as _Event -__all__ = ["BaseStationEvent", "Status"] +__all__ = ["BaseStationEvent", "State"] @unique -class Status(IntEnum): +class State(IntEnum): """Enum class for all possible base station statuses.""" IDLE = 0 @@ -22,4 +22,4 @@ class Status(IntEnum): class BaseStationEvent(_Event): """Base Station Event representation.""" - state: Status + state: State diff --git a/deebot_client/hardware/deebot/buom7k.py b/deebot_client/hardware/deebot/buom7k.py index 3b58a551..32e77b47 100644 --- a/deebot_client/hardware/deebot/buom7k.py +++ b/deebot_client/hardware/deebot/buom7k.py @@ -114,7 +114,7 @@ auto_empty.Frequency.SMART, ), ), - status=CapabilityEvent(BaseStationEvent, [GetStationState()]), + state=CapabilityEvent(BaseStationEvent, [GetStationState()]), ), battery=CapabilityEvent(BatteryEvent, [GetBattery()]), charge=CapabilityExecute(Charge), diff --git a/deebot_client/hardware/deebot/p95mgv.py b/deebot_client/hardware/deebot/p95mgv.py index b6027ae4..087fc589 100644 --- a/deebot_client/hardware/deebot/p95mgv.py +++ b/deebot_client/hardware/deebot/p95mgv.py @@ -134,7 +134,7 @@ auto_empty.Frequency.AUTO, ), ), - status=CapabilityEvent(BaseStationEvent, [GetStationState()]), + state=CapabilityEvent(BaseStationEvent, [GetStationState()]), ), battery=CapabilityEvent(BatteryEvent, [GetBattery()]), charge=CapabilityExecute(Charge), diff --git a/deebot_client/hardware/deebot/qhe2o2.py b/deebot_client/hardware/deebot/qhe2o2.py index 7c82f25e..324805c5 100644 --- a/deebot_client/hardware/deebot/qhe2o2.py +++ b/deebot_client/hardware/deebot/qhe2o2.py @@ -115,7 +115,7 @@ auto_empty.Frequency.SMART, ), ), - status=CapabilityEvent(BaseStationEvent, [GetStationState()]), + state=CapabilityEvent(BaseStationEvent, [GetStationState()]), ), charge=CapabilityExecute(Charge), clean=CapabilityClean( diff --git a/deebot_client/messages/json/station_state.py b/deebot_client/messages/json/station_state.py index 36ca1409..49fcb738 100644 --- a/deebot_client/messages/json/station_state.py +++ b/deebot_client/messages/json/station_state.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Any -from deebot_client.events.base_station import BaseStationEvent, Status +from deebot_client.events.base_station import BaseStationEvent, State from deebot_client.message import HandlingResult, MessageBodyDataDict if TYPE_CHECKING: @@ -28,14 +28,14 @@ def _handle_body_data_dict( # "body":{"data":{"content":{"error":[],"type":1,"motionState":1},"state":1},"code":0,"msg":"ok"} - Emptying if (state := data.get("state")) == 0: - reported_state = Status.IDLE + reported_state = State.IDLE elif ( state == 1 and (content := data.get("content")) and content.get("type") == 1 and content.get("motionState") == 1 ): - reported_state = Status.EMPTYING + reported_state = State.EMPTYING else: return HandlingResult.analyse() diff --git a/tests/commands/json/test_station_state.py b/tests/commands/json/test_station_state.py index aa710468..1ab4c3b3 100644 --- a/tests/commands/json/test_station_state.py +++ b/tests/commands/json/test_station_state.py @@ -5,7 +5,7 @@ import pytest from deebot_client.commands.json.station_state import GetStationState -from deebot_client.events.base_station import BaseStationEvent, Status +from deebot_client.events.base_station import BaseStationEvent, State from tests.helpers import get_request_json, get_success_body from . import assert_command @@ -14,14 +14,14 @@ @pytest.mark.parametrize( ("state", "additional_content", "expected"), [ - (0, {"type": 0}, Status.IDLE), - (1, {"type": 1, "motionState": 1}, Status.EMPTYING), + (0, {"type": 0}, State.IDLE), + (1, {"type": 1, "motionState": 1}, State.EMPTYING), ], ) async def test_GetStationState( state: int, additional_content: dict[str, Any], - expected: Status, + expected: State, ) -> None: json = get_request_json( get_success_body( diff --git a/tests/messages/json/test_station_state.py b/tests/messages/json/test_station_state.py index e862aa07..031f5dd7 100644 --- a/tests/messages/json/test_station_state.py +++ b/tests/messages/json/test_station_state.py @@ -4,7 +4,7 @@ import pytest -from deebot_client.events.base_station import BaseStationEvent, Status +from deebot_client.events.base_station import BaseStationEvent, State from deebot_client.messages.json.station_state import OnStationState from tests.messages import assert_message @@ -12,14 +12,14 @@ @pytest.mark.parametrize( ("state", "additional_content", "expected"), [ - (0, {"type": 0}, Status.IDLE), - (1, {"type": 1, "motionState": 1}, Status.EMPTYING), + (0, {"type": 0}, State.IDLE), + (1, {"type": 1, "motionState": 1}, State.EMPTYING), ], ) def test_onStationState( state: int, additional_content: dict[str, Any], - expected: Status, + expected: State, ) -> None: data: dict[str, Any] = { "header": {