core: 0.91.0 - Camera stream recording getting stuck
Home Assistant release with the issue: 0.91.0
Last working Home Assistant release (if known): NA
Operating environment (Hass.io/Docker/Windows/etc.): VirtualEnv on NUC
Component/platform: https://www.home-assistant.io/components/stream/
Description of problem: From time to time the camera streaming would not start and complain that the steam is already recording.
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
- platform: generic
name: DaFang_stream
username: !dafang_user
password: !dafang_password
authentication: basic
still_image_url: https://192.168.86.50/cgi-bin/currentpic.cgi
stream_source: rtsp://192.168.86.50:8554/unicast
verify_ssl: false
scan_interval: 5
Traceback (if applicable):
##Stream recording start (via script)
2019-04-05 10:07:18 WARNING (SyncWorker_22) [homeassistant.components.python_script.record_camera_smart_noffmpeg.py] Start Recording {'entity_id': 'camera.dafang_stream', 'filename': '/tmp/video_20190405100718219019cameradafangstreamOutsideGarageMotion.mp4', 'duration': 20, 'lookback': 20}
##Another recording triggered, error returned:
2019-04-05 10:13:54 WARNING (SyncWorker_25) [homeassistant.components.python_script.record_camera_smart_noffmpeg.py] Start Recording {'entity_id': 'camera.dafang_stream', 'filename': '/tmp/video_20190405101354437809cameradafangstreamOutsideGarageMotion.mp4', 'duration': 20, 'lookback': 20}
2019-04-05 10:13:54 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall camera.record (c:7b5adf2a7c664a598d92aa06a4ed916d): entity_id=['camera.dafang_stream'], filename=<homeassistant.helpers.template.Template object at 0x7f49607250f0>, duration=20, lookback=20>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1147, in _safe_execute
await self._execute_service(handler, service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
self._platforms.values(), func, call, service_name
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 314, in entity_service_call
future.result() # pop exception if have
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 330, in _handle_service_platform_call
await func(entity, data)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 677, in async_handle_record_service
blocking=True, context=call.context)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
self._execute_service(handler, service_call))
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/stream/__init__.py", line 114, in async_record
await async_handle_record_service(hass, call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/stream/__init__.py", line 217, in async_handle_record_service
.format(recorder.video_path))
homeassistant.exceptions.HomeAssistantError: Stream already recording to /tmp/video_20190405100718219019cameradafangstreamOutsideGarageMotion.mp4!
##another one
2019-04-05 10:14:28 WARNING (SyncWorker_16) [homeassistant.components.python_script.record_camera_smart_noffmpeg.py] Start Recording {'entity_id': 'camera.dafang_stream', 'filename': '/tmp/video_20190405101428775627cameradafangstreamOutsideGarageMotion.mp4', 'duration': 20, 'lookback': 20}
2019-04-05 10:14:28 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall camera.record (c:8d3e9ecdbb624c228075f1f73dbc1baf): entity_id=['camera.dafang_stream'], filename=<homeassistant.helpers.template.Template object at 0x7f48743e5240>, duration=20, lookback=20>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1147, in _safe_execute
await self._execute_service(handler, service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
self._platforms.values(), func, call, service_name
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 314, in entity_service_call
future.result() # pop exception if have
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 330, in _handle_service_platform_call
await func(entity, data)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 677, in async_handle_record_service
blocking=True, context=call.context)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
self._execute_service(handler, service_call))
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/stream/__init__.py", line 114, in async_record
await async_handle_record_service(hass, call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/stream/__init__.py", line 217, in async_handle_record_service
.format(recorder.video_path))
homeassistant.exceptions.HomeAssistantError: Stream already recording to /tmp/video_20190405100718219019cameradafangstreamOutsideGarageMotion.mp4!
2019-04-05 10:17:26 WARNING (SyncWorker_21) [homeassistant.components.python_script.record_camera_smart_noffmpeg.py] Start Recording {'entity_id': 'camera.dafang_stream', 'filename': '/tmp/video_20190405101726592134cameradafangstreamOutsideGarageMotion.mp4', 'duration': 20, 'lookback': 20}
2019-04-05 10:17:26 WARNING (SyncWorker_21) [homeassistant.components.python_script.record_camera_smart_noffmpeg.py] Sleeping 60
2019-04-05 10:17:26 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall camera.record (c:f3318128efe84cabbcb45d8104257676): entity_id=['camera.dafang_stream'], filename=<homeassistant.helpers.template.Template object at 0x7f4878782b70>, duration=20, lookback=20>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1147, in _safe_execute
await self._execute_service(handler, service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
self._platforms.values(), func, call, service_name
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 314, in entity_service_call
future.result() # pop exception if have
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 330, in _handle_service_platform_call
await func(entity, data)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 677, in async_handle_record_service
blocking=True, context=call.context)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
self._execute_service(handler, service_call))
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/stream/__init__.py", line 114, in async_record
await async_handle_record_service(hass, call)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/stream/__init__.py", line 217, in async_handle_record_service
.format(recorder.video_path))
homeassistant.exceptions.HomeAssistantError: Stream already recording to /tmp/video_20190405100718219019cameradafangstreamOutsideGarageMotion.mp4!
Additional information:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 46 (16 by maintainers)
Commits related to this issue
- Add a TCP timeout of 5 seconds to ffmpeg Add a TCP timeout of 5 seconds to ffmpeg to fix stream getting stuck when network connectivity is lost https://github.com/home-assistant/home-assistant/issue... — committed to droopanu/home-assistant by droopanu 5 years ago
- Add a TCP timeout of 5 seconds to ffmpeg (#23617) Add a TCP timeout of 5 seconds to ffmpeg to fix stream getting stuck when network connectivity is lost https://github.com/home-assistant/home-assist... — committed to home-assistant/core by droopanu 5 years ago
- Add a TCP timeout of 5 seconds to ffmpeg (#23617) Add a TCP timeout of 5 seconds to ffmpeg to fix stream getting stuck when network connectivity is lost https://github.com/home-assistant/home-assist... — committed to alandtse/home-assistant by droopanu 5 years ago
I can verify I get the same error. Exactly same setup with dafang camera and same settings.
There seems to be incoming changes from #42277 related to socket timeouts, so with some luck that will fix this bug as well!