Amcrest Camera Not Working with 0.37

I have a IPM-HX1B Amcrest camera that was working with Home Assistant until I updated to 0.37, but now it does not show up.

Here is my cameras.yaml file:

  - platform: amcrest
    host: ######
    username: #####
    password: ######
    name: AmcrestCamera
    resolution: high
    stream_source: snapshot

I tried mjpeg, but when that failed I switched to snapshot and that failed as well.

This is what shows in the home-assistant.log file:

17-01-28 22:15:06 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/camera/amcrest.py", line 67, in setup_platform
    config.get(CONF_USERNAME), config.get(CONF_PASSWORD)).camera
  File "/home/homeassistant/.homeassistant/deps/amcrest/amcrest.py", line 32, in __init__
    timeout_protocol=timeout_protocol
  File "/home/homeassistant/.homeassistant/deps/amcrest/http.py", line 55, in __init__
    self.version = get_distribution('amcrest').version
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 552, in get_distribution
    dist = get_provider(dist)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 426, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 854, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'amcrest' distribution was not found and is required by the application

Can I assume that this model amcrest camera is just not supported under this version of home assistant?
I noticed it was not listed here.

1 Like

I see the same issue with my camera as well. It works/worked in 0.36.1 and is on that list so I’m leaning towards a bug.

I’m also seeing errors and having trouble with amcrest cameras post update.
I am, however, using one of the cameras that are in the supported matrix.

17-01-31 18:16:19 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/camera/amcrest.py", line 83, in setup_platform
    add_devices([AmcrestCam(hass, config, camera)])
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/camera/amcrest.py", line 94, in __init__
    self._base_url = self._camera.get_base_url()
AttributeError: 'Http' object has no attribute 'get_base_url'
17-01-31 18:16:19 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/camera/amcrest.py", line 83, in setup_platform
    add_devices([AmcrestCam(hass, config, camera)])
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/camera/amcrest.py", line 94, in __init__
    self._base_url = self._camera.get_base_url()
AttributeError: 'Http' object has no attribute 'get_base_url'
17-01-31 18:16:20 ERROR (Thread-6) [plexapi] http://10.0.0.176:32400: (401) unauthorized
17-01-31 18:16:20 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform plex
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/plexapi/server.py", line 47, in _connect
    return self.query('/')
  File "/home/homeassistant/.homeassistant/deps/plexapi/server.py", line 110, in query
    raise BadRequest('(%s) %s' % (response.status_code, codename))
plexapi.exceptions.BadRequest: (401) unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/plex.py", line 52, in setup_platform
    name, plex_url, plex_user, plex_password, plex_server)])
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/plex.py", line 74, in __init__
    self._server = PlexServer(plex_url)
  File "/home/homeassistant/.homeassistant/deps/plexapi/server.py", line 27, in __init__
    data = self._connect()
  File "/home/homeassistant/.homeassistant/deps/plexapi/server.py", line 50, in _connect
    raise NotFound('No server found at: %s' % self.baseurl)
plexapi.exceptions.NotFound: No server found at: http://10.0.0.176:32400
17-01-31 18:16:21 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/amcrest.py", line 76, in setup_platform
    sensors.append(AmcrestSensor(config, data, sensor_type))
  File "/home/homeassistant/.homeassistant/custom_components/sensor/amcrest.py", line 99, in __init__
    self.update()
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/amcrest.py", line 129, in update
    version, build_date = self._data.camera.software_information
ValueError: too many values to unpack (expected 2)
17-01-31 18:16:21 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/amcrest.py", line 76, in setup_platform
    sensors.append(AmcrestSensor(config, data, sensor_type))
  File "/home/homeassistant/.homeassistant/custom_components/sensor/amcrest.py", line 99, in __init__
    self.update()
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/amcrest.py", line 129, in update
    version, build_date = self._data.camera.software_information
ValueError: too many values to unpack (expected 2)

I submitted an Issue a few days ago and they are planning to release a fix for this in the next release 0.37.1

Just to chime in, mine quit working as well. IPM-722S - was working ‘most of the time’ before .37.

I updated to 37.1 and tried restarting 4 times but still no luck. I just modified my configuration to have it work as the mjpeg camera to at least have it back into HASS for now.

My camera was able to show in HA now with the 0.37.1 update. Was this not the case for you? Here is an example of my configuration for the amcrest camera:

camera: 
    - platform: amcrest
      host: ######
      username: #####
      password: ######
      name: AmcrestCamera
      resolution: high
      stream_source: mjpeg

You might also try deleting all the amcrest* folders out of the deps folder. Upon restarting HASS, they should download fresh copies.
I had to do this when upgrading to 0.37dev as well as 0.37.1

Well, I review my settings based on @trektronic post, restarted and no-go.

I then deleted the amcrest folder per @avalanchevm’s post and restarted and unfortunately it did not download a fresh copy. Do I need to remove the amcrest distro folder as well?

Check out tchellomello’s post here. He suggests cleaning out changes you may have made manually and letting it re-download.

rm -f /home/hass/.homeassistant/deps/amcrest*
pip3 uninstall amcrest 
pip3 install homeassistant --upgrade
hass --version

If that still doesn’t work, do you have any errors in the log file that have to do with amcrest?

1 Like

ran through that and tried again. Here is what is in the log:

17-02-03 20:32:32 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/camera/amcrest.py", line 64, in setup_platform
    from amcrest import AmcrestCamera
ImportError: No module named 'amcrest'

I checked the directory and there was no amcrest directory in the deps folder.

I then (in the virtual environment) ran pip3 install amcrest and restarted and now it works!!

I rechecked the deps folder and still no amcrest though do not sure where it installed.

Hello @Corey_Johnson it seems that you have to uninstall the amcrest from your virtual environment. If you do it, then you will see the amcrest under deps folder.

I’m glad it is working for you now.
mmello