Whytey / moebot-hass-integration

A HomeAssistant integration for MoeBot (and compatible) TUYA mowers.
9 stars 0 forks source link

From 'mowing' to 'dock' does not update lawn_mower state #24

Closed clau-bucur closed 1 month ago

clau-bucur commented 1 month ago

Installed 0.30-beta1 and ran a test. Started mowing and after 5 minutes selected Return to dock. The robot paused then it started returning to dock, as expected (nice job!). The only problem I found was that the lawn_mower entity remained in mowing state, but the old vacuum state shows the correct state. Screenshot_20240707_165850_Home Assistant.jpg

Whytey commented 1 month ago

Hi @clau-bucur ,

Thanks for the feedback. That is actually expected behaviour; the Lawn Mower entitiy only supports four states:

class LawnMowerActivity(StrEnum):
    """Activity state of lawn mower devices."""

    ERROR = "error"
    """Device is in error state, needs assistance."""

    PAUSED = "paused"
    """Paused during activity."""

    MOWING = "mowing"
    """Device is mowing."""

    DOCKED = "docked"
    """Device is docked."""

The way we map MoeBot states to HA states is as follows:

_STATUS_TO_HA = {
    "STANDBY": LawnMowerActivity.DOCKED,
    "MOWING": LawnMowerActivity.MOWING,
    "CHARGING": LawnMowerActivity.DOCKED,
    "EMERGENCY": LawnMowerActivity.ERROR,
    "LOCKED": LawnMowerActivity.ERROR,
    "PAUSED": LawnMowerActivity.PAUSED,
    "PARK": LawnMowerActivity.MOWING,
    "CHARGING_WITH_TASK_SUSPEND": LawnMowerActivity.DOCKED,
    "FIXED_MOWING": LawnMowerActivity.MOWING,
    "ERROR": LawnMowerActivity.ERROR,
}

Closing as not a bug.