Can not get Amcrest IP2M-841B to work

I have a RP3 running Hassio version 61.1 and I am trying to add an Amcrest IP2M-841 camera. I had two Foscam cameras working correctly, but commented them out to match configuration information that found in other questions related to Amcrest cameras.

I have tried all of the configurations from the previous questions but continue to get the same type of error message on the frontend.
2018-01-25_11-10-46

My last attempted configuration is:

ffmpeg:

amcrest:
  host: 192.168.0.28
  port: 1028
  username: !secret am2_username
  password: !secret am2_password
  stream_source: rtsp
  name: AM2
  sensors:
    - motion_detector

camera:
  - platform: amcrest
#  - platform: foscam
#    ip: 192.168.0.25
#    port: 1025
#    name: Master Bedroom
#    username: !secret fc6_username
#    password: !secret fc6_password 
#  - platform: foscam
#    ip: 192.168.0.22
#    port: 1022
#    name: Front Bedroom
#    username: !secret fc3_username
#    password: !secret fc3_password

Any help would be appreciated, thanks.

Here is my working configuration.

ffmpeg:

camera:

  • platform: amcrest

amcrest:

  • host: !secret amcrest_1
    name: “Garage Camera”
    username: !secret camera_username
    password: !secret amcrest_password
    port: 8001
    stream_source: snapshot

What error comes up in the home-assistant.log file?

Sorry for the delay, had doctor appointment.

Reboot to get clean error log, it shows:

2018-01-25 15:26:01 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=120 from 2018-01-25 16:00:43.906043)
2018-01-25 15:26:21 ERROR (MainThread) [homeassistant.setup] Error during setup of component amcrest
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 199, in _async_setup_component
    component.setup, hass, processed_config)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/amcrest.py", line 99, in setup
    device.get(CONF_PASSWORD)).camera
  File "/usr/lib/python3.6/site-packages/amcrest/__init__.py", line 32, in __init__
    timeout_protocol=timeout_protocol
  File "/usr/lib/python3.6/site-packages/amcrest/http.py", line 67, in __init__
    self._token = self._generate_token()
  File "/usr/lib/python3.6/site-packages/amcrest/http.py", line 82, in _generate_token
    req.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://192.168.0.28:1028/cgi-bin/magicBox.cgi?action=getMachineName
2018-01-25 15:26:21 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest
2018-01-25 15:26:21 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.
2018-01-25 15:26:57 WARNING (SyncWorker_14) [homeassistant.components.zwave] zwave not ready after 30 seconds, continuing anyway

I am going to change configuration to match @nickelk13386’s file and reboot.

my current configuration is:

ffmpeg:

camera:
  - platform: amcrest

amcrest:
  - host: !secret am2_host
    name: "Garage Camera"
    username: !secret am2_username
    password: !secret am2_password
    port: 1028
    stream_source: snapshot

Log:

2018-01-25 15:52:13 ERROR (MainThread) [homeassistant.setup] Error during setup of component amcrest
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 199, in _async_setup_component
    component.setup, hass, processed_config)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/amcrest.py", line 99, in setup
    device.get(CONF_PASSWORD)).camera
  File "/usr/lib/python3.6/site-packages/amcrest/__init__.py", line 32, in __init__
    timeout_protocol=timeout_protocol
  File "/usr/lib/python3.6/site-packages/amcrest/http.py", line 67, in __init__
    self._token = self._generate_token()
  File "/usr/lib/python3.6/site-packages/amcrest/http.py", line 82, in _generate_token
    req.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://192.168.0.28:1028/cgi-bin/magicBox.cgi?action=getMachineName
2018-01-25 15:52:14 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest
2018-01-25 15:52:14 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.
2018-01-25 15:53:01 WARNING (SyncWorker_10) [homeassistant.components.zwave] zwave not ready after 30 seconds, continuing anyway

My host, user, password and port are correct and will open the camera web page with video. Also works with those setting on Synology disk station.

This error usually means the username/password is incorrect.
Try hitting that URL in your browser and enter the username/password and see what it tells you.

It works in the browser.

I was looking for the missing / file errors:
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”
File “/usr/lib/python3.6/asyncio/futures.py”
File “/usr/lib/python3.6/asyncio/tasks.py”
File “/usr/lib/python3.6/asyncio/futures.py”
File “/usr/lib/python3.6/concurrent/futures/thread.py”
File “/usr/lib/python3.6/site-packages/homeassistant/components/amcrest.py”
File “/usr/lib/python3.6/site-packages/amcrest/init.py”
File “/usr/lib/python3.6/site-packages/amcrest/http.py”
File “/usr/lib/python3.6/site-packages/amcrest/http.py”
File “/usr/lib/python3.6/site-packages/requests/models.py”

When I tried to find them in the terminal, I could not find them.
2018-01-25_16-18-05

How can I load them in HASSIO? Or change where HASSIO is looking to find them.

There are no missing files errors in the log you posted. The error you are getting is
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://192.168.0.28:1028/cgi-bin/magicBox.cgi?action=getMachineName

So when you hit the URL http://192.168.0.28:1028/cgi-bin/magicBox.cgi?action=getMachineName in your web browser what is displayed?

I had this issue before and recently when I re-enabled the platform I only enabled amcrest and not the camera and it seemed to work. Maybe try commenting out the camera section?

I got nothing from IE 11, Chrome gave me: name=AMC01746_EL5HJ2

Where did you have the IP address, user and password? Under Amcrest?
Like this?

amcrest:
  - host: 192.168.0.28
    port: 1028
    username: !secret am2_username
    password: !secret am2_password
    name: AM2

this is what I have and my camera is on the latest firmware

amcrest:
 - host: 192.168.1.42
   port: 1025
   username: !secret amcrest_user
   password: !secret amcrest_pass
   name: "Den Camera"
   resolution: high
   stream_source: rtsp

Still getting error message: Error during setup of component amcrest
6:52 PM components/amcrest.py (ERROR).
And
2018-01-25_19-10-36

Thanks for everyone’s help. Maybe after supper I will have better luck.

I am getting the same 401 unauthorized exception. Anyone has resolved this in Hassbian?

I am seeing the same error on my fresh install of Hassbian. I was running an older install of Hassbian that would have had python 3.4. I copied all files from my previous install and the camera worked. Switching to the new install of Hassbian and replacing files had this error come up. All other items in my config are working normally.

This configuration works for me:

camera:
  platform: generic
  still_image_url: 'http://<IP ADDRESS/cgi-bin/snapshot.cgi'  
  username: USER NAME
  password: PASSWORD
  authentication: digest
  name: Amcrest

This is generic camera and not amcrest platform. This is not working in latest hassbian. It works in hassio though.

Not sure if this is related to all the issues here but like to share in case it helps someone.

Just found out for my amcrest camera (IPM-HX1B) when no recording schedule or destination is set for snapshot in the Storage/Destination page of the camera setup, HA can’t get video when stream_source=snapshot and give error.
The error has to do with no response from [cam ip:port]/cgi-bin/snapshot.cgi?channel=0
From HA:
stream_source (Optional): …, whereas snapshot will use the camera’s snapshot API to create a stream from still images. …, it defaults to snapshot.

Apparently Amcrest’s snapshot API is not accessible when not ‘enabled’.

My testing of stream_source, all refresh ~10s in the card:
mjpeg, click to access video, freezes in couple of seconds
snapshot, click to access video, works but slow refresh ~10s
rtsp, click to access video, freezes in couple of seconds

Using ffmpeg camera for amcrest video is much better for me, click on access video, smooth live stream, doesn’t freeze.

I also have error on amcrest as well. and I am on Home Assistant version 0.64.

Amcrest at one point worked on my earlier installation (Hass.io), with an older version of firmware.

amcrest.py never worked when I moved to hassbian. I am consistently getting this error:

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://amcrest.ip/cgi-bin/magicBox.cgi?action=getMachineName

I suspect it has something to do with this bug:
https://github.com/tchellomello/python-amcrest/issues/70

But I am not so sure about it.

Yes, I managed to get amcrest’s video feed worked using ffmpeg feed, etc.

I would love to have amcrest.py working so i can use it as a motion detector and thus use that to trigger automation in that room.

Any of the developers can fix this? I hope it is a simple issue since amcrest works in hassio.