diff --git a/blog/2024-09-23-state-constants-lock-deprecation.md b/blog/2024-09-23-state-constants-lock-deprecation.md new file mode 100644 index 00000000..0057243d --- /dev/null +++ b/blog/2024-09-23-state-constants-lock-deprecation.md @@ -0,0 +1,13 @@ +--- +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 lock" +--- + +As of Home Assistant Core 2024.10, the constants used to return state in `LockEntity` are deprecated and replaced by the `LockState` enum. + +There is a one-year deprecation period, and the constants will stop working from 2025.10 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. diff --git a/docs/core/entity/lock.md b/docs/core/entity/lock.md index 5b0b2ef4..98d40ba2 100644 --- a/docs/core/entity/lock.md +++ b/docs/core/entity/lock.md @@ -22,6 +22,20 @@ Properties should always only return information from memory and not do I/O (lik | is_opening | bool | None | Indication of whether the lock is currently opening. Used to determine `state`. | is_open | bool | None | Indication of whether the lock is currently open. Used to determine `state`. +### States + +The state is defined by setting the above properties. The resulting state is using the `LockState` enum to return one of the below members. + +| Value | Description | +|-------------|--------------------------------------------------------------------| +| `LOCKED` | The lock is locked. | +| `LOCKING` | The lock is locking. | +| `UNLOCKING` | The lock is unlocking. | +| `UNLOCKED` | The lock is unlocked. | +| `JAMMED` | The lock is currently jammed. | +| `OPENING` | The lock is opening. | +| `OPEN` | The lock is open. | + ## Supported features Supported features are defined by using values in the `LockEntityFeature` enum