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 | |
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 |
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 | |
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 |
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 | |
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 |
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 | |
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 |
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 | |
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 |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 |
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 | |
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 | |