Skip to content

Commit

Permalink
migrate to new vacuum commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémie Klein committed Mar 16, 2024
1 parent 2598fb2 commit f0e1f06
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions custom_components/gardena_smart_system/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
import logging
from datetime import datetime, timedelta

from homeassistant.core import callback
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
STATE_IDLE,
)
from homeassistant.components.vacuum import (
StateVacuumEntity,
SUPPORT_BATTERY,
SUPPORT_RETURN_HOME,
SUPPORT_STATE,
SUPPORT_STOP,
SUPPORT_START,
STATE_PAUSED,
STATE_CLEANING,
STATE_DOCKED,
STATE_RETURNING,
STATE_ERROR,
STATE_IDLE,
ATTR_BATTERY_LEVEL,
VacuumEntityFeature,
)

from .const import (
Expand All @@ -38,15 +34,20 @@
DOMAIN,
GARDENA_LOCATION,
)
from .sensor import GardenaSensor


_LOGGER = logging.getLogger(__name__)

SCAN_INTERVAL = timedelta(minutes=1)

SUPPORT_GARDENA = (
SUPPORT_BATTERY | SUPPORT_RETURN_HOME | SUPPORT_STOP | SUPPORT_START | SUPPORT_STATE
VacuumEntityFeature.BATTERY |
VacuumEntityFeature.PAUSE |
VacuumEntityFeature.RETURN_HOME |
VacuumEntityFeature.SEND_COMMAND |
VacuumEntityFeature.START |
VacuumEntityFeature.STATE |
VacuumEntityFeature.STOP
)


Expand Down Expand Up @@ -106,7 +107,7 @@ async def async_update(self):
activity = self._device.activity
_LOGGER.debug("Mower has activity %s", activity)
if activity == "PAUSED":
self._state = STATE_PAUSED
self._state = PAUSE
elif activity in [
"OK_CUTTING",
"OK_CUTTING_TIMER_OVERRIDDEN",
Expand Down

0 comments on commit f0e1f06

Please sign in to comment.