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 <marhje52@gmail.com>

* Apply suggestions from code review

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
G Johansson 2024-09-24 13:00:39 +02:00 committed by GitHub
parent 0b47074ce4
commit ec469357db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View 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 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.

View File

@ -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