I’m using Blue Iris as my NVR, and I wanted to connect to the Blue Iris server since the video streams start much faster than connecting to the individual cameras. After much trial and error, this config sort of worked for me:
# Cameras
stream:
ffmpeg:
camera:
- platform: mjpeg
mjpeg_url: http://192.168.0.133:81/mjpg/uppfart
name: Uppfart
username: !secret blueiris_username
password: !secret blueiris_password
authentication: basic
- platform: mjpeg
mjpeg_url: http://192.168.0.133:81/mjpg/altan
name: Altan
username: !secret blueiris_username
password: !secret blueiris_password
authentication: basic
This config generated camera entities and allowed me to configure cards in Lovelace with live views in home assistant. I could also get a live feed when pasting the mjpeg_url in a browser.
As soon as I added the entities in the homekit section, the cameras were added to the Home app, but I got the same error as @alexmuntean where the thumbnail in the Home app on my iphone would update every 10 seconds, but the live stream didn’t work.
So I changed the plattform to ffmpeg, or rather, added 2 new cameras using ffmpeg:
# Cameras
stream:
ffmpeg:
camera:
- platform: mjpeg
mjpeg_url: http://192.168.0.133:81/mjpg/uppfart
name: Uppfart
username: !secret blueiris_username
password: !secret blueiris_password
authentication: basic
- platform: mjpeg
mjpeg_url: http://192.168.0.133:81/mjpg/altan
name: Altan
username: !secret blueiris_username
password: !secret blueiris_password
authentication: basic
- platform: ffmpeg
name: uppfart_ffmpeg
input: http://<uname>:<passwd>@192.168.0.133:81/mjpg/uppfart
- platform: ffmpeg
name: altan_ffmpeg
input: http://<uname>:<passwd>@192.168.0.133:81/mjpg/altan
I now inluded the camera.uppfart_ffmpeg and camera.altan_ffmpeg in the homekit section and kept the original definitions for the HA cards (the ffmpeg cameras didn’t give live views in HA):
# Homekit integration
homekit:
auto_start: false
# safe_mode: true
filter:
include_entities:
- camera.uppfart_ffmpeg
- camera.altan_ffmpeg
This almost works: I now get thumbnails every 10 seconds, and I can view the camera “camera.uppfart_ffmpeg” but I can’t get a live feed for the camera named “camera.altan_ffmpeg”. The log files gives me this:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit/type_cameras.py", line 321, in stop_stream
await getattr(stream, shutdown_method)()
File "/usr/local/lib/python3.7/site-packages/haffmpeg/core.py", line 158, in close
await self._loop.run_in_executor(None, _close)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/haffmpeg/core.py", line 153, in _close
self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe
2020-05-22 12:02:32 ERROR (SyncWorker_2) [homeassistant.components.homekit.type_cameras] [0a56bbd7-6ff2-41f4-8a8d-b60af9cca47d] Failed to kill stream.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit/type_cameras.py", line 321, in stop_stream
await getattr(stream, shutdown_method)()
File "/usr/local/lib/python3.7/site-packages/haffmpeg/core.py", line 170, in kill
self._proc.kill()
AttributeError: 'NoneType' object has no attribute 'kill'
Any ideas what might go wrong?