File tree Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ author : G Johansson
3+ authorURL : https://github.com/gjohansson-ST
4+ authorImageURL : https://avatars.githubusercontent.com/u/62932417?v=4
5+ authorTwitter : GJohansson
6+ title : " New vacuum state property"
7+ ---
8+
9+ As of Home Assistant Core 2025.1, the constants used to return state in ` StateVacuumEntity ` are deprecated and replaced by the ` VacuumActivity ` enum.
10+
11+ Also with this change, integrations should set the ` activity ` property instead of directly setting the ` state ` property.
12+
13+ There is a one-year deprecation period, and the constants will stop working from 2026.1 to ensure all custom integration authors have time to adjust.
14+
15+ ### Example
16+
17+ ``` python
18+
19+ from homeassistant.components.vacuum import VacuumActivity
20+
21+ class MyVacuumCleaner (StateVacuumEntity ):
22+ """ My vacuum cleaner."""
23+
24+ @ property
25+ def activity (self ) -> VacuumActivity | None :
26+ """ Return the state of the vacuum."""
27+ if self .device.is_cleaning():
28+ return VacuumActivity.CLEANING
29+ return VacuumActivity.DOCKED
30+
31+ ```
32+
33+ More details can be found in the [ vacuum documentation] ( /docs/core/entity/vacuum#states ) .
Original file line number Diff line number Diff line change @@ -22,18 +22,20 @@ Properties should always only return information from memory and not do I/O (lik
2222| fan_speed | string | ` none ` | The current fan speed.
2323| fan_speed_list | list | ` NotImplementedError() ` | List of available fan speeds.
2424| name | string | ** Required** | Name of the entity.
25- | state | string | ** Required** | One of the states listed in the states section.
25+ | activity | VacuumActivity | ** Required** | Return one of the states listed in the states section.
2626
2727## States
2828
29- | State | Description
29+ Setting the state should return an enum from VacuumActivity in the ` activity ` property.
30+
31+ | Value | Description
3032| ----- | -----------
31- | ` STATE_CLEANING ` | The vacuum is currently cleaning.
32- | ` STATE_DOCKED ` | The vacuum is currently docked, it is assumed that docked can also mean charging.
33- | ` STATE_IDLE ` | The vacuum is not paused, not docked and does not have any errors.
34- | ` STATE_PAUSED ` | The vacuum was cleaning but was paused without returning to the dock.
35- | ` STATE_RETURNING ` | The vacuum is done cleaning and is currently returning to the dock, but not yet docked.
36- | ` STATE_ERROR ` | The vacuum encountered an error while cleaning.
33+ | ` CLEANING ` | The vacuum is currently cleaning.
34+ | ` DOCKED ` | The vacuum is currently docked, it is assumed that docked can also mean charging.
35+ | ` IDLE ` | The vacuum is not paused, not docked and does not have any errors.
36+ | ` PAUSED ` | The vacuum was cleaning but was paused without returning to the dock.
37+ | ` RETURNING ` | The vacuum is done cleaning and is currently returning to the dock, but not yet docked.
38+ | ` ERROR ` | The vacuum encountered an error while cleaning.
3739
3840## Supported features
3941
You can’t perform that action at this time.
0 commit comments