Commit graph

50 commits

Author SHA1 Message Date
epenet
8b54a0679f
Enforce CameraEntityFeature (#82325) 2022-11-22 07:08:28 +01:00
epenet
ff356205bf
Use platform constants from root (#78032) 2022-09-08 12:24:45 +02:00
epenet
df5f6bdfc1
Use _attr_should_poll in camera entities (#77173) 2022-08-22 20:30:35 +02:00
Allen Porter
1c4fee65c0
Migrate nest to new entity naming style (#74724) 2022-07-09 19:21:53 +02:00
Allen Porter
cf9cab900e
Allow multiple configuration entries for nest integration (#73720)
* Add multiple config entry support for Nest

* Set a config entry unique id based on nest project id

* Add missing translations and remove untested committed

* Remove unnecessary translation

* Remove dead code

* Remove old handling to avoid duplicate error logs
2022-06-21 16:36:13 +02:00
uvjustin
01a4a83bab
Improve stream playback on high latency cameras (#72547)
* Disable LL-HLS for HLS sources
* Add extra wait for Nest cameras
2022-06-17 01:48:52 +10:00
uvjustin
73f2bca377
Make Stream.stop() async (#73107)
* Make Stream.start() async
* Stop streams concurrently on shutdown
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-06-08 00:10:53 +08:00
Allen Porter
775be354a6
Cleanup nest async methods that do not need to actually await (#72170)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-05-20 07:47:18 -07:00
Franck Nijhof
c93c7e8eff
Replace Camera STREAM_ constants with StreamType enum (#69871) 2022-04-11 16:27:27 -07:00
epenet
04dab04ee7
Use EntityFeature enums in nest (#69590) 2022-04-07 07:52:18 -07:00
Allen Porter
c6114f2631
Simplify nest placeholder image loading and share across all cameras (#66580) 2022-02-21 19:01:04 +01:00
Allen Porter
734fdf7bff
Override and disable nest stream unavailable behavior (#66571) 2022-02-15 13:43:31 -08:00
Allen Porter
572fa7d055
Update nest camera to pull still images from stream component (#66427)
* Update nest to use stream thumbnail when it exists

* Update nest camera to always pull still image from stream

Update nest camera to always pull the still iamge from the stream component,
removing the use of the separate ffmpeg call, and removing use of the nest event
image. Image for events can now be pulled using the media source APIs, rather
than relying on the camera snapshot.

* Simplify a comment

* Remove more unused variables

* Simplify comments, image, and test code

* Remove assertions for placeholder images
2022-02-14 21:45:09 -08:00
Allen Porter
b92166e04c
Defer to camera implementation for non-WebRTC cameras (#63182)
Improve nest support for default RTSP to WebRTCdefering to the camera
implementation for cameras that do not natively implement WebRTC so
they can use the registry added in #62962
2022-01-16 22:10:19 -08:00
Allen Porter
4203e1b064
Delete nest event image fetching and use same APIs as media player (#62789) 2022-01-07 16:37:54 +01:00
Allen Porter
d6c8f3965a
Improve nest camera failure handling on removal (#63207) 2022-01-05 16:17:51 +01:00
Allen Porter
cb76a30233
Add a lock on nest stream URL creation to avoid multiple in flight at once (#63212)
Add a lock to avoid multiple calls to create stream URLs when requests race in parallel
to open streams. This is to avoid # of API calls on the nest server which can be
rate limited, and to avoid any possibility of having too many streams per camera outstanding at once.
2022-01-04 12:27:56 -08:00
Allen Porter
15baea4ba3
Use more narrow exception catching in nest (#63225) 2022-01-02 18:54:56 +01:00
Allen Porter
a84b12abe7
Revert "Add an entity service for saving nest event related snapshots" (#60632) 2021-11-30 16:16:00 +01:00
Allen Porter
c4e5242b0c
Add an entity service for saving nest event related snapshots (#58369)
* Add an entity service for saving nest event related snapshots

Add an entity service `nest.snapshot_event` for recording camera event
related media to disk. This is based on `camera.snapshot` but takes in
a parameter for a Nest API event_id.

PR #58299 adds `nest_event_id` to events published by nest so that they can
be hooked up to this service for capturing events.

Future related work includes:
- Height & Width parameters for the rendered image
- Support video clips for new battery cameras
- An API for proxying media related to events, separate from the camera image thumbnail
- A Nest MediaSource for browsing media related to events

* Revert debugging information

* Add test coverage for OSError failure case

* Add service description for nest snapshot service

* Reduce unnecessary diffs.

* Sort nest camera imports

* Remove unnecessary if block in snapshot
2021-11-29 23:04:29 -08:00
Franck Nijhof
6b9c2d8295
Add shorthand attribute support to Camera platform (#59837) 2021-11-25 16:03:53 +01:00
Allen Porter
6c426fea9e
Serve nest placeholder image from disk rather than generate on the fly (#58663)
* Serve placeholder image from disk rather than generate on the flay

The placeholder image was generated from hoome assistant, saved, flipped, and
crushed a bit. The image is 640x480 and the integration does not support any on the
fly resizing.

* Cache Nest WebRTC placeholder image on camera

Cache Nest WebRTC placeholder image rather than reading from disk every time.
2021-10-30 13:44:28 -07:00
Allen Porter
9c5a79c641
Add an image placeholder for Nest WebRTC cameras (#58250) 2021-10-28 21:07:29 -07:00
Allen Porter
dafea00f41
Rename stream_type to frontend_stream_type (#57923)
Camera devices may support multiple stream sources so we want to clarify that
this is meant to decide which stream source is used in the frontend only.

Will set stream_type temporarily to allow rollout without breaking nightly,
and this will be removed after frontend is updated.
2021-10-17 20:16:29 -07:00
Marc Mueller
4f8148f9ea
Use assignment expressions 07 (#57787) 2021-10-17 20:24:34 +02:00
Allen Porter
3d33cad655
Improve nest error handling for websocket streams (#57885) 2021-10-17 19:46:18 +02:00
Allen Porter
95b07c138c
Set nest camera always on STATE_STREAMING (#57882) 2021-10-17 19:45:31 +02:00
Allen Porter
1fa6329c2e
Add Nest WebRTC and support Nest Battery Camera and Nest Battery Doorbell (#57299)
* Add WebSocket API for intiting a WebRTC stream

See https://github.com/home-assistant/architecture/discussions/640

* Add nest support for initiating webrtc streams

Add an implementation of async_handle_web_rtc_offer in nest, with test coverage.
Issue #55302

* Rename offer variable to match overriden variable name

* Remove unnecessary checks covered by websocket function

* Update homeassistant/components/camera/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-13 03:28:52 -07:00
Marc Mueller
364767ff22
Import Callable from collections.abc (4) (#56778) 2021-09-29 16:15:36 +02:00
Marc Mueller
48bada5a18
Update pylint to 2.11.1 (#56364) 2021-09-18 13:52:59 +02:00
J. Nick Koston
e99576c094
Pass width and height when requesting camera snapshot (#53835) 2021-08-10 19:33:06 -05:00
Allen Porter
68945e8814
Enable strict static type checking for nest integration (#53535) 2021-07-28 09:12:32 +02:00
Allen Porter
6376b4be5c
Increase static type coverage for nest integration (#53475)
Co-authored-by: Mick Vleeshouwer <mick@imick.nl>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-27 01:43:52 +02:00
Maciej Bieniek
e06a2a53c4
Add constructor return type in integrations L-N (#50888)
* Add constructor return type in integrations L-N

* Small fix
2021-05-20 13:06:44 +01:00
jan iversen
34b258e812
Rename HomeAssistantType —> HomeAssistant for integrations n* - p* (#49559) 2021-04-22 08:23:19 -10:00
Marc Mueller
3d2b81a401
Update typing 11 (#48072) 2021-03-18 13:21:46 +01:00
Allen Porter
bcadccf7aa
Invalidate HLS Stream on nest url refresh failure (#47869)
This will ensure that the HLS stream is re-created and fetches a new url.
2021-03-14 22:49:21 -07:00
Allen Porter
26f455223b
Update nest stream URLs expiration (#46311) 2021-02-09 23:53:34 -08:00
Allen Porter
2bcf87b980
Change the API boundary between camera and stream with initial improvement for nest expiring stream urls (#45431)
* Change the API boundary between stream and camera

Shift more of the stream lifecycle management to the camera.  The motivation is to support stream urls that expire
giving the camera the ability to change the stream once it is created.

* Document stream lifecycle and simplify stream/camera interaction

* Reorder create_stream function to reduce diffs

* Increase test coverage for camera_sdm.py

* Fix ffmpeg typo.

* Add a stream identifier for each stream, managed by camera

* Remove stream record service

* Update homeassistant/components/stream/__init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Unroll changes to Stream interface back into camera component

* Fix preload stream to actually start the background worker

* Reduce unncessary diffs for readability

* Remove redundant camera stream start code

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-08 19:53:28 -08:00
Allen Porter
eebd0d333e
Clear cached nest event images after expiration (#44956)
* Clear cached nest event images after expiration

* Don't share removal cleanup with alarm cleanup

Don't share code across these functions since it would require a dummy timestamp values that is unnecessary.

* Increase test coverage on sdm camera remove

* Update homeassistant/components/nest/camera_sdm.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-12 22:08:59 -08:00
Allen Porter
560e3811a3
Generate nest images thumbnails from events (#44638)
* Capture nest still images from events

Use python google-nest-sdm API for fetching images.  Update home assistant
to use the google-nest-sdm API for fetching the image contents generated
by the server.  This uses the existing websession object for server fetches,
reducing the amount of new code and facilites unit testing using the existing
mechanism.

Simplify tests using the image fetch API rather than a snapshot API
2021-01-06 07:02:04 -08:00
Allen Porter
51b88337ca
Simplify nest event handling (#44367)
* Simplify nest event handling

Use device specific update callbacks rather than a global callback.
The motivation is to prepare for a follow up change that will store
camera specific event tokens on the camera itself, so that a service
can later fetch event specific image snapshots, which would be difficult
to send across the event bus.

* Increase nest camera test coverage

* Remove unnecessary device updates for nest cameras

* Remove unused imports

* Fix device id check to look at returned entry

* Remove unused imports after rebase

* Partial revert of nest event simplification

* Push more update logic into the nest library

* Revert nest device_info changes

* Revert test changes to restore global update behavior

* Bump nest library version to support new callback interfaces
2020-12-27 09:49:22 +01:00
Allen Porter
6d12e764b7
Increase test coverage for nest camera (#44144) 2020-12-12 10:17:43 +01:00
Allen Porter
945a0a9f7e
Add nest device triggers for camera and doorbell events (#43548) 2020-11-30 09:19:42 +01:00
Allen Porter
2d14f07396
Improve nest SDM integration error handling (#43271) 2020-11-19 12:26:49 +01:00
Allen Porter
3e46c42307
Catch the right nest stream refresh exception error (#43189) 2020-11-13 22:37:09 -08:00
Allen Porter
94db07ca8c
Update nest sdm camera to refresh in background (#42865)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-11-10 23:48:02 +01:00
springstan
a7bd521768
Remove temporary variable from supported_features (#42685)
* Remove temporary variable from supported_features

* Revert removing temp variable for supported features hunterdouglas
2020-11-09 13:19:29 +01:00
Allen Porter
89a5c9fcac
Add image support to nest SDM api (#42556) 2020-11-03 09:31:43 +01:00
Allen Porter
8caa177ba1
Add Nest cam support for the SDM API (#42325)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-10-27 15:20:01 +01:00