mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-19 07:16:29 +00:00
Change cover state to enum (#2348)
* Change cover state to enum * Update date * Add link * states link
This commit is contained in:
parent
3188f4996a
commit
a4bde2c9d1
15
blog/2024-10-08-state-constants-cover-deprecation.md
Normal file
15
blog/2024-10-08-state-constants-cover-deprecation.md
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
author: G Johansson
|
||||
authorURL: https://github.com/gjohansson-ST
|
||||
authorImageURL: https://avatars.githubusercontent.com/u/62932417?v=4
|
||||
authorTwitter: GJohansson
|
||||
title: "Deprecating state constants for cover"
|
||||
---
|
||||
|
||||
As of Home Assistant Core 2024.11, the constants used to return state in `CoverEntity` are deprecated and replaced by the `CoverState` enum.
|
||||
|
||||
There is a one-year deprecation period, and the constants will stop working from 2025.11 to ensure all custom integration authors have time to adjust.
|
||||
|
||||
As the `state` property is not meant to be overwritten, in most cases this change will only affect other Entity properties or tests rather than the `state` property.
|
||||
|
||||
More details can be found in the [cover documentation](/docs/core/entity/cover#states).
|
@ -19,6 +19,17 @@ Properties should always only return information from memory and not do I/O (lik
|
||||
| is_closing | <code>bool | None</code> | `None` | If the cover is closing or not. Used to determine `state`.
|
||||
| is_opening | <code>bool | None</code> | `None` | If the cover is opening or not. Used to determine `state`.
|
||||
|
||||
### States
|
||||
|
||||
The state is defined by setting the above properties. The resulting state is using the `CoverState` enum to return one of the below members.
|
||||
|
||||
| Value | Description |
|
||||
|-------------|--------------------------------------------------------------------|
|
||||
| `CLOSED` | The cover is closed. |
|
||||
| `CLOSING` | The cover is closing. |
|
||||
| `OPENING` | The cover is opening. |
|
||||
| `OPEN` | The cover is open. |
|
||||
|
||||
### Device classes
|
||||
|
||||
| Constant | Description
|
||||
@ -34,15 +45,6 @@ Properties should always only return information from memory and not do I/O (lik
|
||||
| `CoverDeviceClass.SHUTTER` | Control of shutters, which are linked slats that swing out/in to cover an opening or may be tilted to partially cover an opening, such as indoor or exterior window shutters.
|
||||
| `CoverDeviceClass.WINDOW` | Control of a physical window that opens and closes or may tilt.
|
||||
|
||||
### States
|
||||
|
||||
| Constant | Description
|
||||
|----------|------------------------|
|
||||
| `STATE_OPENING` | The cover is in the process of opening to reach a set position.
|
||||
| `STATE_OPEN` | The cover has reached the open position.
|
||||
| `STATE_CLOSING` | The cover is in the process of closing to reach a set position.
|
||||
| `STATE_CLOSED` | The cover has reach the closed position.
|
||||
|
||||
## Supported features
|
||||
|
||||
Supported features are defined by using values in the `CoverEntityFeature` enum
|
||||
|
Loading…
x
Reference in New Issue
Block a user