From f0e1f0683586822bb459301556af7349d9037795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Klein?= Date: Sat, 16 Mar 2024 20:23:03 +0100 Subject: [PATCH] migrate to new vacuum commands --- .../gardena_smart_system/vacuum.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/custom_components/gardena_smart_system/vacuum.py b/custom_components/gardena_smart_system/vacuum.py index 4c662a7..4692214 100644 --- a/custom_components/gardena_smart_system/vacuum.py +++ b/custom_components/gardena_smart_system/vacuum.py @@ -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 ( @@ -38,7 +34,6 @@ DOMAIN, GARDENA_LOCATION, ) -from .sensor import GardenaSensor _LOGGER = logging.getLogger(__name__) @@ -46,7 +41,13 @@ 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 ) @@ -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",