mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-12 11:56:29 +00:00
Change lock state is enum (#2329)
* Change lock state is enum * Add blog * Update blog/2024-09-23-state-constants-lock-deprecation.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
ec469357db
commit
22c1aa781f
13
blog/2024-09-23-state-constants-lock-deprecation.md
Normal file
13
blog/2024-09-23-state-constants-lock-deprecation.md
Normal file
@ -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.
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user