Amcrest ASH43 Issue

Hello,

I just bought an Amcrest ASH43-W camera as my first RTSP enable camera and am having a lot of trouble setting it up to just view the live stream through home assistant. So after ~2, 5hr nights of trying to get this to work and reading various posts, I figured I’d reach out… Below are the configuration.yaml entries I have tried:

ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg

stream:

#setup 1
camera:
  - platform: ffmpeg
    name: amcrest
    input: -rtsp_transport tcp -i rtsp://user:pass@IPaddress:554/cam/realmonitor?channel=1&subtype=0&authbasic=64  

#setup 2
camera:
  - platform: generic
    still_image_url: ?????????????
    stream_source: rtsp://user:pass@IPaddress:554/cam/realmonitor?channel=1&subtype=0&authbasic=64  
    name: amcrest_camera
    username: !secret amcrest_device_username
    password: !secret amcrest_password

#setup 3
amcrest:
  - host: IPaddress
    name: amcrest_camera
    username: !secret amcrest_device_username
    password: !secret amcrest_password
    port: 554 (with and without this)
    stream_source: rtsp
    binary_sensors:
        - motion_detected
        - online

In generic camera setup and ffmpeg camera setup, a camera entity is created, but when I click the entity to view the live feed I just get a quick loading circle and then gray.

In the amcrest integration setup, the sensors get created (not functional obviously), but the camera entity does not get created.

with the ffmpeg camera setup there doesn’t seem to be an error assossiated, but below is the error I am getting with amcrest and generic camera setup (2 and 3) seems similar to this post for a different camera ([Can not get Amcrest IP2M-841B to work - #5 by carbuthn]):

Logger: homeassistant.components.camera
Source: components/amcrest/__init__.py:177
Integration: Camera (documentation, issues)
First occurred: 12:37:50 AM (1 occurrences)
Last logged: 12:37:50 AM

Error while setting up amcrest platform for camera
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1371, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 319, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 280, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 447, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.213', port=80): Read timed out. (read timeout=6.05)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/amcrest/http.py", line 273, in _command
    resp = session.get(
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.1.213', port=80): Read timed out. (read timeout=6.05)

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 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/amcrest/camera.py", line 144, in async_setup_platform
    serial_number = await hass.async_add_executor_job(lambda: device.api.serial_number)  # type: ignore[no-any-return]
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/amcrest/camera.py", line 144, in <lambda>
    serial_number = await hass.async_add_executor_job(lambda: device.api.serial_number)  # type: ignore[no-any-return]
  File "/usr/local/lib/python3.9/site-packages/amcrest/system.py", line 130, in serial_number
    return pretty(self._magic_box("getSerialNo"))
  File "/usr/local/lib/python3.9/site-packages/amcrest/http.py", line 461, in _magic_box
    ret = self.command(f"magicBox.cgi?action={action}")
  File "/usr/src/homeassistant/homeassistant/components/amcrest/__init__.py", line 177, in command
    ret = super().command(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/amcrest/http.py", line 221, in command
    self._generate_token()
  File "/usr/local/lib/python3.9/site-packages/amcrest/http.py", line 118, in _generate_token
    resp = self._command(cmd).content.decode()
  File "/usr/local/lib/python3.9/site-packages/amcrest/http.py", line 295, in _command
    raise CommError(error) from error
amcrest.exceptions.CommError: HTTPConnectionPool(host='192.168.1.213', port=80): Read timed out. (read timeout=6.05)

The RTSP stream link works fine in VLC media player. I have tried everything that I can find for amcrest for the still_image_url, but nothing works in a browser or anything (the ‘amcrest smart home’ devices don’t seem to support http for this still image).

I understand that the amcrest integration may not support this camera, but I feel like I should be able to atleast get a live feed of the camera via RTSP using one of these setups.

Any help would be much appreciated.

Update:

I also tried to setup this camera with Frigate with default ffmeg args as well as all the ones described for camera specific configurations (Camera Specific Configurations | Frigate). All of them gave green screen in Frigate with ffmpeg broken image errors, except for the MJPEG Camera Configurations. However it was VERY choppy (mostly showed gray), but I would catch glimpses of the video feed, and didn’t show errors in the frigate logs atleast.

Anyways, I am going to just return this camera, because it is not worth the headache it seems and I was able to setup the reolink RLC-410 without any issues (as generic camera and in Frigate).

It’s too late to help OP now since they returned the camera, but if anyone else bought this camera and can’t get it to work with Home Assistant and/or Frigate, it’s because the camera is set to stream in H.265 by default. The simple solution is to download Amcrest’s IP Tool or Surveillance Pro software and change it to H.264. It works perfectly fine in both Home Assistant and Frigate after doing that. Same goes for the ASH21 (and presumably the entire Amcrest Smart Home lineup).

2 Likes

Yeah this was my first rtsp camera - so gave up on it pretty quickly since there wasn’t much documentation out there/didn’t have any knowledge of this type of stuff. Realized the importance/specification of h264 v h265 after playing around more with frigate and getting some other cameras setup. Also didn’t realize there was a way to change the compression of the camera, but that’s great to know for the future.

Thanks a lot for this and hopefully this helps anyone else in the future!

Do you mind sharing your configuration for that specific camera?
I have five other Amcrest cameras working but this model is not recognized.
Thank you.

I’m only using it in Frigate and WebRTC now, so don’t really have anything to share as it’s just the RTSP URL.

Makes sense. Thanks for the reply.
After much testing, I am pretty positive this camera is not supported by the HA integration.
Will have to return shortly.