Commit Graph

114 Commits (75fce1f03686c2c714dd409125e6a14cbc2675b2)

Author SHA1 Message Date
J. Nick Koston 522a9bb6b1
Exclude supported features and attribution from being recorded in the database (#69165) 2022-04-03 13:51:42 +02:00
Franck Nijhof 93571c2d01
Add EntityFeature enum to Camera (#69072) 2022-04-01 09:38:03 -07:00
J. Nick Koston f5a13fc51b
Add ability to exclude attributes from being recorded by entity domain (#68824) 2022-03-29 20:13:08 -07:00
J. Nick Koston 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 Schoutsen 7e4b63690d
Fix camera content type while browsing (#67256) 2022-02-26 10:02:13 +01:00
Paulus Schoutsen 0a6c8f8e6c
Improve not shown handling (#67247) 2022-02-25 11:52:14 -08:00
Paulus Schoutsen fec8c2ab82
Add support for MJPEG cameras to camera media source (#66499) 2022-02-14 17:04:19 +01:00
Paulus Schoutsen 716a1e2a64
Add camera media source (#65977) 2022-02-08 14:32:02 -08:00
Paulus Schoutsen 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
Josh Soref ab73d7c347
spelling: components/camera (#64242)
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-01-17 16:27:39 +01:00
Allen Porter 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 Porter 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
uvjustin 6e13605cad
Add get_image method to Stream (#61918)
* Add get_image method to Stream

* Add KeyFrameConverter class
2021-12-23 00:24:53 +08:00
Allen Porter 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 <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-12-19 09:09:59 -08:00
Ville Skyttä 73d192b3f3
Use HTTPStatus instead of HTTP_ consts and magic values in comp.../[bc]* (#57989) 2021-10-22 19:43:40 +02: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
Allen Porter 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 <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-10-07 22:13:14 -07:00
J. Nick Koston 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 Koston dc851b9dd5
Ensure camera scaling always produces an image of at least the requested width and height (#55033) 2021-08-24 10:44:12 +02:00
J. Nick Koston 1e14b3a0ac
Ensure camera handles non-jpeg image sources correctly (#54474) 2021-08-11 08:12:46 -07:00
J. Nick Koston e99576c094
Pass width and height when requesting camera snapshot (#53835) 2021-08-10 19:33:06 -05:00
Dermot Duffy 2e1037005c
Allow camera stream to fail safely (#50728) 2021-05-17 20:34:25 -07: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
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Ville Skyttä 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 Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Paulus Schoutsen 276f3afb00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
J. Nick Koston 3dfeec5033
Implement async_get_stream_source in the camera integration (#35704) 2020-05-25 15:41:50 -07:00
Franck Nijhof 2223592486
Add get_url helper, deprecate base_url (#35224) 2020-05-08 02:29:47 +02:00
Paulus Schoutsen 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 Schoutsen ec47216388
Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
Martin Hjelmare 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 Nijhof 123ae941a9
Various camera test improvements (#34022) 2020-04-11 21:10:15 +02:00
Ville Skyttä 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 Schoutsen 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ä e6388e186c
Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Franck Nijhof c837f185f7 Migrate camera tests from coroutine to async/await (#30372) 2020-01-01 17:21:21 -06:00
Bas Nijholt 4c5c34919d Sort imports according to PEP8 for camera (#29691) 2019-12-09 11:50:48 +01:00
Paulus Schoutsen 02d9ed5e36
Do not select all entities when omitting entity ID in service call (#29178)
* Do not select all entities when omitting entity ID

* Address comments Matthew

* Require either area_id or entity_id

* Fix tests

* Fix test
2019-12-02 16:23:12 -08:00
Pascal Vizeli c1851a2d94
Cleanup coroutine threadsafe (#27080)
* Cleanup coroutine threadsafe

* fix lint

* Fix typing

* Fix tests

* Fix black
2019-10-01 16:59:06 +02:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus Schoutsen 1de0a0bbb9
Convert stream source to method (#23905)
* Convert stream source to method

* Use async with
2019-05-23 09:45:30 -07:00
Paulus Schoutsen 6b0180f753
Fix demo (#23087)
* Fix demo

* Fix types

* Fix all the things

* Fix type

* Fix test

* Lint
2019-04-14 16:59:06 -07:00
Jason Hunter 26726af689 Stream Record Service (#22456)
* Initial commit of record service for live streams

* fix lint

* update service descriptions

* add tests

* fix lint
2019-03-27 21:47:07 -07:00
Jason Hunter bad0a8b342
Camera Preferences + Preload Stream (#22339)
* initial commit for camera preferences and preload stream

* cleanup and add tests

* respect camera preferences on each request stream call

* return the new prefs after update
2019-03-26 08:31:29 -04:00
Paulus Schoutsen 1ddc249989
Consolidate more platforms (#22308)
* Consolidate final platforms

* Fix some tests

* Fix more tests

* Fix more tests
2019-03-23 20:22:35 -07:00
Penny Wood f195ecca4b Consolidate all platforms that have tests (#22109)
* Moved climate components with tests into platform dirs.

* Updated tests from climate component.

* Moved binary_sensor components with tests into platform dirs.

* Updated tests from binary_sensor component.

* Moved calendar components with tests into platform dirs.

* Updated tests from calendar component.

* Moved camera components with tests into platform dirs.

* Updated tests from camera component.

* Moved cover components with tests into platform dirs.

* Updated tests from cover component.

* Moved device_tracker components with tests into platform dirs.

* Updated tests from device_tracker component.

* Moved fan components with tests into platform dirs.

* Updated tests from fan component.

* Moved geo_location components with tests into platform dirs.

* Updated tests from geo_location component.

* Moved image_processing components with tests into platform dirs.

* Updated tests from image_processing component.

* Moved light components with tests into platform dirs.

* Updated tests from light component.

* Moved lock components with tests into platform dirs.

* Moved media_player components with tests into platform dirs.

* Updated tests from media_player component.

* Moved scene components with tests into platform dirs.

* Moved sensor components with tests into platform dirs.

* Updated tests from sensor component.

* Moved switch components with tests into platform dirs.

* Updated tests from sensor component.

* Moved vacuum components with tests into platform dirs.

* Updated tests from vacuum component.

* Moved weather components with tests into platform dirs.

* Fixed __init__.py files

* Fixes for stuff moved as part of this branch.

* Fix stuff needed to merge with balloob's branch.

* Formatting issues.

* Missing __init__.py files.

* Fix-ups

* Fixup

* Regenerated requirements.

* Linting errors fixed.

* Fixed more broken tests.

* Missing init files.

* Fix broken tests.

* More broken tests

* There seems to be a thread race condition.
I suspect the logger stuff is running in another thread, which means waiting until the aio loop is done is missing the log messages.
Used sleep instead because that allows the logger thread to run. I think the api_streams sensor might not be thread safe.

* Disabled tests, will remove sensor in #22147

* Updated coverage and codeowners.
2019-03-18 23:07:39 -07:00
Jason Hunter 7ccd0bba9a Live Streams Component (#21473)
* initial commit of streams

* refactor stream component

* refactor so stream formats are not considered a platform

* initial test and minor refactor

* fix linting

* update requirements

* need av in tests as well

* fix import in class def vs method

* fix travis and docker builds

* address code review comments

* fix logger, add stream start/stop logs, listen to HASS stop

* address additional code review comments

* beef up tests

* fix tests

* fix lint

* add stream_source to onvif camera

* address pr comments

* add keepalive to camera play_stream service

* remove keepalive and move import

* implement registry and have output provider remove itself from stream after idle, set libav log level to error
2019-03-11 19:57:10 -07:00
Fabian Affolter 9bb7e40ee3 Upgrade aiohttp to 3.5.3 (#19957)
* Upgrade aiohttp to 3.5.3

* Upgrade aiohttp to 3.5.4

* Remove test for webhook component from camera.push

* Lint
2019-01-16 14:23:46 -08:00
emontnemery 5b53bd6aa0
Move MQTT platforms under the component (#20050)
* Move MQTT platforms under the component
2019-01-15 17:31:06 +01:00