home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.05k stars 29.72k forks source link

Ezviz integration: Missing all the services #32981

Closed gigios closed 3 years ago

gigios commented 4 years ago

The problem

I'm testing the ezviz integration with my camera. After some initial configuration problems, now I'm able to see the live, by using the template shown in the documentation, with all the buttons to manage my camera.

The problem is that each services defined in the 'template' are missing in my installation. I have checked also in the Developer Tools\Services but the "camera.ezviz*' services are not available in the list.

Environment

Mimiix commented 4 years ago

I have the same thing. I was about to post a issue too.

When i try to use the Card provided in the docs , i get this errors:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 492, in get return await self.handle(request, camera) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 527, in handle return await camera.handle_async_mjpeg_stream(request) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 390, in handle_async_mjpeg_stream return await self.handle_async_still_stream(request, self.frame_interval) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 381, in handle_async_still_stream request, self.async_camera_image, self.content_type, interval File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 196, in async_get_still_stream img_bytes = await image_cb() File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 219, in async_camera_image ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop) AttributeError: 'NoneType' object has no attribute 'binary'

And:

Error requesting stream: camera.kamer_dennis does not support play stream service

probot-home-assistant[bot] commented 4 years ago

Hey there @baqs, mind taking a look at this issue as its been labeled with a integration (ezviz) you are listed as a codeowner for? Thanks!

Teocell commented 4 years ago

I have the same thing. I was about to post a issue too.

When i try to use the Card provided in the docs , i get this errors:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 492, in get return await self.handle(request, camera) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 527, in handle return await camera.handle_async_mjpeg_stream(request) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 390, in handle_async_mjpeg_stream return await self.handle_async_still_stream(request, self.frame_interval) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 381, in handle_async_still_stream request, self.async_camera_image, self.content_type, interval File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 196, in async_get_still_stream img_bytes = await image_cb() File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 219, in async_camera_image ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop) AttributeError: 'NoneType' object has no attribute 'binary'

And:

Error requesting stream: camera.kamer_dennis does not support play stream service

I have the same problem

bf69 commented 4 years ago

no entity is created and I have no ezviz service.

Dettagli registro (ERROR) Logger: homeassistant.components.camera Source: components/ezviz/camera.py:50 Integration: Telecamera (documentation, issues) First occurred: 15:26:29 (1 occurrences) Last logged: 15:26:29

Error while setting up ezviz platform for camera Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for return fut.result() File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/ezviz/camera.py", line 50, in setup_platform cameras = ezviz_client.load_cameras() File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/client.py", line 197, in load_cameras cameras.append(camera.status()) File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/camera.py", line 97, in status 'follow_move': self._switch[TYPE_FOLLOW_MOVE]['enable'], KeyError: 25

BaQs commented 4 years ago

I have the same thing. I was about to post a issue too.

When i try to use the Card provided in the docs , i get this errors:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 492, in get return await self.handle(request, camera) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 527, in handle return await camera.handle_async_mjpeg_stream(request) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 390, in handle_async_mjpeg_stream return await self.handle_async_still_stream(request, self.frame_interval) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 381, in handle_async_still_stream request, self.async_camera_image, self.content_type, interval File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 196, in async_get_still_stream img_bytes = await image_cb() File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 219, in async_camera_image ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop) AttributeError: 'NoneType' object has no attribute 'binary'

And:

Error requesting stream: camera.kamer_dennis does not support play stream service

Hi, this should be fixed in the next release, the card needs a stream which was not included in the first version: https://github.com/home-assistant/core/pull/32451

BaQs commented 4 years ago

no entity is created and I have no ezviz service.

Dettagli registro (ERROR) Logger: homeassistant.components.camera Source: components/ezviz/camera.py:50 Integration: Telecamera (documentation, issues) First occurred: 15:26:29 (1 occurrences) Last logged: 15:26:29

Error while setting up ezviz platform for camera Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for return fut.result() File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/ezviz/camera.py", line 50, in setup_platform cameras = ezviz_client.load_cameras() File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/client.py", line 197, in load_cameras cameras.append(camera.status()) File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/camera.py", line 97, in status 'follow_move': self._switch[TYPE_FOLLOW_MOVE]['enable'], KeyError: 25

hi, what kind of camera are you using ? can you confirm you are using the same credentials in the plugin as the ones you are using in the mobile app ?

bf69 commented 4 years ago

nessuna entità viene creata e non ho un servizio ezviz. Dettagli registro (ERRORE) Logger: homeassistant.components.camera Fonte: components / ezviz / camera.py: 50 Integrazione: Telecamera (documentazione, problemi) Prima occorrenza: 15:26:29 (1 occorrenze) Ultima registrazione: 15:26: 29 Errore durante l'impostazione della piattaforma ezviz per la telecamera Traceback (ultima chiamata più recente): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", linea 179, in _async_setup_platform attende attesa asyncio. wait_for (asyncio.shield (task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.7/asyncio/tasks.py", riga 416, in wait_for return fut.result () File "/usr/lib/python3.7 /concurrent/futures/thread.py ", riga 57, nel risultato della corsa = self.fn (* self.args, ** self.kwargs) File" /srv/homeassistant/lib/python3.7/site-packages/homeassistant /components/ezviz/camera.py ", riga 50, in setup_platform cameras = ezviz_client.load_cameras () File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/client.py", riga 197, nel file load_cameras cameras.append (camera.status ()) "/ srv / homeassistant / lib / python3. 7 / site-pacchetti / pyezviz / camera.py ", riga 97, nello stato 'follow_move': self._switch [TYPE_FOLLOW_MOVE] ['enable'], KeyError: 25

ciao, che tipo di fotocamera stai usando? puoi confermare che stai usando le stesse credenziali nel plugin di quelle che stai usando nell'app mobile?

yes, I use the same credentials.

BaQs commented 4 years ago

could you please share :

Can you confirm the camera's local IP is accessible from home-assistant ?

bf69 commented 4 years ago

could you please share :

  • your config (obfuscating password of course)
  • the model(s) of cameras you have

my configuration:

from the EZVIZ app I get as serial: 803448342. always from the app in live LAN view I get: CS-CV206-B0-31WFR-Wind0020170729CCRR803448342. If I don't enter data after cameras: no errors are detected, but obviously I don't see cameras. the IP address of the cam can be reached from the raspberry, also with the ffmpeg service the cam works, but without motion detection. My model of cam is: CS-CV206-B0-31WFR-Wind thank you

BaQs commented 4 years ago

ok thanks for the details. I don't have this kind of camera, so if you can help me debug all of that, it could be great.

Do you know how to install a "custom component" ? I could give you some peace of code with a view to debugging the situation. It could be really helpfull for others also.

Wanna try ?

Rikkie80 commented 4 years ago

could you please share :

  • your config (obfuscating password of course)
  • the model(s) of cameras you have

my configuration:

  • platform: ezviz username: xxxx@xxx.it #my email password: yyyyyy #my pwd cameras: 803448342: # CS-CV206-B0-31WFR-Wind0020170729CCRR803448342: #DEVICE SERIAL username: admin password: xxxxx

from the EZVIZ app I get as serial: 803448342. always from the app in live LAN view I get: CS-CV206-B0-31WFR-Wind0020170729CCRR803448342. If I don't enter data after cameras: no errors are detected, but obviously I don't see cameras. the IP address of the cam can be reached from the raspberry, also with the ffmpeg service the cam works, but without motion detection. My model of cam is: CS-CV206-B0-31WFR-Wind thank you

I used my real username and not my email address. This worked for me...

BaQs commented 4 years ago

@Rikkie80 : which model of camera(s) do you have ?

I personnaly use my email address and it works

BaQs commented 4 years ago

To confirm the connection: are you able to connect here: https://euauth.ezvizlife.com/signIn ?

Rikkie80 commented 4 years ago

Yes, I am

2 cameras:

BaQs commented 4 years ago

ok, that's the auth mechanism used by the pypi package. If your email works there, it should work also when used in the HASS' configuration

bf69 commented 4 years ago

Sì, lo sono

2 telecamere:

  • 178211475 (CS-CV310-A0-1E2WFR, Husky Air)
  • C35158510 (CS-CV248-A0-32WFR, C6T)

how is your configuration?

bf69 commented 4 years ago

ok grazie per i dettagli. Non ho questo tipo di fotocamera, quindi se puoi aiutarmi a eseguire il debug di tutto ciò, potrebbe essere fantastico.

Sai come installare un "componente personalizzato"? Potrei darti un po 'di tranquillità al fine di eseguire il debug della situazione. Potrebbe essere davvero utile anche per gli altri.

Voler provare ?

I'm new to the environment, if you explain me I'll try ..

Teocell commented 4 years ago

I have the same thing. I was about to post a issue too. When i try to use the Card provided in the docs , i get this errors: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 492, in get return await self.handle(request, camera) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 527, in handle return await camera.handle_async_mjpeg_stream(request) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 390, in handle_async_mjpeg_stream return await self.handle_async_still_stream(request, self.frame_interval) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 381, in handle_async_still_stream request, self.async_camera_image, self.content_type, interval File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 196, in async_get_still_stream img_bytes = await image_cb() File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 219, in async_camera_image ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop) AttributeError: 'NoneType' object has no attribute 'binary' And: Error requesting stream: camera.kamer_dennis does not support play stream service

Hi, this should be fixed in the next release, the card needs a stream which was not included in the first version:

32451

I tried to create a custom component with latest camera.py file (updated around 1h ago). I still have the same problem.

Here you can find the status of my camera:

access_token: #deleted
model_name: CTQ6C
brand: Ezviz
privacy: false
audio: true
ir_led: true
state_led: false
follow_move: false
alarm_notify: false
alarm_sound_mod: Software
encrypted: true
local_ip: 192.168.1.42
detection_sensibility: 3
friendly_name: Salotto
entity_picture: /api/camera_proxy/camera.salotto?token= #deleted
supported_features: 2 

Here you can find the configuration:

camera:
  - platform: ezviz
    username: !secret username_ezviz #myemail but I tried also the username
    password: !secret password_ezviz
    cameras:
      D24447632:
        username: user_camera_salone #admin
        password: pass_camera_salone 

And here the log:

Logger: aiohttp.server
Source: custom_components/ezviz/camera.py:369
First occurred: 10:07:08 PM (3 occurrences)
Last logged: 10:08:08 PM

Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/camera/__init__.py", line 492, in get
    return await self.handle(request, camera)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/camera/__init__.py", line 527, in handle
    return await camera.handle_async_mjpeg_stream(request)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/camera/__init__.py", line 390, in handle_async_mjpeg_stream
    return await self.handle_async_still_stream(request, self.frame_interval)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/camera/__init__.py", line 381, in handle_async_still_stream
    request, self.async_camera_image, self.content_type, interval
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/camera/__init__.py", line 196, in async_get_still_stream
    img_bytes = await image_cb()
  File "/home/homeassistant/.homeassistant/custom_components/ezviz/camera.py", line 369, in async_camera_image
    ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop)
AttributeError: 'NoneType' object has no attribute 'binary'
BaQs commented 4 years ago

did you enable ffmpeg ?

In your configuration.yaml: ffmpeg: Also, can you enable debug:

logger:
  default: info
  logs:
    homeassistant.components.ezviz.camera: debug

You should then see in the debug lines, if the plugin catches properly the stream URL. If that's the case, it is something related to ffmpeg, and not the way the integration finds the Ezviz cameras

BaQs commented 4 years ago

ok grazie per i dettagli. Non ho questo tipo di fotocamera, quindi se puoi aiutarmi a eseguire il debug di tutto ciò, potrebbe essere fantastico. Sai come installare un "componente personalizzato"? Potrei darti un po 'di tranquillità al fine di eseguire il debug della situazione. Potrebbe essere davvero utile anche per gli altri. Voler provare ?

I'm new to the environment, if you explain me I'll try ..

So, you need to create the folder:

custom_components

in your config folder. Then, inside, copy the ezviz folder from here: https://github.com/BaQs/home-assistant/tree/ezviz_ptz/homeassistant/components/ezviz

(you can for instance copy/paste each file from the "raw" version.)

Don't forget to enable debug logs & ffmpeg in your configuration.yaml (see the post above).

Also, reboot home-assistant, and check the logs.

Teocell commented 4 years ago

did you enable ffmpeg ?

In your configuration.yaml: ffmpeg: Also, can you enable debug:

logger:
  default: info
  logs:
    homeassistant.components.ezviz.camera: debug

You should then see in the debug lines, if the plugin catches properly the stream URL. If that's the case, it is something related to ffmpeg, and not the way the integration finds the Ezviz cameras

This is the last error I got:

Logger: homeassistant.components.camera
Source: components/camera/__init__.py:599
Integration: Camera (documentation, issues)
First occurred: 11:06:02 PM (4 occurrences)
Last logged: 11:22:38 PM

Error requesting stream: camera.salotto does not support play stream service
BaQs commented 4 years ago

@Teocell : can you access the camera's stream by accessing it at rtsp://admin:xxx@192.168.1.42:554 ?

What about debug logs ?

Teocell commented 4 years ago

@Teocell : can you access the camera's stream by accessing it at rtsp://admin:xxx@192.168.1.42:554 ?

What about debug logs ?

yes I can, it is streaming live

BaQs commented 4 years ago

@Teocell : can you access the camera's stream by accessing it at rtsp://admin:xxx@192.168.1.42:554 ?

What about debug logs ?

yes I can, it is streaming live

Ok, cool. Can you share the debug logs please ?

Teocell commented 4 years ago

How may I share it?

Thanks, Marco

Il giorno dom 22 mar 2020 alle 08:12 Pierre notifications@github.com ha scritto:

@Teocell https://github.com/Teocell : can you access the camera's stream by accessing it at rtsp://admin:xxx@192.168.1.42:554 ?

What about debug logs ?

yes I can, it is streaming live

Ok, cool. Can you share the debug logs please ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/32981#issuecomment-602158740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJDQ3F3YRMRKHTTOPE4HSX3RIW253ANCNFSM4LPFGITQ .

-- Marco

BaQs commented 4 years ago

copy-paste the ezviz relevant logs here please, don't forget to obfuscate sensible informations

BaQs commented 4 years ago

change this line to the new pyezviz version in manifest.json:

"requirements": ["pyezviz==0.1.5.3"]

Teocell commented 4 years ago

change this line to the new pyezviz version in manifest.json:

"requirements": ["pyezviz==0.1.5.3"]

I changed it.

Right now I can use the services but I still cannot stream with the same error as before Error requesting stream: camera.salotto does not support play stream service

I tried both: the email and the user_id. Everytime the same behaviour

If I use the actual name of the camera instead of the serial number (e.g. Salotto): 2020-03-22 10:16:41 INFO (SyncWorker_6) [custom_components.ezviz.camera] Found camera with serial D2xxxxxx without configuration. Add it to configuration.yaml to see the camera stream

The log is basically empty, there are no raws about ezviz (except for the starting ones).

In the meanwhile: the privacy mode button doesn't activate or deactivate the privacy mode but instead the "stand-by mode" (my camera can rotate in order to close the "eye")

Teocell commented 4 years ago

Guys now it works, sorry, my fault: I didn't put !secret before the password... shame on me!

Anyway, now I can help you to identify improvements if any

BaQs commented 4 years ago

Guys now it works, sorry, my fault: I didn't put !secret before the password... shame on me!

Anyway, now I can help you to identify improvements if any

Ah!

That’s good then thx !

GrumpyMeow commented 4 years ago

EZViz DB1 doorbell support? --> https://github.com/BaQs/pyEzviz/issues/3

bf69 commented 4 years ago

ok grazie per i dettagli. Non ho questo tipo di fotocamera, quindi se puoi aiutarmi a eseguire il debug di tutto ciò, potrebbe essere fantastico. Sai come installare un "componente personalizzato"? Potrei darti un po 'di tranquillità e di eseguire il debug della situazione. Potrebbe essere davvero utile anche per gli altri. Voler provare?

Sono nuovo per l'ambiente, se mi spieghi proverò ..

Quindi, è necessario creare la cartella:

custom_components

nella tua cartella di configurazione. Quindi, all'interno, copia la cartella ezviz da qui: https://github.com/BaQs/home-assistant/tree/ezviz_ptz/homeassistant/components/ezviz

(ad esempio puoi copiare / incollare ogni file dalla versione "raw").

Non dimenticare di abilitare i log di debug e ffmpeg in configuration.yaml (vedi il post sopra).

Inoltre, riavviare l'assistente domestico e controllare i registri.

I created the component and it gives me this error:

Dettagli registro (ERROR) Logger: homeassistant.components.camera Source: custom_components/ezviz/camera.py:151 Integration: Telecamera (documentation, issues) First occurred: 14:49:24 (1 occurrences) Last logged: 14:49:24

Error while setting up ezviz platform for camera Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for return fut.result() File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/ezviz/camera.py", line 151, in setup_platform cameras = ezviz_client.load_cameras() File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/client.py", line 197, in load_cameras cameras.append(camera.status()) File "/srv/homeassistant/lib/python3.7/site-packages/pyezviz/camera.py", line 74, in status 'follow_move': self._switch.get(TYPE_FOLLOW_MOVE)['enable'], TypeError: 'NoneType' object is not subscriptable

GrumpyMeow commented 4 years ago

The error related to “follow_move” is caused by the pyezviz package expecting your device to support a feature, which it doesn’t. I’ve temporarily commented out that specific line of code. After that the Camera was available and saw the video stream. The pyezviz package will probably need some modifications for support of more devices.

bf69 commented 4 years ago

The error related to “follow_move” is caused by the pyezviz package expecting your device to support a feature, which it doesn’t. I’ve temporarily commented out that specific line of code. After that the Camera was available and saw the video stream. The pyezviz package will probably need some modifications for support of more devices.

yes, I guessed, I commented the line: "" "FOLLOW_MOVE =" follow_move "" "" but nothing changes

BaQs commented 4 years ago

The error related to “follow_move” is caused by the pyezviz package expecting your device to support a feature, which it doesn’t. I’ve temporarily commented out that specific line of code. After that the Camera was available and saw the video stream. The pyezviz package will probably need some modifications for support of more devices.

should work in version 1.5.3, can you try to update ?

davtes77 commented 4 years ago

Hi, I have 2 ezTube 1080p cameras (model CS-CV310-A0-1B2WFR-Tube). After updating HA to v107.5 and configuring the ezviz integration I can see the 2 camera entities with all attributes, but no camera.ezviz* services was created.

Then I tried your custom_component version 1.5.3 and I can see all camera.ezviz* services. They are working fine (except the "follow_move" that is not supported on my camera model). The only error reported in the log is: "[homeassistant.components.camera] Error requesting stream: camera.camera1 does not support play stream service"

The "alarm_notify" switch availabe on my camera model is not supported by your component, I'm available to support you if like to make some testing.

Thanks for your great work!

bf69 commented 4 years ago

Hi, I have 2 ezTube 1080p cameras (model CS-CV310-A0-1B2WFR-Tube). After updating HA to v107.5 and configuring the ezviz integration I can see the 2 camera entities with all attributes, but no camera.ezviz* services was created.

Then I tried your custom_component version 1.5.3 and I can see all camera.ezviz* services. They are working fine (except the "follow_move" that is not supported on my camera model). The only error reported in the log is: "[homeassistant.components.camera] Error requesting stream: camera.camera1 does not support play stream service"

The "alarm_notify" switch availabe on my camera model is not supported by your component, I'm available to support you if like to make some testing.

Thanks for your great work!

33/5000 can you show the configuration?

davtes77 commented 4 years ago

Hi, I have 2 ezTube 1080p cameras (model CS-CV310-A0-1B2WFR-Tube). After updating HA to v107.5 and configuring the ezviz integration I can see the 2 camera entities with all attributes, but no camera.ezviz services was created. Then I tried your custom_component version 1.5.3 and I can see all camera.ezviz services. They are working fine (except the "follow_move" that is not supported on my camera model). The only error reported in the log is: "[homeassistant.components.camera] Error requesting stream: camera.camera1 does not support play stream service" The "alarm_notify" switch availabe on my camera model is not supported by your component, I'm available to support you if like to make some testing. Thanks for your great work!

33/5000 can you show the configuration?

Yes, sure:

ffmpeg:
stream:
camera:
  - platform: ezviz
    username: !secret ezviz_user
    password: !secret ezviz_pass
    cameras:
      SERIAL_CAM1:
        username: !secret cam1_user
        password: !secret cam1_pass
      SERIAL_CAM2:
        username: !secret cam2_user
        password: !secret cam2_pass

SERIAL_CAM1 and SERIAL_CAM2 taken from the ezviz app.

BaQs commented 4 years ago

Should be better with: https://github.com/home-assistant/core/pull/33261

GrumpyMeow commented 4 years ago

I tried it with pyezviz 0.1.5.5.... Almost there :-) I still got an error on:

  File "/usr/local/lib/python3.7/site-packages/pyezviz/camera.py", line 97, in status
    'follow_move': self._switch.get(TYPE_FOLLOW_MOVE)['enable'],
TypeError: 'NoneType' object is not subscriptable

This code above expects that all devices return the same switches, but apparently isn't the case. My EZViz DB1 doesn't return a "TYPE_FOLLOW_MOVE" switch and thus the code will fail.

I made the following changes: camera.py: L157 I moved the retrieval of the value ot the attribute 'enable' here.

       # # load switches
        switches = {}
        for switch in  page_list['switchStatusInfos'][self._serial]:
            switches[switch['type']] = switch['enable']

So i could remove it here: camera.py: L89

    return {
            'serial': self._serial,
            'name': self._device['name'],
            'status': self._device['status'],
            'device_sub_category': self._device['deviceSubCategory'],

            'privacy': self._switch.get(TYPE_PRIVACY_MODE),
            'audio': self._switch.get(TYPE_AUDIO),
            'ir_led': self._switch.get(TYPE_IR_LED),
            'state_led': self._switch.get(TYPE_STATE_LED),
            'follow_move': self._switch.get(TYPE_FOLLOW_MOVE),

            'alarm_notify': bool(self._status[KEY_ALARM_NOTIFICATION]),
            'alarm_sound_mod': ALARM_SOUND_MODE[int(self._status['alarmSoundMode'])],
            # 'alarm_sound_mod': 'Intensive',

            'encrypted': bool(self._status['isEncrypt']),

            'local_ip': self._connection['localIp'],
            'local_rtsp_port': self._connection['localRtspPort'],

            'detection_sensibility': self._detection_sensibility,

My device for example returns the following switches: 1, 2, 3, 7, 10, 21, 22, 29, 32, 39, 202, 300, 301, 302 I've yet to find out what these switches mean.

Could you try to take the fix from above into account?

davtes77 commented 4 years ago

Should be better with:

33261

It works very well with v1.5.5. Error still present: [homeassistant.components.camera] Error requesting stream: camera.camera2 does not support play stream service

My device is not a ptz, but "follow_move" attribute is present (always set to false, the ezviz_switch_follow_move_on service has no effect on it)

fastcolors commented 4 years ago

no stream and missing all the services here too.

C6C cameras.

configuration.yaml includes

ffmpeg:
stream:
camera:
  - platform: ezviz
    username: carloferre76@gmail.com
    password: !secret std_pwd
    cameras:
       #SERIAL_9_digits_only_numbers_in_my_case :
          username: admin
          password: FOOFOO

2020-03-28 23:55:25 INFO (SyncWorker_2) [homeassistant.loader] Loaded ezviz from homeassistant.components.ezviz 2020-03-28 23:55:26 INFO (MainThread) [homeassistant.components.camera] Setting up camera.ezviz 2020-03-28 23:55:30 DEBUG (SyncWorker_15) [homeassistant.components.ezviz.camera] Camera 182640943 source stream: rtsp://admin:FOOFOO@192.168.0.209:554

nothing is displayed with the following error:

2020-03-29 10:56:28 ERROR (MainThread) [homeassistant.components.camera] Error requesting stream: camera.fastcolors_attesa does not support play stream service

setting up a generic camera with rtsp://admin:FOOFOO@192.168.0.209:554

streams without issues

if I change

   async def stream_source(self):
        """Return the stream source."""
        if self._local_rtsp_port:
            rtsp_stream_source = "rtsp://{}:{}@{}:{}".format(
                self._username, self._password, self._local_ip, self._local_rtsp_port
            )
            _LOGGER.debug(
                "Camera %s source stream: %s", self._serial, rtsp_stream_source
            )
            self._rtsp_stream = rtsp_stream_source
            return rtsp_stream_source
        return None

into

   async def stream_source(self):
        """Return the stream source."""
        rtsp_stream_source = "rtsp://{}:{}@{}:554".format(
            self._username, self._password, self._local_ip
        )
        _LOGGER.debug(
            "Camera %s source stream: %s", self._serial, rtsp_stream_source
        )
        self._rtsp_stream = rtsp_stream_source
        return rtsp_stream_source

I can at least get Stream to be visible... No Services at all though.

@BaQs I was looking at the code... where is the PTZ support? I think Services are not there... because they are not in the code.... :-( there's no handling of the move() or anything else.. am I missing something?

bullgod-mort commented 4 years ago

what could be the problem with low frame rate? I now have 1 frame in 4-5 seconds. if i use rtsp stream i can watch live video HW: rpi 3b+ C6T camera

bullgod-mort commented 4 years ago

Ignoring the framerate of the video, I decided to add other services. so far I just assigned a button "up", but I get the following error:

Logger: homeassistant.components.websocket_api.http.connection.1854682864
Source: core.py:1212
Integration: websocket_api (documentation, issues)
First occurred: 21:08:11 (7 occurrences)
Last logged: 21:08:51

extra keys not allowed @ data['entity-id']
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1212, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['entity-id']
elipinska commented 4 years ago

Hi @BaQs, I've also been struggling to implement any of the Ezviz camera services, which led me to find this: https://github.com/home-assistant/core/pull/32451/files

It looks like this PR is adding the services we need, but it hasn't been merged in yet -- am I right to think the only camera functionality that's available at the moment is the video stream?

bullgod-mort commented 4 years ago

Hi @BaQs, I've also been struggling to implement any of the Ezviz camera services, which led me to find this: https://github.com/home-assistant/core/pull/32451/files

It looks like this PR is adding the services we need, but it hasn't been merged in yet -- am I right to think the only camera functionality that's available at the moment is the video stream?

i also have PTZ working, but..... 1 frame in 4-5 sec....

elipinska commented 4 years ago

@bullgod-mort I just ended up putting the following in my configuration.yaml as the stream offered by the ezviz integration was too slow for me too:

camera:
  - platform: generic
    name:  Main Camera
    stream_source: rtsp://admin:<VERIFICATION_CODE_FOUND_BY_QR_CODE_ON_CAMERA_BOX>@<CAMERA_IP_ADDRESS>/Streaming/Channels/101
    still_image_url: <IMAGE_URL>
bullgod-mort commented 4 years ago

@bullgod-mort I just ended up putting the following in my configuration.yaml as the stream offered by the ezviz integration was too slow for me too:

camera:
  - platform: generic
    name:  Main Camera
    stream_source: rtsp://admin:<VERIFICATION_CODE_FOUND_BY_QR_CODE_ON_CAMERA_BOX>@<CAMERA_IP_ADDRESS>/Streaming/Channels/101
    still_image_url: <IMAGE_URL>

You can use ffmpeg platform as well. Works great, but... Without any additional services such az PTZ (

robyevolution commented 4 years ago

Does this component work with an ezviz camera installed in another home or does it only work with local ezviz cameras?

Rikkie80 commented 4 years ago

Any progression? Will this be updated for the official Ezviz integration?