Add EntityFeature enum to Camera (#1266)

This commit is contained in:
Franck Nijhof 2022-04-01 18:40:08 +02:00 committed by GitHub
parent 695fa2b104
commit 280d357252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,25 +11,26 @@ A camera entity can display images, and optionally a video stream. Derive a plat
Properties should always only return information from memory and not do I/O (like network requests). Implement `update()` or `async_update()` to fetch data.
:::
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| is_recording | bool | `None` | Indication of whether the camera is recording. Used to determine `state`.
| is_streaming | bool | `None` | Indication of whether the camera is streaming. Used to determine `state`.
| motion_detection_enabled | bool | False | Indication of whether the camera has motion detection enabled.
| is_on | bool | `None` | Indication camera is on.
| brand | str | `None` | The brand (manufacturer) of the camera.
| model | str | `None` | The model of the camera.
| frame_interval | float | 0.5 | The interval between frames of the stream.
| frontend_stream_type | str | None | Used with `SUPPORT_STREAM` to tell the frontend which type of stream to use (`STREAM_TYPE_HLS` or `STREAM_TYPE_WEBRTC`)
| Name | Type | Default | Description |
| ------------------------ | ----- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| is_recording | bool | `None` | Indication of whether the camera is recording. Used to determine `state`. |
| is_streaming | bool | `None` | Indication of whether the camera is streaming. Used to determine `state`. |
| motion_detection_enabled | bool | False | Indication of whether the camera has motion detection enabled. |
| is_on | bool | `None` | Indication camera is on. |
| brand | str | `None` | The brand (manufacturer) of the camera. |
| model | str | `None` | The model of the camera. |
| frame_interval | float | 0.5 | The interval between frames of the stream. |
| frontend_stream_type | str | None | Used with `SUPPORT_STREAM` to tell the frontend which type of stream to use (`STREAM_TYPE_HLS` or `STREAM_TYPE_WEBRTC`) |
### Supported features
## Supported Features
Supported features constants are combined using the bitwise or (`|`) operator.
Supported features are defined by using values in the `CameraEntityFeature` enum
and are combined using the bitwise or (`|`) operator.
| Name | Bit value | Description |
| ---------------------------------- | --- | ------------------------------------------------------------------------------------------- |
| `SUPPORT_ON_OFF` | 1 | The device supports `turn_on` and `turn_off` |
| `SUPPORT_STREAM` | 2 | The device supports streaming |
| Value | Description |
| -------- | -------------------------------------------- |
| `ON_OFF` | The device supports `turn_on` and `turn_off` |
| `STREAM` | The device supports streaming |
## Methods
@ -95,7 +96,6 @@ class MyCamera(Camera):
An integration may provide a WebRTC stream for any RTSP camera using `async_register_rtsp_to_web_rtc_provider`. The current best practice is for an integration to provide the actual stream manipulation with an Add-on or external service.
```python
async def handle_offer(stream_source: str, offer_sdp: str) -> str:
"""Handle the signal path for a WebRTC stream and return an answer."""