Commit Graph
71 Commits
Author SHA1 Message Date
J. Nick KostonandGitHub 0b3627b59e Add additional cached_property to camera entities (#115075) 2024-04-13 16:50:11 -05:00
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Co-authored-by: J. Nick Koston <[email protected]>
2024-03-26 00:02:16 +01:00
Marc MuellerandGitHub 38adfbf1a3 Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
Marc MuellerandGitHub c82933175d Use builtin TimeoutError [a-d] (#109678) 2024-02-05 11:31:33 +01:00
Erik MontnemeryandGitHub c805ea7b4f Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
J. Nick KostonandGitHub 6506a8d511 Camera platform back-compat for custom components without CameraEntityFeature (#106529) 2023-12-29 00:45:35 +01:00
J. Nick KostonandGitHub abd3c54cbe Add support for attribute caching to the camera platform (#106256) 2023-12-23 13:01:47 -10:00
Robert ReschandGitHub 20ba764d92 Deprecate deprecated camera constants (#106095) 2023-12-23 10:46:23 +01:00
Jan-Philipp BeneckeandGitHub 9ab1cb83d8 Update a-c* tests to use entity & device registry fixtures (#103793)
* Update a-c* tests to use entity & device registry fixtures

* Revert some changes

* Revert formatting

* retrigger CI
2023-11-12 13:45:30 -05:00
407aa31adc Generate Stream snapshots using next keyframe (#96991)
* Add wait_for_next_keyframe option to stream images
Add STREAM_SNAPSHOT to CameraEntityFeature
Use wait_for_next_keyframe option for snapshots using stream

* Update stream test comments

* Add generic camera snapshot test

* Get stream still images directly in camera
Remove getting stream images from generic, nest, and ONVIF
Refactor camera preferences
Add use_stream_for_stills setting to camera
Update tests

* Only attempt to get stream image if integration supports stream

* Use property instead of entity registry setting

* Split out getting stream prerequisites from stream_source in nest

* Use cached_property for rtsp live stream trait

* Make rtsp live stream trait NestCamera attribute

* Update homeassistant/components/nest/camera.py

Co-authored-by: Allen Porter <[email protected]>

* Change usage of async_timeout

* Change import formatting in generic/test_camera

* Simplify Nest camera property initialization

---------

Co-authored-by: Allen Porter <[email protected]>
2023-08-26 10:39:40 -07:00
Erik MontnemeryandGitHub e3c16e634b Allow exposing entities not in the entity registry to assistants (#92363) 2023-05-02 22:08:09 +02:00
J. Nick KostonandGitHub e4744199ce Raise an exception when trying to save camera snapshots to a not allowed path (#91869) 2023-04-23 01:15:56 +02:00
epenetandGitHub fa7acb4f0d Add type hints to integration tests (part 3) (#87844) 2023-02-10 16:05:01 +01:00
uvjustinandGitHub 31ad208500 Use async with to fetch HTTP streams in tests (#82788) 2022-11-27 14:35:03 -05:00
uvjustinandGitHub ee910bd0e4 Refactor camera stream settings (#81663) 2022-11-13 01:22:59 +08:00
uvjustinandGitHub 84725f15a6 Use IntEnum for stream orientation (#81835)
* Use IntEnum for stream orientation

* Rename enum values

* Add comments

* Fix import
2022-11-09 07:28:28 -08:00
uvjustinandGitHub 852b0caf5b Add orientation transforms to stream (#77439) 2022-09-06 13:31:36 +08:00
uvjustinandGitHub 6540bed59d Defer preload stream start on startup (#75801) 2022-08-08 11:15:31 -04:00
uvjustinandGitHub d989e4373d Remove websocket_api send_big_result (#75452) 2022-07-19 21:08:11 -07:00
uvjustinandGitHub 73f2bca377 Make Stream.stop() async (#73107)
* Make Stream.start() async
* Stop streams concurrently on shutdown
Co-authored-by: Martin Hjelmare <[email protected]>
2022-06-08 00:10:53 +08:00
Franck NijhofandGitHub 93571c2d01 Add EntityFeature enum to Camera (#69072) 2022-04-01 09:38:03 -07:00
J. Nick KostonandGitHub 8e3454e46a Remove legacy compatiblity for camera platforms that do not support width/height (#68039)
- async_camera_image or camera_image must accept the width and
  height arguments
2022-03-12 20:47:14 +02:00
Paulus SchoutsenandGitHub 716a1e2a64 Add camera media source (#65977) 2022-02-08 14:32:02 -08:00
Paulus SchoutsenandGitHub 08083f399e Convert some tests to async and drop usage get_test_home_assistant (#64394)
* Fix some tests

* Update MS tests

* Convert last logbook tests to async
2022-01-18 19:37:17 -08:00
ab73d7c347 spelling: components/camera (#64242)
Co-authored-by: Josh Soref <[email protected]>
2022-01-17 16:27:39 +01:00
Allen PorterandGitHub 596edc8919 Add a stream_id parameter to the WebRTC provider (#63625)
* Add a stream_id parameter to the WebRTC provider

Add an additional stream id parameter (effectively, the camera entity id)
to allow updating an existing stream source when the strema changes. This
is useful for stream sources that have expiring URLs, like Nest.

* Redefine the provider using a type

* Use old typing methods for type definintion to pass python3.8 pylint
2022-01-10 17:56:18 -08:00
Allen PorterandGitHub 0dee4f85f0 Implement an rtsp to webrtc registry in camera (#62962)
* Implement a webrtc to rtsp support in camera as a registry

Allow integrations to register a provider that can convert an RTSP stream and WebRTC offer to a WebRTC answer. This is
planned to be used by the RTSPtoWebRTC server integration as an initial pass, but could
support other server implementations as well (or even native implementationf or that matter).

* Fix test bug to improve test covergae and restructure statements

* Add missing call to refresh webrtc providers

* Run provider refresh in parallel since it may send RPCs

* Replace for loop with any

* Fix pylint warning to use a generator
2021-12-31 13:44:33 -08:00
647febd7d8 Mark camera unavailable when keepalive stream fails (#62294)
* Mark camera unavailable when keepalive stream fails

Add a listener in stream that notifies camera when the stream state has changed, and
use that to inform the camera `available` property. Update the property to be set
only from the main loop where it is read to reduce thread safety races.

Issue #54659

* Fix pylint import related errors

* Address lint naming errors

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <[email protected]>

Co-authored-by: Paulus Schoutsen <[email protected]>
2021-12-19 09:09:59 -08:00
Ville SkyttäandGitHub 73d192b3f3 Use HTTPStatus instead of HTTP_ consts and magic values in comp.../[bc]* (#57989) 2021-10-22 19:43:40 +02:00
Allen PorterandGitHub 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
7d4dd94da8 Add WebSocket API for intiting a WebRTC stream (#57034)
* Add WebSocket API for intiting a WebRTC stream

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

* Increase test coverage for webrtc camera stream

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <[email protected]>

Co-authored-by: Paulus Schoutsen <[email protected]>
2021-10-07 22:13:14 -07:00
J. Nick KostonandGitHub fbcf21412d Only warn once per entity when the async_camera_image signature needs to be updated (#55238) 2021-08-26 09:36:25 -07:00
J. Nick KostonandGitHub 1e14b3a0ac Ensure camera handles non-jpeg image sources correctly (#54474) 2021-08-11 08:12:46 -07:00
J. Nick KostonandGitHub e99576c094 Pass width and height when requesting camera snapshot (#53835) 2021-08-10 19:33:06 -05:00
Dermot DuffyandGitHub 2e1037005c Allow camera stream to fail safely (#50728) 2021-05-17 20:34:25 -07:00
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 <[email protected]>

* 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 <[email protected]>
2021-02-08 19:53:28 -08:00
Franck NijhofandGitHub 65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Ville SkyttäandGitHub ad1a71ebc3 Don't try to create /test dir in camera tests (#39914)
ERROR:homeassistant.components.camera:
Can't write image to file: [Errno 13] Permission denied: '/test'
2020-09-14 08:40:59 +02:00
Franck NijhofandGitHub 1c2ebdf307 Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
276f3afb00 Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <[email protected]>
2020-05-31 22:18:30 -07:00
J. Nick KostonandGitHub 3dfeec5033 Implement async_get_stream_source in the camera integration (#35704) 2020-05-25 15:41:50 -07:00
Franck NijhofandGitHub 2223592486 Add get_url helper, deprecate base_url (#35224) 2020-05-08 02:29:47 +02:00
Paulus SchoutsenandGitHub 2af984917e Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Paulus SchoutsenandGitHub ec47216388 Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
Martin HjelmareandGitHub 20aa089243 Clean up camera and demo camera (#34058)
* Clean up demo camera

* Complete test_motion_detection

* Clean up image reading

* Clean up camera integration async methods

* Fix and clean camera integration tests

* Fix image processing patch
2020-04-12 14:56:19 +02:00
Franck NijhofandGitHub 123ae941a9 Various camera test improvements (#34022) 2020-04-11 21:10:15 +02:00
Ville SkyttäandGitHub 5e2ba2eb77 Enable some more bandit checks (#30857)
* Enable B108 (hardcoded tmp dir), address findings

* Enable B602 (subprocess popen with shell), address findings

* Enable B604 (start process with shell), address findings

* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
2020-01-20 18:44:55 +02:00
Paulus SchoutsenandGitHub 5fdc60e067 Add Safe Mode (#30723)
* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
2020-01-14 13:03:02 -08:00
Ville SkyttäandGitHub e6388e186c Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Franck NijhofandAndrew Sayre c837f185f7 Migrate camera tests from coroutine to async/await (#30372) 2020-01-01 17:21:21 -06:00