Skip to content

Vacuum

vacuum

vacuum domain implementation.

SPEC module-attribute

SPEC: DomainSpec[Vacuum] = register_domain(DomainSpec(name='vacuum', entity_cls=Vacuum))

The DomainSpec registered with the shared DomainRegistry.

Vacuum

Bases: Entity

A Home Assistant vacuum entity.

Provides intent-specific actions (start, pause, stop, return_to_base, locate, set_fan_speed, send_command, clean_spot) and structured state introspection (is_cleaning, is_docked, is_idle, is_paused, is_returning, is_error, battery_level, fan_speed, fan_speed_list) rather than exposing raw service calls.

Methods that depend on optional vacuum capabilities degrade safely: if the underlying hardware does not advertise the relevant VacuumEntityFeature bit in supported_features, the call becomes a no-op that logs a debug message instead of raising. This keeps user code portable across heterogeneous fleets. Callers that need to know whether an action will actually be dispatched can pre-check with the supports_* properties.

Source code in src/haclient/domains/vacuum.py
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
class Vacuum(Entity):
    """A Home Assistant vacuum entity.

    Provides intent-specific actions (``start``, ``pause``, ``stop``,
    ``return_to_base``, ``locate``, ``set_fan_speed``, ``send_command``,
    ``clean_spot``) and structured state introspection (``is_cleaning``,
    ``is_docked``, ``is_idle``, ``is_paused``, ``is_returning``,
    ``is_error``, ``battery_level``, ``fan_speed``, ``fan_speed_list``)
    rather than exposing raw service calls.

    Methods that depend on optional vacuum capabilities degrade safely:
    if the underlying hardware does not advertise the relevant
    ``VacuumEntityFeature`` bit in ``supported_features``, the call
    becomes a no-op that logs a debug message instead of raising. This
    keeps user code portable across heterogeneous fleets. Callers that
    need to know whether an action will actually be dispatched can
    pre-check with the ``supports_*`` properties.
    """

    domain = "vacuum"

    # -- Listener decorators ------------------------------------------

    def on_start(self, func: ValueChangeHandler) -> ValueChangeHandler:
        """Register a listener for when the vacuum starts cleaning.

        Parameters
        ----------
        func : callable
            Sync or async callable invoked with ``(old_state, new_state)``
            on every transition into the ``cleaning`` state.

        Returns
        -------
        callable
            The same *func*, returned for decorator use.
        """
        return self._register_state_transition_listener(_STATE_CLEANING, func)

    def on_dock(self, func: ValueChangeHandler) -> ValueChangeHandler:
        """Register a listener for when the vacuum returns to the dock.

        Parameters
        ----------
        func : callable
            Sync or async callable invoked with ``(old_state, new_state)``
            on every transition into the ``docked`` state.

        Returns
        -------
        callable
            The same *func*, returned for decorator use.
        """
        return self._register_state_transition_listener(_STATE_DOCKED, func)

    def on_error(self, func: ValueChangeHandler) -> ValueChangeHandler:
        """Register a listener for when the vacuum enters the error state.

        Parameters
        ----------
        func : callable
            Sync or async callable invoked with ``(old_state, new_state)``
            on every transition into the ``error`` state.

        Returns
        -------
        callable
            The same *func*, returned for decorator use.
        """
        return self._register_state_transition_listener(_STATE_ERROR, func)

    def on_battery_change(self, func: ValueChangeHandler) -> ValueChangeHandler:
        """Register a listener for battery level changes.

        Parameters
        ----------
        func : callable
            Callable invoked with ``(old_value, new_value)`` whenever
            the ``battery_level`` attribute (0-100) changes.

        Returns
        -------
        callable
            The same *func*, returned for decorator use.
        """
        return self._register_attr_listener("battery_level", func)

    def on_fan_speed_change(self, func: ValueChangeHandler) -> ValueChangeHandler:
        """Register a listener for fan-speed changes.

        Parameters
        ----------
        func : callable
            Callable invoked with ``(old_value, new_value)`` whenever
            the ``fan_speed`` attribute changes.

        Returns
        -------
        callable
            The same *func*, returned for decorator use.
        """
        return self._register_attr_listener("fan_speed", func)

    # -- State properties ---------------------------------------------

    @property
    def is_cleaning(self) -> bool:
        """Whether the vacuum is currently cleaning."""
        return self.state == _STATE_CLEANING

    @property
    def is_docked(self) -> bool:
        """Whether the vacuum is currently docked."""
        return self.state == _STATE_DOCKED

    @property
    def is_idle(self) -> bool:
        """Whether the vacuum is currently idle."""
        return self.state == _STATE_IDLE

    @property
    def is_paused(self) -> bool:
        """Whether the vacuum is currently paused."""
        return self.state == _STATE_PAUSED

    @property
    def is_returning(self) -> bool:
        """Whether the vacuum is currently returning to the dock."""
        return self.state == _STATE_RETURNING

    @property
    def is_error(self) -> bool:
        """Whether the vacuum is currently in an error state."""
        return self.state == _STATE_ERROR

    @property
    def battery_level(self) -> int | None:
        """Battery charge percentage (0--100) or ``None`` if unsupported."""
        value = self.attributes.get("battery_level")
        return int(value) if isinstance(value, (int, float)) else None

    @property
    def fan_speed(self) -> str | None:
        """Current fan speed label, or ``None`` if unsupported."""
        value = self.attributes.get("fan_speed")
        return str(value) if isinstance(value, str) else None

    @property
    def fan_speed_list(self) -> list[str]:
        """Available fan-speed labels, or an empty list if unsupported."""
        value = self.attributes.get("fan_speed_list")
        if not isinstance(value, list):
            return []
        return [str(item) for item in value if isinstance(item, str)]

    def _has_feature(self, mask: int) -> bool:
        """Return ``True`` when ``supported_features`` advertises *mask*.

        Parameters
        ----------
        mask : int
            ``VacuumEntityFeature`` bit to test for.

        Returns
        -------
        bool
            ``True`` if the entity advertises *mask* in its
            ``supported_features`` bitmask, otherwise ``False``.
        """
        features = self.attributes.get("supported_features")
        if not isinstance(features, int):
            return False
        return bool(features & mask)

    @property
    def supports_start(self) -> bool:
        """Whether the vacuum advertises ``START`` support."""
        return self._has_feature(_FEATURE_START)

    @property
    def supports_pause(self) -> bool:
        """Whether the vacuum advertises ``PAUSE`` support."""
        return self._has_feature(_FEATURE_PAUSE)

    @property
    def supports_stop(self) -> bool:
        """Whether the vacuum advertises ``STOP`` support."""
        return self._has_feature(_FEATURE_STOP)

    @property
    def supports_return_home(self) -> bool:
        """Whether the vacuum advertises ``RETURN_HOME`` support."""
        return self._has_feature(_FEATURE_RETURN_HOME)

    @property
    def supports_locate(self) -> bool:
        """Whether the vacuum advertises ``LOCATE`` support."""
        return self._has_feature(_FEATURE_LOCATE)

    @property
    def supports_fan_speed(self) -> bool:
        """Whether the vacuum advertises ``FAN_SPEED`` support."""
        return self._has_feature(_FEATURE_FAN_SPEED)

    @property
    def supports_send_command(self) -> bool:
        """Whether the vacuum advertises ``SEND_COMMAND`` support."""
        return self._has_feature(_FEATURE_SEND_COMMAND)

    @property
    def supports_clean_spot(self) -> bool:
        """Whether the vacuum advertises ``CLEAN_SPOT`` support."""
        return self._has_feature(_FEATURE_CLEAN_SPOT)

    # -- Actions ------------------------------------------------------

    async def start(self) -> None:
        """Start (or resume) cleaning.

        Degrades safely: if the vacuum does not advertise the ``START``
        feature, this method logs a debug message and returns without
        raising. Callers can pre-check with `supports_start`.
        """
        if not self.supports_start:
            _LOGGER.debug(
                "start() unsupported for %s; skipping (no VacuumEntityFeature.START)",
                self.entity_id,
            )
            return
        await self._call_service("start")

    async def pause(self) -> None:
        """Pause the current cleaning cycle.

        Degrades safely: if the vacuum does not advertise the ``PAUSE``
        feature, this method logs a debug message and returns without
        raising. Callers can pre-check with `supports_pause`.
        """
        if not self.supports_pause:
            _LOGGER.debug(
                "pause() unsupported for %s; skipping (no VacuumEntityFeature.PAUSE)",
                self.entity_id,
            )
            return
        await self._call_service("pause")

    async def stop(self) -> None:
        """Stop the current cleaning cycle.

        Degrades safely: if the vacuum does not advertise the ``STOP``
        feature, this method logs a debug message and returns without
        raising. Callers can pre-check with `supports_stop`.
        """
        if not self.supports_stop:
            _LOGGER.debug(
                "stop() unsupported for %s; skipping (no VacuumEntityFeature.STOP)",
                self.entity_id,
            )
            return
        await self._call_service("stop")

    async def return_to_base(self) -> None:
        """Send the vacuum back to its dock.

        Degrades safely: if the vacuum does not advertise the
        ``RETURN_HOME`` feature, this method logs a debug message and
        returns without raising. Callers can pre-check with
        `supports_return_home`.
        """
        if not self.supports_return_home:
            _LOGGER.debug(
                "return_to_base() unsupported for %s; skipping "
                "(no VacuumEntityFeature.RETURN_HOME)",
                self.entity_id,
            )
            return
        await self._call_service("return_to_base")

    async def locate(self) -> None:
        """Make the vacuum emit a locator sound, if supported.

        Degrades safely: if the vacuum does not advertise the ``LOCATE``
        feature, this method logs a debug message and returns without
        raising. Callers can pre-check with `supports_locate`.
        """
        if not self.supports_locate:
            _LOGGER.debug(
                "locate() unsupported for %s; skipping (no VacuumEntityFeature.LOCATE)",
                self.entity_id,
            )
            return
        await self._call_service("locate")

    async def clean_spot(self) -> None:
        """Perform a spot-cleaning cycle, if supported.

        Degrades safely: if the vacuum does not advertise the
        ``CLEAN_SPOT`` feature, this method logs a debug message and
        returns without raising. Callers can pre-check with
        `supports_clean_spot`.
        """
        if not self.supports_clean_spot:
            _LOGGER.debug(
                "clean_spot() unsupported for %s; skipping (no VacuumEntityFeature.CLEAN_SPOT)",
                self.entity_id,
            )
            return
        await self._call_service("clean_spot")

    async def set_fan_speed(self, speed: str) -> None:
        """Set the vacuum's fan speed, if supported.

        Parameters
        ----------
        speed : str
            Fan-speed label. Should be one of the values reported in
            the entity's ``fan_speed_list`` attribute.

        Notes
        -----
        Degrades safely: if the vacuum does not advertise the
        ``FAN_SPEED`` feature, this method logs a debug message and
        returns without raising. Callers can pre-check with
        `supports_fan_speed`.
        """
        if not self.supports_fan_speed:
            _LOGGER.debug(
                "set_fan_speed() unsupported for %s; skipping (no VacuumEntityFeature.FAN_SPEED)",
                self.entity_id,
            )
            return
        await self._call_service("set_fan_speed", {"fan_speed": str(speed)})

    async def send_command(
        self,
        command: str,
        params: dict[str, Any] | None = None,
    ) -> None:
        """Send a vendor-specific command to the vacuum, if supported.

        Parameters
        ----------
        command : str
            Vendor-specific command name to send.
        params : dict or None, optional
            Optional parameters dictionary forwarded verbatim to Home
            Assistant alongside the command.

        Notes
        -----
        Degrades safely: if the vacuum does not advertise the
        ``SEND_COMMAND`` feature, this method logs a debug message and
        returns without raising. Callers can pre-check with
        `supports_send_command`.
        """
        if not self.supports_send_command:
            _LOGGER.debug(
                "send_command() unsupported for %s; skipping (no VacuumEntityFeature.SEND_COMMAND)",
                self.entity_id,
            )
            return
        data: dict[str, Any] = {"command": str(command)}
        if params is not None:
            data["params"] = dict(params)
        await self._call_service("send_command", data)

is_cleaning property

is_cleaning: bool

Whether the vacuum is currently cleaning.

is_docked property

is_docked: bool

Whether the vacuum is currently docked.

is_idle property

is_idle: bool

Whether the vacuum is currently idle.

is_paused property

is_paused: bool

Whether the vacuum is currently paused.

is_returning property

is_returning: bool

Whether the vacuum is currently returning to the dock.

is_error property

is_error: bool

Whether the vacuum is currently in an error state.

battery_level property

battery_level: int | None

Battery charge percentage (0--100) or None if unsupported.

fan_speed property

fan_speed: str | None

Current fan speed label, or None if unsupported.

fan_speed_list property

fan_speed_list: list[str]

Available fan-speed labels, or an empty list if unsupported.

supports_start property

supports_start: bool

Whether the vacuum advertises START support.

supports_pause property

supports_pause: bool

Whether the vacuum advertises PAUSE support.

supports_stop property

supports_stop: bool

Whether the vacuum advertises STOP support.

supports_return_home property

supports_return_home: bool

Whether the vacuum advertises RETURN_HOME support.

supports_locate property

supports_locate: bool

Whether the vacuum advertises LOCATE support.

supports_fan_speed property

supports_fan_speed: bool

Whether the vacuum advertises FAN_SPEED support.

supports_send_command property

supports_send_command: bool

Whether the vacuum advertises SEND_COMMAND support.

supports_clean_spot property

supports_clean_spot: bool

Whether the vacuum advertises CLEAN_SPOT support.

on_start

on_start(func: ValueChangeHandler) -> ValueChangeHandler

Register a listener for when the vacuum starts cleaning.

Parameters:

Name Type Description Default
func callable

Sync or async callable invoked with (old_state, new_state) on every transition into the cleaning state.

required

Returns:

Type Description
callable

The same func, returned for decorator use.

Source code in src/haclient/domains/vacuum.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
def on_start(self, func: ValueChangeHandler) -> ValueChangeHandler:
    """Register a listener for when the vacuum starts cleaning.

    Parameters
    ----------
    func : callable
        Sync or async callable invoked with ``(old_state, new_state)``
        on every transition into the ``cleaning`` state.

    Returns
    -------
    callable
        The same *func*, returned for decorator use.
    """
    return self._register_state_transition_listener(_STATE_CLEANING, func)

on_dock

on_dock(func: ValueChangeHandler) -> ValueChangeHandler

Register a listener for when the vacuum returns to the dock.

Parameters:

Name Type Description Default
func callable

Sync or async callable invoked with (old_state, new_state) on every transition into the docked state.

required

Returns:

Type Description
callable

The same func, returned for decorator use.

Source code in src/haclient/domains/vacuum.py
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def on_dock(self, func: ValueChangeHandler) -> ValueChangeHandler:
    """Register a listener for when the vacuum returns to the dock.

    Parameters
    ----------
    func : callable
        Sync or async callable invoked with ``(old_state, new_state)``
        on every transition into the ``docked`` state.

    Returns
    -------
    callable
        The same *func*, returned for decorator use.
    """
    return self._register_state_transition_listener(_STATE_DOCKED, func)

on_error

on_error(func: ValueChangeHandler) -> ValueChangeHandler

Register a listener for when the vacuum enters the error state.

Parameters:

Name Type Description Default
func callable

Sync or async callable invoked with (old_state, new_state) on every transition into the error state.

required

Returns:

Type Description
callable

The same func, returned for decorator use.

Source code in src/haclient/domains/vacuum.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
def on_error(self, func: ValueChangeHandler) -> ValueChangeHandler:
    """Register a listener for when the vacuum enters the error state.

    Parameters
    ----------
    func : callable
        Sync or async callable invoked with ``(old_state, new_state)``
        on every transition into the ``error`` state.

    Returns
    -------
    callable
        The same *func*, returned for decorator use.
    """
    return self._register_state_transition_listener(_STATE_ERROR, func)

on_battery_change

on_battery_change(func: ValueChangeHandler) -> ValueChangeHandler

Register a listener for battery level changes.

Parameters:

Name Type Description Default
func callable

Callable invoked with (old_value, new_value) whenever the battery_level attribute (0-100) changes.

required

Returns:

Type Description
callable

The same func, returned for decorator use.

Source code in src/haclient/domains/vacuum.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
def on_battery_change(self, func: ValueChangeHandler) -> ValueChangeHandler:
    """Register a listener for battery level changes.

    Parameters
    ----------
    func : callable
        Callable invoked with ``(old_value, new_value)`` whenever
        the ``battery_level`` attribute (0-100) changes.

    Returns
    -------
    callable
        The same *func*, returned for decorator use.
    """
    return self._register_attr_listener("battery_level", func)

on_fan_speed_change

on_fan_speed_change(func: ValueChangeHandler) -> ValueChangeHandler

Register a listener for fan-speed changes.

Parameters:

Name Type Description Default
func callable

Callable invoked with (old_value, new_value) whenever the fan_speed attribute changes.

required

Returns:

Type Description
callable

The same func, returned for decorator use.

Source code in src/haclient/domains/vacuum.py
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
def on_fan_speed_change(self, func: ValueChangeHandler) -> ValueChangeHandler:
    """Register a listener for fan-speed changes.

    Parameters
    ----------
    func : callable
        Callable invoked with ``(old_value, new_value)`` whenever
        the ``fan_speed`` attribute changes.

    Returns
    -------
    callable
        The same *func*, returned for decorator use.
    """
    return self._register_attr_listener("fan_speed", func)

start async

start() -> None

Start (or resume) cleaning.

Degrades safely: if the vacuum does not advertise the START feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_start.

Source code in src/haclient/domains/vacuum.py
255
256
257
258
259
260
261
262
263
264
265
266
267
268
async def start(self) -> None:
    """Start (or resume) cleaning.

    Degrades safely: if the vacuum does not advertise the ``START``
    feature, this method logs a debug message and returns without
    raising. Callers can pre-check with `supports_start`.
    """
    if not self.supports_start:
        _LOGGER.debug(
            "start() unsupported for %s; skipping (no VacuumEntityFeature.START)",
            self.entity_id,
        )
        return
    await self._call_service("start")

pause async

pause() -> None

Pause the current cleaning cycle.

Degrades safely: if the vacuum does not advertise the PAUSE feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_pause.

Source code in src/haclient/domains/vacuum.py
270
271
272
273
274
275
276
277
278
279
280
281
282
283
async def pause(self) -> None:
    """Pause the current cleaning cycle.

    Degrades safely: if the vacuum does not advertise the ``PAUSE``
    feature, this method logs a debug message and returns without
    raising. Callers can pre-check with `supports_pause`.
    """
    if not self.supports_pause:
        _LOGGER.debug(
            "pause() unsupported for %s; skipping (no VacuumEntityFeature.PAUSE)",
            self.entity_id,
        )
        return
    await self._call_service("pause")

stop async

stop() -> None

Stop the current cleaning cycle.

Degrades safely: if the vacuum does not advertise the STOP feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_stop.

Source code in src/haclient/domains/vacuum.py
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def stop(self) -> None:
    """Stop the current cleaning cycle.

    Degrades safely: if the vacuum does not advertise the ``STOP``
    feature, this method logs a debug message and returns without
    raising. Callers can pre-check with `supports_stop`.
    """
    if not self.supports_stop:
        _LOGGER.debug(
            "stop() unsupported for %s; skipping (no VacuumEntityFeature.STOP)",
            self.entity_id,
        )
        return
    await self._call_service("stop")

return_to_base async

return_to_base() -> None

Send the vacuum back to its dock.

Degrades safely: if the vacuum does not advertise the RETURN_HOME feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_return_home.

Source code in src/haclient/domains/vacuum.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
async def return_to_base(self) -> None:
    """Send the vacuum back to its dock.

    Degrades safely: if the vacuum does not advertise the
    ``RETURN_HOME`` feature, this method logs a debug message and
    returns without raising. Callers can pre-check with
    `supports_return_home`.
    """
    if not self.supports_return_home:
        _LOGGER.debug(
            "return_to_base() unsupported for %s; skipping "
            "(no VacuumEntityFeature.RETURN_HOME)",
            self.entity_id,
        )
        return
    await self._call_service("return_to_base")

locate async

locate() -> None

Make the vacuum emit a locator sound, if supported.

Degrades safely: if the vacuum does not advertise the LOCATE feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_locate.

Source code in src/haclient/domains/vacuum.py
317
318
319
320
321
322
323
324
325
326
327
328
329
330
async def locate(self) -> None:
    """Make the vacuum emit a locator sound, if supported.

    Degrades safely: if the vacuum does not advertise the ``LOCATE``
    feature, this method logs a debug message and returns without
    raising. Callers can pre-check with `supports_locate`.
    """
    if not self.supports_locate:
        _LOGGER.debug(
            "locate() unsupported for %s; skipping (no VacuumEntityFeature.LOCATE)",
            self.entity_id,
        )
        return
    await self._call_service("locate")

clean_spot async

clean_spot() -> None

Perform a spot-cleaning cycle, if supported.

Degrades safely: if the vacuum does not advertise the CLEAN_SPOT feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_clean_spot.

Source code in src/haclient/domains/vacuum.py
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
async def clean_spot(self) -> None:
    """Perform a spot-cleaning cycle, if supported.

    Degrades safely: if the vacuum does not advertise the
    ``CLEAN_SPOT`` feature, this method logs a debug message and
    returns without raising. Callers can pre-check with
    `supports_clean_spot`.
    """
    if not self.supports_clean_spot:
        _LOGGER.debug(
            "clean_spot() unsupported for %s; skipping (no VacuumEntityFeature.CLEAN_SPOT)",
            self.entity_id,
        )
        return
    await self._call_service("clean_spot")

set_fan_speed async

set_fan_speed(speed: str) -> None

Set the vacuum's fan speed, if supported.

Parameters:

Name Type Description Default
speed str

Fan-speed label. Should be one of the values reported in the entity's fan_speed_list attribute.

required
Notes

Degrades safely: if the vacuum does not advertise the FAN_SPEED feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_fan_speed.

Source code in src/haclient/domains/vacuum.py
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
async def set_fan_speed(self, speed: str) -> None:
    """Set the vacuum's fan speed, if supported.

    Parameters
    ----------
    speed : str
        Fan-speed label. Should be one of the values reported in
        the entity's ``fan_speed_list`` attribute.

    Notes
    -----
    Degrades safely: if the vacuum does not advertise the
    ``FAN_SPEED`` feature, this method logs a debug message and
    returns without raising. Callers can pre-check with
    `supports_fan_speed`.
    """
    if not self.supports_fan_speed:
        _LOGGER.debug(
            "set_fan_speed() unsupported for %s; skipping (no VacuumEntityFeature.FAN_SPEED)",
            self.entity_id,
        )
        return
    await self._call_service("set_fan_speed", {"fan_speed": str(speed)})

send_command async

send_command(command: str, params: dict[str, Any] | None = None) -> None

Send a vendor-specific command to the vacuum, if supported.

Parameters:

Name Type Description Default
command str

Vendor-specific command name to send.

required
params dict or None

Optional parameters dictionary forwarded verbatim to Home Assistant alongside the command.

None
Notes

Degrades safely: if the vacuum does not advertise the SEND_COMMAND feature, this method logs a debug message and returns without raising. Callers can pre-check with supports_send_command.

Source code in src/haclient/domains/vacuum.py
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
async def send_command(
    self,
    command: str,
    params: dict[str, Any] | None = None,
) -> None:
    """Send a vendor-specific command to the vacuum, if supported.

    Parameters
    ----------
    command : str
        Vendor-specific command name to send.
    params : dict or None, optional
        Optional parameters dictionary forwarded verbatim to Home
        Assistant alongside the command.

    Notes
    -----
    Degrades safely: if the vacuum does not advertise the
    ``SEND_COMMAND`` feature, this method logs a debug message and
    returns without raising. Callers can pre-check with
    `supports_send_command`.
    """
    if not self.supports_send_command:
        _LOGGER.debug(
            "send_command() unsupported for %s; skipping (no VacuumEntityFeature.SEND_COMMAND)",
            self.entity_id,
        )
        return
    data: dict[str, Any] = {"command": str(command)}
    if params is not None:
        data["params"] = dict(params)
    await self._call_service("send_command", data)