diff --git a/README.md b/README.md index 11f35f8..4792966 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,20 @@ A custom component designed for [Home Assistant](https://www.home-assistant.io) - EHAW4010AG - EHAW6020AG +- Electrolux PUREi9 Vacuum Robot + - PUREi9 + - PUREi9.2 + +- Electrolux PUREi9 Vacuum Robot + - PUREi9 + - PUREi9.2 + +- Electrolux 600/700 Series Vacuum Robot + - Clean 600 + - Hygienic 600 + - Hygienic 700 + - Ultimate 700 + - AEG AX5 Air Purifiers - AX51-304WT @@ -41,6 +55,15 @@ A custom component designed for [Home Assistant](https://www.home-assistant.io) - AX91-604GY - AX91-604DG +- AEG RX9 Vacuum Robot + - RX9 + - RX9.2 + +- AEG 6000/7000 Series Vacuum Robot + - 6000 Robot Vacuum Cleaner + - 7000 Robot Vacuum Cleaner + + ### Install with HACS (recommended) Do you you have [HACS][hacs] installed? Just search for Electrolux Wellbeing and install it direct from HACS. HACS will keep track of updates and you can easily upgrade this integration to latest version. diff --git a/custom_components/wellbeing/api.py b/custom_components/wellbeing/api.py index 2c9f877..be2d2f5 100644 --- a/custom_components/wellbeing/api.py +++ b/custom_components/wellbeing/api.py @@ -47,6 +47,7 @@ class Model(str, Enum): AX7 = "AX7" AX9 = "AX9" PUREi9 = "PUREi9" + Robot700series = "700series" # 700series vacuum robot series class WorkMode(str, Enum): @@ -217,6 +218,35 @@ def _create_entities(data): ), ] + Robot700series_entities = [ + ApplianceVacuum( + name="Robot Status", + attr="state" + ), + ApplianceSensor( + name="Cleaning Mode", + attr="cleaningMode", + device_class=SensorDeviceClass.ENUM, + ), + ApplianceSensor( + name="Water Pump Rate", + attr="waterPumpRate", + device_class=SensorDeviceClass.ENUM, + ), + ApplianceSensor( + name="Battery Status", + attr="batteryStatus", + unit=PERCENTAGE, + device_class=SensorDeviceClass.BATTERY, + ), + ApplianceSensor( + name="Charging Status", + attr="chargingStatus", + device_class=SensorDeviceClass.ENUM, + ), + ApplianceBinary(name="Mop Installed", attr="mopInstalled"), + ] + common_entities = [ ApplianceFan( name="Fan Speed", @@ -298,6 +328,7 @@ def _create_entities(data): + a7_entities + pure500_entities + purei9_entities + + Robot700series_entities ) def get_entity(self, entity_type, entity_attr): @@ -435,13 +466,20 @@ async def async_get_appliances(self) -> Appliances: return Appliances(found_appliances) async def command_vacuum(self, pnc_id: str, cmd: str): - data = {"CleaningCommand": cmd} appliance = self._api_appliances.get(pnc_id, None) if appliance is None: _LOGGER.error( f"Failed to send vacuum command for appliance with id {pnc_id}" ) return + + data = {} + match Model(appliance.type): + case Model.Robot700series.value: + data = {"cleaningCommand": cmd} + case Model.PUREi9.value: + data = {"CleaningCommand": cmd} + result = await appliance.send_command(data) _LOGGER.debug(f"Vacuum command: {result}") @@ -449,9 +487,10 @@ async def set_vacuum_power_mode(self, pnc_id: str, mode: int): data = { "powerMode": mode } # Not the right formatting. Disable FAN_SPEEDS until this is figured out + appliance = self._api_appliances.get(pnc_id, None) if appliance is None: - _LOGGER.error(f"Failed to set feature {feature} for appliance with id {pnc_id}") + _LOGGER.error(f"Failed to set feature Power Mode to {mode} for appliance with id {pnc_id}") return result = await appliance.send_command(data) _LOGGER.debug(f"Set Vacuum Power Mode: {result}") diff --git a/custom_components/wellbeing/vacuum.py b/custom_components/wellbeing/vacuum.py index c04f1da..80da077 100644 --- a/custom_components/wellbeing/vacuum.py +++ b/custom_components/wellbeing/vacuum.py @@ -19,6 +19,7 @@ from . import WellbeingDataUpdateCoordinator from .const import DOMAIN from .entity import WellbeingEntity +from .api import Model _LOGGER: logging.Logger = logging.getLogger(__package__) @@ -45,6 +46,11 @@ 12: STATE_DOCKED, # Pitstop 13: STATE_IDLE, # Manual stearing 14: STATE_IDLE, # Firmware upgrading + "idle": STATE_IDLE, # robot700series idle + "inProgress": STATE_CLEANING, # robot700series cleaning + "goingHome": STATE_RETURNING, # robot700series returning + "paused": STATE_PAUSED, # robot700series paused + "sleeping": STATE_DOCKED, # robot700series sleeping } VACUUM_CHARGING_STATE = 9 # For selecting battery icon @@ -81,6 +87,7 @@ def __init__( ): super().__init__(coordinator, config_entry, pnc_id, entity_type, entity_attr) self._fan_speeds = self.get_appliance.vacuum_fan_speeds + self.entity_model = self.get_appliance.model @property def _battery_range(self) -> tuple[int, int]: @@ -132,16 +139,41 @@ def fan_speed_list(self): return list(self._fan_speeds.values()) async def async_start(self): - await self.api.command_vacuum(self.pnc_id, "play") + command="" + match self.entity_model: + case Model.PUREi9.value: + command="play" + case Model.Robot700series.value: + command="startGlobalClean" + _LOGGER.warning(f"VACUUM async_start {self.entity_type} {self.entity_attr} {command}") + await self.api.command_vacuum(self.pnc_id, command) async def async_stop(self): - await self.api.command_vacuum(self.pnc_id, "stop") + command="" + match self.entity_model: + case Model.PUREi9.value: + command="stop" + case Model.Robot700series.value: + command="stopClean" + await self.api.command_vacuum(self.pnc_id, command) async def async_pause(self): - await self.api.command_vacuum(self.pnc_id, "pause") + command="" + match self.entity_model: + case Model.PUREi9.value: + command="pause" + case Model.Robot700series.value: + command="pauseClean" + await self.api.command_vacuum(self.pnc_id, command) async def async_return_to_base(self): - await self.api.command_vacuum(self.pnc_id, "home") + command="" + match self.entity_model: + case Model.PUREi9.value: + command="home" + case Model.Robot700series.value: + command="startGoToCharger" + await self.api.command_vacuum(self.pnc_id, command) async def async_set_fan_speed(self, fan_speed: str): """Set the fan speed of the vacuum cleaner."""