New EZVIZ integration has error

i think the best way is to wait until a new release fix it, instead of using custom things.
Until then, just configure your ezviz camera with rtsp:

camera:  
  - platform: ffmpeg
    name: Ezviz Camera
    input: -rtsp_transport tcp -i rtsp://admin:Verification_Code@IP_Addr/h264_stream:554

3 Likes

Thanks.
I already implemented my camera via ffmpeg with:

ffmpeg:
camera:  
  - platform: ffmpeg
    name: Ezviz Camera
    input: rtsp://admin: verification_code@local_ip:rtsp_port

And it works great in Lovelace card.
But when i tried to use it as custom component an image is transmitted only one frame every 3-4 seconds.
And I can’t use PTZ as discribed at https://www.home-assistant.io/integrations/ezviz/

Good evening everyone.
I had the error message: does not support play stream service and therefore no image.
I added ffmpeg: before camera: in my configuration file and now I have the image.
On the other hand, I do not have access to the various services: ezviz_ptz, ezviz_switch_follow_move_on, ezviz_switch_follow_move_off, ezviz_switch_privacy_off, …
These do not appear in the service options of Home assistant.
How can we get this service?

I provided link in the message above.
But with this solution i only get video stream with 1 frame per 3-4 second and nothing else…
It would be great if someone will clarify this issue…

This is so sad… finally we can get ezviz… and that’s not working.
weird that u couldnt know if something goes wrong retriving the camera or with the login process… that’s just sad… anyway its NOT restricted to out-europe users, i am italian and still have same errors…

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

Error while setting up ezviz platform for camera
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, 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/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 50, in setup_platform
    cameras = ezviz_client.load_cameras()
  File "/usr/local/lib/python3.7/site-packages/pyezviz/client.py", line 197, in load_cameras
    cameras.append(camera.status())
  File "/usr/local/lib/python3.7/site-packages/pyezviz/camera.py", line 97, in status
    'follow_move': self._switch[TYPE_FOLLOW_MOVE]['enable'],
KeyError: 25

Any updates here? The ezviz integration does not work on my hassio either:

Logger: homeassistant.core
Source: components/ezviz/camera.py:149 
First occurred: 12:57:05 (1 occurrences) 
Last logged: 12:57:05

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 295, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 445, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 149, in async_added_to_hass
    self._ffmpeg = self.hass.data[DATA_FFMPEG]
KeyError: 'ffmpeg'

camera:

  • platform: ffmpeg
    name: Ezviz Camera
    input: -rtsp_transport tcp -i rtsp://admin:Verification_Code@IP_Addr/h264_stream:554

And it works great in Lovelace card.

glad it works for you.
maybe soon we can have the integration fully working.

Video stream only.
It would be great to receive as minimum as ptz function…

Same login error also for me… no way to get it work!

Is integration still broken?
Anyone tested with new HA version?

Hi,

I’ve tried this changes as custom_components (ver 0.110.0), now i got this error… (non-EU user)

Log Details (ERROR)

Logger: custom_components.ezviz.camera
Source: custom_components/ezviz/camera.py:53
Integration: ezviz (documentation)
First occurred: 2:33:39 AM (1 occurrences)
Last logged: 2:33:39 AM

Can not login to API

Same here. UK user and problems with

2020-05-23 19:49:04 ERROR (MainThread) [homeassistant.components.camera] Error while setting up ezviz platform for camera
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, 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/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ezviz/camera.py", line 150, in setup_platform
    ezviz_client.login()
  File "/usr/local/lib/python3.7/site-packages/pyezviz/client.py", line 240, in login
    return self._login()
  File "/usr/local/lib/python3.7/site-packages/pyezviz/client.py", line 87, in _login
    sessionId = str(response_json["loginSession"]["sessionId"])
KeyError: 'loginSession'

Any update on this?

Still not working for me

Log Details (ERROR)

Logger: homeassistant.components.camera
Source: components/ezviz/camera.py:49
Integration: Camera (documentation, issues)
First occurred: 10:03:43 PM (1 occurrences)
Last logged: 10:03:43 PM

Error while setting up ezviz platform for camera

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 178, 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/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/ezviz/camera.py”, line 49, in setup_platform ezviz_client.login() File “/usr/local/lib/python3.7/site-packages/pyezviz/client.py”, line 240, in login return self._login() File “/usr/local/lib/python3.7/site-packages/pyezviz/client.py”, line 87, in _login sessionId = str(response_json[“loginSession”][“sessionId”]) KeyError: ‘loginSession’

Still same errors here in Canada
I am really waiting for this integration to work

Same problem here… in NL with 3 Ezviz camera’s.
Any news on a possible solution?

Same problem here. As far as I can see no news yet.
I was searching for 1-2 months which cameras to buy is order to be supported by HA and at low cost. Since I noticed that there is an integration in the HA integrations pages I thought that’s it.

Until this integration is working I think it should be deleted from HA’s integration pages because it is misleading.

** I have added as ffmpeg camera and I have live stream, but this is not the purpose I buy it. I wanted the alarm and move sensor and that’s not available yet.

4 Likes

Has anyone got the integration working - I’m getting the same error as some others in here:

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, 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/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 50, in setup_platform
    cameras = ezviz_client.load_cameras()
  File "/usr/local/lib/python3.7/site-packages/pyezviz/client.py", line 197, in load_cameras
    cameras.append(camera.status())
  File "/usr/local/lib/python3.7/site-packages/pyezviz/camera.py", line 97, in status
    'follow_move': self._switch[TYPE_FOLLOW_MOVE]['enable'],
KeyError: 25

I have the exact same issue, but it seems there is a difference in the lines.

Logger: homeassistant.components.camera
Source: components/ezviz/camera.py:50
Integration: Camera (documentation, issues)
First occurred: 15:12:02 (1 occurrences)
Last logged: 15:12:02

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

Ok, maybe it could be helpful to somebody, I have fixed the problem in streaming by using the ezviz platform with some small changes to the ezviz integration source code. Then I implemented a small custom service (“ezviz_service”) in order to use the PTZ function of my camera (C6TC).
Here below more details.

About the streaming matter
In configuration.yaml:

  - platform: ezviz
    username: <your_ezvizaccount_username>
    password: <your_ezvizaccount_password>
    cameras:
      <camera_serial_number>:
        username: <your_camera_username>
        password: <your_camera_password>

Then in the ezviz/camera.py source code I simply replaced the initialitation of the self._local_rtsp_port variable with the code here below (in both init and update methods):

self._local_rtsp_port = DEFAULT_RTSP_PORT
if data["local_rtsp_port"] and data["local_rtsp_port"] != 0:
      self._local_rtsp_port = data["local_rtsp_port"]

In fact it seems the problem is due to the data[“local_rtsp_port”] which it looks like it is always empty.

About the ptz service matter:
Actually it seems it has never been implemented in the current ezviz integration, so I preferred contacting the [email protected] asking for credentials to access their Ezviz API in order to gather the control of my camera by using basically a couple of REST calls. I guess you can do the same by yourselves if you want to get access to their API, once you get access just add the lines below in your configuration.yaml:

ezviz_service:
    app_key: <YOUR_APPKEY_GOT_FROM_EZVIZLIFETEAM>
    app_secret: <YOUR_APPSECRET_GOT_FROM_EZVIZLIFETEAM>
    serial: <camera_serial_number>

Here below you can get my custom service source code. Hope you appreciate.

import asyncio
import logging
import time

from requests import get, post

CONF_APPKEY   = 'app_key'
CONF_APPSECRET   = 'app_secret'
CONF_SERIAL   = 'serial'
DOMAIN = 'ezviz_service'

DIRECTION_ATTR_VALUE = "direction"
DIRECTION_DEFAULT_NAME = "0"

_LOGGER = logging.getLogger(__name__)

ACCESS_TOKEN = ""
DOMAIN_EZVIZ_API = ""

def setup(hass, config):
    """Set up is called when Home Assistant is loading our component."""
    

    def handle_ptz(call):
        _LOGGER.info("hanlde_ptz INIT with AT = %s and DOMAIN = %s", ACCESS_TOKEN, DOMAIN_EZVIZ_API)
        
        if ACCESS_TOKEN == '':
            handle_login(call, False)
        
        try:
            direction_code = call.data.get(DIRECTION_ATTR_VALUE, DIRECTION_DEFAULT_NAME)
            url = DOMAIN_EZVIZ_API + "/api/lapp/device/ptz/start"
            _LOGGER.debug("PTZ Up command sending to %s", url)
            body = {
                "accessToken": ACCESS_TOKEN,
                "deviceSerial": DEVICE_SERIAL,
                "channelNo": "1",
                "direction": direction_code,
                "speed": "0",
            }
            response = post(url, data=body)
            #content = response.json()
            _LOGGER.debug("PTZ Up command sent")
            time.sleep(0.3)
            
            url = DOMAIN_EZVIZ_API + "/api/lapp/device/ptz/stop"
            body = {
                "accessToken": ACCESS_TOKEN,
                "deviceSerial": DEVICE_SERIAL,
                "channelNo": "1",
            }
            response = post(url, data=body)
            _LOGGER.debug("PTZ Stop command sent")
            
        except Exception as e:
            _LOGGER.error("Something went wrong during PTZ UP request: %s", exc_info=e)
            handle_login(call, True)
            
        _LOGGER.debug("hanlde_ptz END")
        

    
    def handle_login(call, force):
        _LOGGER.debug("handle_login INIT with force=%s", force)
        
        global ACCESS_TOKEN
        if not(ACCESS_TOKEN != '' or force == False):
            url = "https://open.ezvizlife.com/api/lapp/token/get"
            body = {
                "appKey": APP_KEY,
                "appSecret": APP_SECRET,
            }
            try:
                response = post(url, data=body)
                content = response.json()
                
                ACCESS_TOKEN = content['data']['accessToken']
                global DOMAIN_EZVIZ_API
                DOMAIN_EZVIZ_API = content['data']['areaDomain']
                _LOGGER.info("Ezviz Login completed with AT = %s and DOMAIN = %s", ACCESS_TOKEN, DOMAIN_EZVIZ_API)
            except Exception as e:
                _LOGGER.error("Something went wrong during Login request: %s", exc_info=e)
        _LOGGER.debug("handle_login END with force=%s", force)

    

    _LOGGER.debug("Registering events...")
    hass.services.register(DOMAIN, "login", handle_login)
    hass.services.register(DOMAIN, "ptz", handle_ptz)
    
    _LOGGER.debug("Initializing configuration variables...")
    APP_KEY  = config.get(DOMAIN, {}).get(CONF_APPKEY,'')
    APP_SECRET  = config.get(DOMAIN, {}).get(CONF_APPSECRET,'')
    DEVICE_SERIAL  = config.get(DOMAIN, {}).get(CONF_SERIAL,'')

    # Return boolean to indicate that initialization was successfully.
    return True
3 Likes