From ec469357db7b469945d3b79698c5a9cbf4e4687a Mon Sep 17 00:00:00 2001 From: G Johansson Date: Tue, 24 Sep 2024 13:00:39 +0200 Subject: [PATCH] Change camera state to enum (#2330) * Change camera state is enum * Not lock * Adjustments * Add blog * Apply suggestions from code review Co-authored-by: Martin Hjelmare * Apply suggestions from code review --------- Co-authored-by: Martin Hjelmare --- ...2024-09-23-state-constants-camera-deprecation.md | 13 +++++++++++++ docs/core/entity/camera.md | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 blog/2024-09-23-state-constants-camera-deprecation.md diff --git a/blog/2024-09-23-state-constants-camera-deprecation.md b/blog/2024-09-23-state-constants-camera-deprecation.md new file mode 100644 index 00000000..3dd15a32 --- /dev/null +++ b/blog/2024-09-23-state-constants-camera-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 camera" +--- + +As of Home Assistant Core 2024.10, the constants used to return state in `Camera` are deprecated and replaced by the `CameraState` 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. diff --git a/docs/core/entity/camera.md b/docs/core/entity/camera.md index 5efaf0cc..f6481f93 100644 --- a/docs/core/entity/camera.md +++ b/docs/core/entity/camera.md @@ -23,6 +23,17 @@ Properties should always only return information from memory and not do I/O (lik | motion_detection_enabled | `bool` | `False` | Indication of whether the camera has motion detection enabled. | | use_stream_for_stills | `bool` | `False` | Determines whether or not to use the `Stream` integration to generate still images | +### States + +The state is defined by setting the properties above. The resulting state uses the `CameraState` enum to return one of the below members. + +| Value | Description | +|-------------|-----------------------------------------| +| `RECORDING` | The camera is currently recording. | +| `STREAMING` | The camera is currently streaming. | +| `IDLE` | The camera is currently idle. | + + ## Supported features Supported features are defined by using values in the `CameraEntityFeature` enum