Skip to content

Commit 0647d18

Browse files
authored
Merge pull request #68 from KiraPC/issue-66
use new vacuum constants
2 parents 17e9856 + 24a9772 commit 0647d18

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

custom_components/switchbotremote/vacuum.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
from typing import List
22
from homeassistant.components.vacuum import (
33
StateVacuumEntity,
4-
VacuumEntityFeature, # v2022.5
5-
STATE_DOCKED,
6-
STATE_CLEANING,
7-
STATE_IDLE,
8-
STATE_IDLE,
9-
STATE_RETURNING
4+
VacuumEntityFeature
105
)
6+
from homeassistant.components.vacuum.const import VacuumActivity
117
from homeassistant.helpers.restore_state import RestoreEntity
128
from homeassistant.core import HomeAssistant
139
from homeassistant.helpers.entity import DeviceInfo
@@ -26,7 +22,7 @@ def __init__(self, hass: HomeAssistant, sb: SupportedRemote, options: dict = {})
2622
self._hass = hass
2723
self._unique_id = sb.id
2824
self._device_name = sb.name
29-
self._state = STATE_IDLE
25+
self._state = VacuumActivity.IDLE
3026

3127
self._supported_features = VacuumEntityFeature.STATE | VacuumEntityFeature.START | VacuumEntityFeature.STOP | VacuumEntityFeature.RETURN_HOME
3228

@@ -73,7 +69,7 @@ async def async_added_to_hass(self):
7369
async def async_start(self):
7470
"""Send the power on command."""
7571
await self.send_command("turnOn")
76-
self._state = STATE_CLEANING
72+
self._state = VacuumActivity.CLEANING
7773

7874
async def async_stop(self):
7975
"""Send the power off command."""

0 commit comments

Comments
 (0)