Is anyone using the Amcrest camera successfully? I have mine setup, it shows the image in the dashboard and updates periodically, but if I click the image to open the popup window I get an empty window that says ‘idle’ but no image. In the log there are a bunch of Python errors (sorry, at work and I forgot to save them), which of course would be helpful. Just wondering if it’s working for anyone else, or are they seeing the same problem? I will post the log tonight.
Trying right now (just came in) and not having any luck. I’m getting this:
6-12-13 15:24:38 homeassistant.bootstrap: Invalid config for [camera.amcrest]: required key not provided @ data['host']. Got None. (See ?:?). Please check the docs at https://home-assistant.io/components/camera.amcrest/
my setup is:
camera 6:
platform: amcrest
ip: !secret camera_ip6
username: !secret camera_username
password: !secret camera_password
name: Back Yard
port: 18816
Does the ip need to have “http://”? my foscams did not need that.
16-12-13 15:50:06 homeassistant.components.camera.amcrest: Unable to connect to Amcrest camera: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: //192.168.1.206:18816/cgi-bin/global.cgi?action=getCurrentTime (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6f260230>: Failed to establish a new connection: [Errno -2] Name or service not known',))
I didn’t want to seem foolish so I tried the url and was able to connect directly to it. The port is correct (18816) but it looks as though it is trying to connect to 80?
I ended up connecting to it as an mjpeg camera. Then this morning I removed it because it wouldn’t keep a wifi signal. I’m sure I will circle back to it at some point.
Is your web interface running on port 18816? Did you change the configuration on Amcrest web interface?
If you try: http://<192.168.1.206:18816, are you able to see username/password form to log into Acmrest software?
Please let me know if you need any help setting up the amcrest component, I’d be mora than happy assisting you to troubleshoot it. I’m working to extend it by adding some sensors and control to PTZ presets via HA, which will require the component.
Another good advice is to increase to 20 the max number of connections on the admin interface on Amcrest software.
I was able to log into it properly and use it via Zoneminder as rstp using the same settings, port, user/pass but was not able to use the Amcrest component in HASS. I have it running now using the generic component. I can try to increase the max connections later and reconfigure as Amcrest to test.
I’ll have to recheck at a later time… I came home to the wife having AT&T install a new modem/router (unexpected) and have been trying to everything reconnected/reconfigured… ugh.
I’m getting connection timeouts when trying to view the streaming video. Using the mjpeg platform does work for me, but ideally the Amcrest platform should “just work”.
I dug through the codebase and found that the platform is currently trying to construct an mjpeg screen based on still snapshots. However, Amcrest cameras do provide a native mjepg stream - what if we just used that instead?
The underlying Python library does have a method for obtaining that stream: https://github.com/tchellomello/python-amcrest/blob/master/src/amcrest/special.py#L60 I tried implementing handle_async_mjpeg_stream myself using this method, but I’m not a Python developer, so I’m not making any progress. (Specifically, I don’t know how to pass that library’s response stream along in a way that makes HA happy).
IMO there are three ways this could be implemented:
Call self._data.camera.mjpg_stream() and somehow return that raw response data out
Skip the convenience function and call self._data.camera.command('mjpg/video.cgi?channel=0&subtype=1') to get the response object, and somehow return that out
Build and call the URL ourselves using aiohttp
While a native stream would be nice, there is one potential downside - as noted in this comment, newer firmware does not support mjpeg streaming off the high-resolution video - it’s only doable with the sub-stream. Personally, I’m okay with that, as my Amcrest camera does offer both streams. But to accomadate other users, we could:
Ignore the resolution option for the live stream, forcing everyone to use the low resolution mjpeg stream (as it should “just work” for everyone)
Add a new configuration option like stream_type with values snapshot (current functionality) or mjpeg (use the native stream
Somehow intelligently choose one methodology over the other
I’d prefer the first option as its the easiest and has the widest compatibility, but I’m open to either of the others.
@tchellomello Seeing as you’re leading the effort to implement Amcrest cameras, do you have any thoughts or pointers? I’d be happy to implement this myself - I just need a nudge in the right direction
I had originally tried to use the mjpg_stream() method from the amcrest library, but I couldn’t figure out how to properly take that raw response from mjpg_stream() and create an aiohttp response stream while considering:
How to easily obtain the Content-Type header and pass that along
Reading and writing the two streams asynchronously
Ensuring the response stream from the camera is properly closed at the right time
If you can figure that out, you’re welcome to submit a better PR in place of mine
So while I do consider myself a capable developer, I’ve never written in Python before, so I’d definitely appreciate a second look at this PR.
I’ll take a look at your other post and comment in a minute
Thank you for your contribution!! I’ll take a look on the PR and test here too. With the new PR, were you able to fix the timeout issues that you were experiencing before?