Commit graph

60 commits

Author SHA1 Message Date
uvjustin
ee910bd0e4
Refactor camera stream settings (#81663) 2022-11-13 01:22:59 +08:00
uvjustin
82af726e21
Fix onvif snapshot fallback (#79394)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-10-01 18:28:15 +02:00
epenet
7871a517a8
Import constants from root (#78271) 2022-09-12 18:53:05 +02:00
epenet
36f3028ec3
Improve type hint in onvif (#77833) 2022-09-06 10:12:16 +02:00
uvjustin
891158f332
Use stream to generate fallback image for onvif (#75584) 2022-08-09 10:41:19 -04:00
epenet
debd475a6d
Remove onvif from mypy ignore list (#75162) 2022-07-14 11:55:43 +02:00
uvjustin
79fb5e1bec
Add use wallclock as timestamps option to onvif (#71983) 2022-05-23 13:54:49 +08:00
uvjustin
221b77297e
Declare exports from stream explicitly (#71898) 2022-05-15 17:58:57 +02:00
uvjustin
617b0d04dc
Decouple stream options from PyAV options (#71247)
Co-authored-by: Allen Porter <allen.porter@gmail.com>
2022-05-14 23:31:18 -07:00
Jason Hunter
0d9191c344
Add new ONVIF sensors (#70394)
* add digital input and relay sensors / clean up default sensor names

* add relay

* fix copy/paste errors
2022-04-25 17:49:00 -04:00
epenet
cac8d71764
Use EntityFeature enum in components (o**) (#69433) 2022-04-07 15:15:05 +02:00
epenet
cbd3cd4599
Add camera setup type hints (#63277)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 13:22:41 +01:00
Allen Porter
14e4216e29
Put access to ffmpeg hass.data behind a method (#62570)
* Put access to ffmpeg hass.data behind a method

Move all callers of `hass.data[DATA_FFMPEG]` to a new function that returns the FFMpegManager.

* Update homeassistant/components/ffmpeg/__init__.py

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

* Remove unnecessary async_ prefix

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-12-21 23:40:43 -08:00
J. Nick Koston
4d40d95848
Add support for width and height to ffmpeg based camera snapshots (#53837) 2021-08-10 20:31:11 -05:00
J. Nick Koston
e99576c094
Pass width and height when requesting camera snapshot (#53835) 2021-08-10 19:33:06 -05:00
Franck Nijhof
2ed386f9e6
Migrate to async_get_current_platform everywhere (#50034) 2021-05-03 09:34:28 -07:00
Xuefer
7579a321df
Encode ONVIF username password in URL (#49512)
* onvif: encode username password in url

Signed-off-by: Xuefer <xuefer@gmail.com>

* onvif: use yarl to set username password for steam url

Signed-off-by: Xuefer <xuefer@gmail.com>
2021-04-23 10:43:02 +02:00
Paulus Schoutsen
0cf3736162
Bump ha-ffmpeg to 3.0.2 (#43597) 2020-11-25 08:45:15 +01:00
Ville Skyttä
cab186d28f
Add ONVIF PTZ Stop support (#39734) 2020-11-20 22:59:11 +01:00
Jason Hunter
5a397312e7
Update ONVIF to Zeep 4.0/httpx (#42020)
* convert to httpx and zeep 4.0

* fix tests

* add onvif-zeep-async to manifest

* pin zeep to fool CI cache

* address review comments
2020-10-18 23:29:53 -04:00
On Freund
a87fedc0af
Automatically configure HTTP auth type in ONVIF snapshots (#38729)
* Allow selection of HTTP auth type in ONVIF snapshots

* Auto populate snapshot auth

* Fix no auth case

* Add missing return
2020-09-03 22:41:24 +02:00
Jason Hunter
bd8848e57a
Fix ONVIF config entry unique ID (#36008)
* fallback to device serial number if no mac available

* make password optional to fix #35904

* update tests to reflect new flow

* fix snake case and AsyncMock

* add comments around why weird things are being done
2020-05-24 21:50:50 +02:00
Jason Hunter
a82900ae27
fix mjpeg issue along with some cameras not returning event capabilities properly (#35885) 2020-05-20 21:26:27 -04:00
Jason Hunter
19734e7b2c
Refactor ONVIF (#35222) 2020-05-06 09:29:59 -07:00
Jason Hunter
850b5cb02b
Config flow for ONVIF (#34520) 2020-04-30 23:15:40 -07:00
Geronimo2015
d416029e82
Add onvif PTZ GotoPreset (#34420)
* Added PTZ GotoPreset support

* Update camera.py

Processed flake8 error

* Update services.yaml

Removed trailing spaces

* Update camera.py

black formatted code
2020-04-24 17:28:44 +02:00
Minims
7b9585cd8e
Fix Onvif Camera that does not have SnapshotUri such as Sricam (#33902) 2020-04-10 08:44:56 -07:00
Paulus Schoutsen
32499dc8fe
Fix onvif consistent return (#33898) 2020-04-09 09:51:23 -07:00
Paulus Schoutsen
1adb45f74e
Check status code on onvif snapshot (#33865) 2020-04-09 09:54:02 +02:00
springstan
eae21be5b9
Improve string formatting v6 (#33698) 2020-04-07 23:14:28 +02:00
Franck Nijhof
1fa996ed68
Fix ONVIF camera snapshot with auth (#33241) 2020-03-25 13:32:28 +01:00
roleo
aec2fe86e4
Add onvif snapshot uri (#33149)
* Add onvif snapshot uri

If the cam supports http snapshot uri, use it instead of ffmpeg.

* Code formatting

* Fix to pass pre-commit
2020-03-24 09:57:14 -07:00
Franck Nijhof
5893f6b14b
Fix Extend ONVIF unique ID with profile index (#33103) 2020-03-21 11:36:35 -07:00
Aidan Timson
628f77f8f2
Fix onvif error with non ptz cameras (#32783) 2020-03-13 23:58:14 +01:00
Rami Mosleh
e1cc2acdf9
Specify rtsp_transport for Onvif Camera (#31918)
* specify rtsp_transport for onvif camera

* remove used variable

* Update homeassistant/components/stream/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* change options to stream_options

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-06 09:59:57 -08:00
olijouve
0d667c1bd9
Add more onvif PTZ move modes (#30152)
* Adding support for PTZ move modes

Adding support for other PTZ move modes.
Onvif intergration used to only support RelativeMove where it should also supports AbsoluteMove, ContinuousMove and Stop.
For exemple Goke GK7102 based IP camera only support ContinuousMove mode.

This commit add those new modes with avaibility to select mode and params in service call.

* Adding support for PTZ move modes

Adding support for other PTZ move modes.
Onvif intergration used to only support RelativeMove where it should also supports AbsoluteMove, ContinuousMove and Stop.
For exemple Goke GK7102 based IP camera only support ContinuousMove mode.

Update service helper for new avaibility to select mode and params in service call.

* RelativeMode as default move_mode to avoid breakchange

RelativeMode as default move_mode to avoid breakchange

* add missing attribute

add missing continuous_duration attribute

* change service attribute label for continuous_duration

* update description

fix wrong assertion for move_mode attr description

* Update services.yaml

* Update services.yaml

fix wrong wording for move_mode

* Update camera.py

Using defined constants instead of  raw strings in conditions

* Update camera.py

Replace integer to floating point in logger debug PTZ values

* Update services.yaml

* Update services.yaml

* Update camera.py

* Update camera.py

* use dict[key] for required schema keys and keys with default schema values

* remove async for setup_ptz method

* lint error

* remove unecessary PTZ_NONE = "NONE"

changed request by @MartinHjelmare

* addressing @ MartinHjelmare comments

- Remove None in defaluts and dicts
- Replace long if blocks

* remove NONE

* lint issue

* Update camera.py

* Fix lint error - typo

* rename onvif_ptz service to just ptz

* rename onvif_ptz service to just ptz

* use dict[key] when default values are set

use service.data[key] instead of service.data.get[key] when default value is set in service schema

* adresse comment: use dict[key] for pan tilt zoom

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-06 15:14:01 +01:00
Franck Nijhof
2390a7f365
Pass in aiohttp session for onvif (#32045) 2020-02-28 11:46:06 +01:00
Franck Nijhof
edfb967b10
Add unique ID to ONVIF camera entities (#32093) 2020-02-22 22:29:49 +01:00
springstan
1ee7c483a7
Update file headers and outdated documentation links (#32022)
* Update documentation links

* Update file headers v2
2020-02-20 15:29:46 -08:00
olijouve
87de5db535 Fix Onvif setup error: premature end of connection on GetStreamURI (#26781)
* Fix Onvif setup error with a premature end of connection on GetStreamUri wsdl call

Reconnect to onvif camera after getting profiles to fix this error :

[homeassistant.components.onvif.camera] Retrieving stream uri                                                                                                                                 
[zeep.asyncio.transport] HTTP Post to http://192.168.1.15/onvif/Media:                                                                                                                        
b'<?xml version=\'1.0\' encoding=\'utf-8\'?>\n<soap-env:Envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope"><soap-env:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecur
2019-09-20 01:08:51 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform onvif                                                                                                                       
Traceback (most recent call last):                                                                                                                                                                                                   
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 553, in write_bytes                                                                                                                                   
    await self.body.write(writer)                                                                                                                                                                                                    
  File "/usr/local/lib/python3.7/site-packages/aiohttp/payload.py", line 231, in write                                                                                                                                               
    await writer.write(self._value)                                                                                                                                                                                                  
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 101, in write                                                                                                                                           
    self._write(chunk)                                                                                                                                                                                                               
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 67, in _write                                                                                                                                           
    raise ConnectionResetError('Cannot write to closing transport')                                                                                                                                                                  
ConnectionResetError: Cannot write to closing transport                                                                                                                                                                              
                                                                                                                                                                                                                                     
The above exception was the direct cause of the following exception:                                                                                                                                                                 
                                                                                                                                                                                                                                     
Traceback (most recent call last):                                                                                                                                                                                                   
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform                                                                                                                         
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)                                                                                                                                                                
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for                                                                                                                                                            
    return fut.result()                                                                                                                                                                                                              
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 110, in async_setup_platform                                                                                                                          
    await hass_camera.async_initialize()                                                                                                                                                                                             
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 168, in async_initialize                                                                                                                              
    await self.async_obtain_input_uri()                                                                                                                                                                                              
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 266, in async_obtain_input_uri                                                                                                                        
    stream_uri = await media_service.GetStreamUri(req)                                                                                                                                                                               
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/bindings.py", line 13, in send                                                                                                                                           
    options["address"], envelope, http_headers                                                                                                                                                                                       
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py", line 107, in post_xml                                                                                                                                     
    response = await self.post(address, message, headers)                                                                                                                                                                            
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py", line 95, in post                                                                                                                                          
    proxy=self.proxy,                                                                                                                                                                                                                
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 497, in _request                                                                                                                                             
    await resp.start(conn)                                                                                                                                                                                                           
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 844, in start                                                                                                                                         
    message, payload = await self._protocol.read()  # type: ignore  # noqa                                                                                                                                                           
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 588, in read                                                                                                                                                
    await self._waiter                                                                                                                                                                                                               
aiohttp.client_exceptions.ClientOSError: [Errno None] Can not write request body for http://192.168.1.15/onvif/Media

* Add code comment

* Update camera.py

* Lint.
2019-11-25 17:56:17 -08:00
Diefferson Koderer Môro
c96d4c978d Fix tzinfo type for onvif component (#28178) 2019-10-24 13:39:10 -07:00
Diefferson Koderer Môro
dd9ca70e96 Add onvif local datetime support (#26656)
* Update camera.py

* Add onvif local datetime support

* Correct capture TimeZone

* Replace one line if-statement by if-block
2019-10-23 21:03:24 -07:00
Diefferson Koderer Môro
9db07b2a41 Move imports in onvif component (#27969) 2019-10-20 20:46:51 +02:00
Sergio Conde Gómez
6cc71db385 Fix onvif PTZ service freeze (#27250) 2019-10-06 17:00:44 +02:00
Balazs Sandor
5e6840d8f4 fix onvif/camera setting up error (#26825) 2019-09-23 13:41:35 -04:00
definitio
9cd5c5471d Hide "PTZ is not available on this camera" warning (#26649)
* Hide "PTZ is not available" warning

* Change log level to "debug"
2019-09-18 09:00:12 -07:00
Franck Nijhof
1c5e0123c9 Use literal string interpolation in integrations N-Q (f-strings) (#26391) 2019-09-03 11:35:00 -07:00
Balazs Sandor
baa30aec9d Fix onvif camera setup error (#24585)
* fix: onvif setup error

* refactor: onvif camera init process

* onvif/camera: review fixes

* onvif/camera: review fixes

* onvif/camera: fix pydoc

* onvif: remove unrelated async-await

* Onvif review fix

* onvif/camera: remove log
2019-08-31 22:29:42 +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