Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amcrest ASH21 IP Camera Integration - #54346

Closed
rkkreisel opened this issue Aug 9, 2021 · 11 comments
Closed

Amcrest ASH21 IP Camera Integration - #54346

rkkreisel opened this issue Aug 9, 2021 · 11 comments

Comments

@rkkreisel
Copy link

The problem

Trying to configure Amcrest ASH-21 IP camera for the first time. Receiving the following error in the log file

The camera is set up with a static ip address

Logger: amcrest.http
Source: /usr/local/lib/python3.8/site-packages/amcrest/http.py:211
First occurred: 2:39:45 PM (10 occurrences)
Last logged: 2:41:59 PM

None:None Trying again due to error: ConnectTimeout(MaxRetryError("HTTPConnectionPool(host='192.168.1.51', port=80): Max retries exceeded with url: /cgi-bin/magicBox.cgi?action=getMachineName (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at ADDRESS>, 'Connection to 192.168.1.51 timed out. (connect timeout=6.05)'))"))

What is version of Home Assistant Core has the issue?

core-2021.4.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Amcrest

Link to integration documentation on our website

https://github.com/NAStools/homeassistant/blob/master/homeassistant/components/camera/amcrest.py

Example YAML snippet

ffmpeg:
stream:
amcrest:
  - host: !secret amcrest1ip
    username: admin
    password: !secret amcrest1pw
    name: Amcrest1
    resolution: high
    stream_source: mjpeg
    binary_sensors:
    - motion_detected
    - online
    sensors:
#   - sdcard
    - ptz_preset
camera:
    - platform: amcrest

Anything in the logs that might be useful for us?

Logger: amcrest.http
Source: /usr/local/lib/python3.8/site-packages/amcrest/http.py:211
First occurred: 2:39:45 PM (10 occurrences)
Last logged: 2:41:59 PM

<None:None> Trying again due to error: ConnectTimeout(MaxRetryError("HTTPConnectionPool(host='192.168.1.51', port=80): Max retries exceeded with url: /cgi-bin/magicBox.cgi?action=getMachineName (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at ADDRESS>, 'Connection to 192.168.1.51 timed out. (connect timeout=6.05)'))"))

Additional information

No response

@probot-home-assistant
Copy link

amcrest documentation
amcrest source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @flacjacket, mind taking a look at this issue as it has been labeled with an integration (amcrest) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@flacjacket
Copy link
Contributor

Can you try accessing the camera with the upstream amecrest package directly? I am not able to test this camera, but I see there is some discussion on what if any of the camera API the smart home Amcrest cameras can support (see here and here). If you are able to install and test the amcrest python package, you should be able to:

from amcrest import AmcrestCamera
camera = AmcrestCamera(ipaddress, 80, username, password).camera
print(camera.general_config)
print(camera.software_information)
print(camera.version_http_api)

If that doesn't work, we can take this to the upstream package ticket that I see was just recently opened for this camera here: tchellomello/python-amcrest#183, it may be that the camera doesn't support the API and you will need to just use the RTSP stream. If you are able to get something out from that, then we can try to figure out what is happening in the integration.

@rkkreisel
Copy link
Author

Flacjaket - thanks for quick response. Could I get a link on how to install amcrest python package please?

@flacjacket
Copy link
Contributor

Depending on how you have home assistant installed, you may be able to use the amcrest package that is installed by home assistant. Otherwise, you should be able to follow the instructions here: https://github.com/tchellomello/python-amcrest#installation

@rkkreisel
Copy link
Author

rkkreisel commented Aug 11, 2021 via email

@flacjacket
Copy link
Contributor

Alright, does camera.version_http_api show anything?

I'm thinking the ASH21 does not support the API, which is what the Amcrest integration uses. In which case, you can use either the RTSP stream, which looks like it would be rtsp:https://<IPADDRESS>/cam/realmonitor?channel=1&subtype=0 or you can setup the camera with the Onvif plugin. Unfortunately, neither of these would give you any of the motion or AI detections that the camera is capable of providing to the app.

@rkkreisel
Copy link
Author

rkkreisel commented Aug 11, 2021 via email

@rkkreisel
Copy link
Author

rkkreisel commented Aug 19, 2021 via email

@GaryOkie
Copy link
Contributor

GaryOkie commented Aug 29, 2021

Just wanted to point out that the AD110 and AD410 doorbells are both "ASH" (Amcrest SmartHome) devices which support RTSP and the Amcrest API (for the most part), along with some SmartHome-specific events.

So @rkkreisel - entering the following command in your browser fails on the ASH21 (after authenticating)?
http:https://192.168.1.51/cgi-bin/magicBox.cgi?action=getMachineName

If that fails, does this work?
http:https://192.168.1.51/cgi-bin/configManager.cgi?action=getConfig&name=All

This displays a dump of all the camera configurations, most of which can be queried or changed individually via the API. In this dump, there should be:
table.All.General.MachineName=<name of camera>

The other thing I noticed was your use of stream_source: mjpeg in the config. Try using rtsp instead.

Please note what the HASS Amcrest documentation states:

Note: Amcrest cameras with newer firmware no longer have the ability to stream high definition video with MJPEG encoding. You may need to use low resolution stream or the snapshot stream source instead. If the quality seems too poor, lower the Frame Rate (FPS) and max out the Bit Rate settings in your camera’s configuration manager. If you defined the stream_source to mjpeg, make sure your camera supports Basic HTTP authentication. Newer Amcrest firmware may not work, then rtsp is recommended instead.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 27, 2021
@github-actions github-actions bot closed this as completed Dec 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants