HomeKit, Zoneminder, Camera

Hi,
I’m stuck with cameras in Homekit.

I use HA ver. 2021.2.3 guest under Proxmox 6.3-3 host.
My cameras work with ZoneMinder v1.35.18, under Ubuntu 20.04.

I use ZoneMinder inetgration in HA. The cameras work well.
In the HomeKit integration the cameras preview work but when I click them the live stream doesn’t work.

The log shows 3 kinds of error:

Logger: homeassistant.components.homekit.type_cameras
Source: components/homekit/type_cameras.py:338
Integration: HomeKit (documentation, issues)
First occurred: 9:53:17 AM (1 occurrences)
Last logged: 9:53:17 AM

Camera has no stream source
Logger: pyhap.camera
Source: /usr/local/lib/python3.8/site-packages/pyhap/camera.py:574
First occurred: 9:53:17 AM (1 occurrences)
Last logged: 9:53:17 AM

[8d6c7ebb-7f96-4fb3-b240-18664ea09d97] Failed to start/reconfigure stream, deleting session.
Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:93
First occurred: 9:53:24 AM (1 occurrences)
Last logged: 9:53:24 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pyhap/camera.py", line 600, in _stop_stream
    stream_idx = session_info['stream_idx']
TypeError: 'NoneType' object is not subscriptable
1 Like

I am having this same error, did you ever find a solution to this?

No solution yet.

I am also encountering this on ZM 1.36.5, Docker HA 2021.6.6.

I can view my cameras perfectly fine within ZM and within HA itself, but attempting to view the camera streams in the Home app on my MacBook Pro or my iPhone results in a failed stream and the same errors in the HA logs as OP. When exiting the failed stream in the Home, the preview/thumbnail is updated.

Well, I figured something out. You can specify a stream_source for the entity under homekit.entity_config in configuration.yaml. For instance, if your camera entity is named camera.test the relevant part of the config would look like this:

homekit:
  ...
  entity_config:
    camera.test:
      stream_source: https://your_zm_url_or_ip/zm/cgi-bin/nph-zms?mode=jpeg&monitor=3&scale=100&maxfps=30

I have verified this works for me and I can then view the stream in the Home app. However, it’s a JPEG stream instead of something like an RTSP stream and thus it doesn’t look as good in my experience.

I did some digging and apparently you can configure a monitor in ZM to output RTSP (edit monitor > “Misc” > “RTSPServer” and “RTSPStreamName”), but there’s no documentation for it and I can’t get it to work. I do see 'zm_rtsp_server' started in the logs, but I have no clue what the appropriate URL to access a monitor’s stream is.

I innovate to a new server in a few weeks. I will migrate my old proxmox to this new hardware. I will make a new fresh zoneminder (under ubuntu) install. My feeling is that the zoneminder (or the MySQL) is at fault.
After that I can report on my experiences.

Hi,

Did you migrate and was able to find a solution? I have the exact same config and also get the same problem.

Here is the documentation:
Defining Monitors

But I don’t have the RTSP Server in Options → System.
So, I don’t use this option in ZM :slight_smile:

If use zoneminder integration, the cameras don’t have unique_id.

So I add MJPEG IP Camera where the MJPEG URL is src content

Earlier I got an error in log:

  • The bridge Home Assistant Bridge has entity camera.something. For best performance, and to prevent unexpected unavailability, create and pair a separate HomeKit instance in accessory mode for this entity

So I create a new homekit integration with only camera domain and it works now.

I’m really new to Home Assistant so this might be an easy or dumb question. When I open configuration.yaml I only see the Zoneminder settings. Nothing for HomeKit. Am I missing something or do I need to add it to the bottom?

By default not included in configuration.yaml
You can configure it manually in configuration.yaml or you can add it via the user interface.
Here is the manual

So I added it via the UI previously. Is there a way to have it added to the configuration.yaml or do I need to delete it and start over? All I want to do is add the stream_source to the cameras so they work once you click the thumbnail. Is there a way to add that via the UI?

What did you add via the UI?

I you would like to see your camera stream in Apple HomeKit on iPhone:

  1. Add your stream to your Home Assistant. For example
  2. Set it on Home Assitant’s HomeKit service. Here is the documentation
  3. Pair it with your iPhone

But if you confused a bit, try it:

  1. Delete you HomeKit integration (Settings → Devices & Services)
  2. Add your stream to your Home Assistant. For example. Check if you see the camera in Home Assistant
  3. Edit you configuarton.yaml and insert:
homekit:
  - filter:
      include_domains:
        - camera

If everything is OK you can pair your camera with your Apple’s HomeKit with the QR code

I added the HomeKit integration via the UI. I then have ZoneMinder set up via the configuration file. From what I am understanding from your post I should set up a stream of the cameras in addition to Zoneminder. On the Home Assistant dashboard, I see the video from Zoneminder.

If you made HomeKit setup and it does not work try troubleshooting