I got the same thing where it lasted a few seconds, and it was kind of blurry too in HD.
Hello all - wondering if anyone has any new updates on this topic. I just configured an IP2M-844E and it seems to be working with the configuration that @tchellomello posted above:
- platform: amcrest
name: "xxxxx"
host: !secret host
username: !secret uname
password: !secret pwd
port: 80
resolution: high
stream_source: rtsp
The view from home assistant is very laggy though about 10 seconds. Is that to be expected?
Thanks all for the great work to this point!
Tom
I would also be very interested in taking a look at @tchellomello 's HA sensor integration for motion if itās available somewhere.
Thanks,
Tom
@FrenchToast hello guys,
the Amcrest component should work better on <= 0.46. However, it also depends on the firmware version.
After updating to the latest firmware version, I was able to stream using RSTP on high on my bullet HP camera without any problems.
Have you tried to change the FPS and other configuration to see if works fine? Maybe try via command line to execute ffmpeg/ffplay to adjust its configuration.
Hello @eBoon. Here is one example of some actions triggered by the motion sensor:
#### send me a snapshot via Telegram from the camera
# automations.yaml
- alias: 'Actions upon motion detected on garage driveway'
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.amcrest_driveway_motion_detected
to: 'True'
action:
service: homeassistant.turn_on
entity_id: script.actions_motion_detected_driveway
## auto dimm living room lights
- alias: 'Dimm living since last movement'
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.amcrest_living_room_motion_detected
to: 'False'
for:
minutes: 30
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.wife_s6
state: 'home'
- condition: state
entity_id: device_tracker.marcelo_nexus6
state: 'home'
- condition: time
after: "22:00"
before: "06:00"
action:
service: homeassistant.turn_on
entity_id: script.dimm_living_room_no_moviment
Hope this helps you.
Thanks
Is your camera via wifi?
Running on raspberry PI takes me a few seconds to start streaming. When I migrated the HA instance to a better computer, it is now in a few seconds (1-2) seconds. If the camera is on the wifi, takes about 3-5 seconds.
Thank you!
Hi guys, am seeing an error for the Amcrest camera on hass and am wondering if the error is related to the same issue?
Btw config and automation are running fine, the error is just annoying
2017-07-05 15:51:53 WARNING (Thread-14) [requests.packages.urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /cgi-bin/snapshot.cgi?channel=0
2017-07-05 15:55:38 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 302, in _error_catcher yield
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 380, in read data = self._fp.read()
File "/usr/lib/python3.5/http/client.py", line 461, in read s = self._safe_read(self.length)
File "/usr/lib/python3.5/http/client.py", line 607, in _safe_read chunk = self.fp.read(min(amt, MAXAMOUNT))
File "/usr/lib/python3.5/socket.py", line 576, 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 "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 422, in start resp = yield from self._request_handler(request)
File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web.py", line 306, in _handle resp = yield from handler(request)
File "/usr/lib/python3.5/asyncio/coroutines.py", line 213, in coro res = yield from res
File "/usr/lib/python3.5/asyncio/coroutines.py", line 213, in coro res = yield from res
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware_handler return (yield from handler(request))
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/__init__.py", line 424, in handle result = yield from result
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/camera/__init__.py", line 338, in get response = yield from self.handle(request, camera)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/camera/__init__.py", line 358, in handle image = yield from camera.async_camera_image()
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__ yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, 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 117, in camera_image return response.data File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 188, in data return self.read(cache_content=True)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 401, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 307, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='CAMERA_IP', port=80): Read timed out.
2017-07-05 16:03:38 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 302, in _error_catcher yield
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 380, in read data = self._fp.read()
File "/usr/lib/python3.5/http/client.py", line 461, in read s = self._safe_read(self.length)
File "/usr/lib/python3.5/http/client.py", line 607, in _safe_read chunk = self.fp.read(min(amt, MAXAMOUNT))
File "/usr/lib/python3.5/socket.py", line 576, 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 "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 422, in start resp = yield from self._request_handler(request)
File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web.py", line 306, in _handle resp = yield from handler(request)
File "/usr/lib/python3.5/asyncio/coroutines.py", line 213, in coro res = yield from res
File "/usr/lib/python3.5/asyncio/coroutines.py", line 213, in coro res = yield from res
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware_handler return (yield from handler(request))
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/__init__.py", line 424, in handle result = yield from result
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/camera/__init__.py", line 338, in get response = yield from self.handle(request, camera)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/camera/__init__.py", line 358, in handle image = yield from camera.async_camera_image()
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__ yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, 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 117, in camera_image return response.data
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 188, in data return self.read(cache_content=True)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 401, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 307, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='CAMERA_IP', port=80): Read timed out.
2017-07-05 16:03:46 WARNING (Thread-7) [requests.packages.urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='CAMERA_IP', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0
2017-07-05 16:03:56 WARNING (Thread-25) [requests.packages.urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<requests.packages.urllib3.connection.HTTPConnection object at 0x7f06e8067978>, 'Connection to CAMERA_IP timed out. (connect timeout=3.0)')': /cgi-bin/snapshot.cgi?channel=0
2017-07-05 16:29:33 WARNING (Thread-8) [requests.packages.urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /cgi-bin/snapshot.cgi?channel=0
All of a sudden, I am getting errors with my Amcrest camera - hereās my config and log:
camera:
- platform: amcrest
host: 192.168.1.234
port: 80
name: "Front Door"
username: !secret camera_username
password: !secret camera_password
stream_source: rtsp
resolution: low
Log:
2017-07-11 16:53:55 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/urllib3/connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.4/socket.py", line 371, 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 "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 388, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 308, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.234', port=80): Read timed out. (read timeout=3.0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 678, in urlopen
**response_kw)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 678, in urlopen
**response_kw)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 678, in urlopen
**response_kw)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.234', port=80): Max retries exceeded with url: /cgi-bin/magicBox.cgi?action=getMachineName (Caused by ReadTimeoutError("HTTPConnectionPool(host='192.168.1.234', port=80): Read timed out. (read timeout=3.0)",))
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 161, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/lib/python3.4/asyncio/tasks.py", line 372, in wait_for
return fut.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 73, in setup_platform
config.get(CONF_USERNAME), config.get(CONF_PASSWORD)).camera
File "/home/homeassistant/.homeassistant/deps/amcrest/__init__.py", line 32, in __init__
timeout_protocol=timeout_protocol
File "/home/homeassistant/.homeassistant/deps/amcrest/http.py", line 68, in __init__
self._set_name()
File "/home/homeassistant/.homeassistant/deps/amcrest/http.py", line 101, in _set_name
self._name = pretty(self.machine_name)
File "/home/homeassistant/.homeassistant/deps/amcrest/system.py", line 100, in machine_name
'magicBox.cgi?action=getMachineName'
File "/home/homeassistant/.homeassistant/deps/amcrest/http.py", line 147, in command
timeout=self._timeout_protocol,
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 515, in get
return self.request('GET', url, **kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/adapters.py", line 504, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.234', port=80): Max retries exceeded with url: /cgi-bin/magicBox.cgi?action=getMachineName (Caused by ReadTimeoutError("HTTPConnectionPool(host='192.168.1.234', port=80): Read timed out. (read timeout=3.0)",))
Any ideas? Was working then something happened and nothing! I am able to see the camera at the specified IP address when I simply browse to it - works perfectly.
Thanks for your help!
Tom
Thank you - very helpful. How did you setup your amcrest sensors?
Tom
Did you ever get clarification on what causes this Retrying error? Or fix it?
I see this repeatedly on my 4 amcrest cameras in my HA instance build 0.84.6. Looking into ffmpeg and other camera component alternatives (Synology and zoneminder), but havenāt landed on a winner yet.
e.g. hereās what Iām seeing in my logs:
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by āConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f4ce4b8c198>, āConnection to 10.0.0.184 timed out. (connect timeout=3.0)ā)ā: /cgi-bin/storageDevice.cgi?action=getDeviceAllInfo