Custom Component: Unifi Protect

@briis The live streaming issue has resolved today by upgrading to HA 2021.5.0 for me. Is it working on your end again as well?

I can confirm that a Picture Glance card with camera_view set to live also works for me now on Safari and IOS devices. I am not sure what changes were done in HA, but I am happy it works.

@briis if i get this error;

with this calls service:

service: camera.play_stream
target:
  device_id: e512d90af5b6f0086fdf66e663c4d1da
data:
  media_player: media_player.tv_meubel

What am i doing wrong? Both HACS and integration are at the latest version btw, but i DO NOT have a ā€˜stream:ā€™ entry in my configuration.yml

UPDATE: The missing part was indeed the lack of stream setup in my configuration. Might be cool (if at all possible) if the integration could check for this.

So are you saying it works now? Else have a look at this closed issue: Camera stream error Ā· Issue #228 Ā· briis/unifiprotect Ā· GitHub

EDIT: And yes, checking for stream could be a nice thing, and I will look at that.

Yes it works. Now all i have to figure out if it would be possible to send a custom MP3 along with the camera stream, but i am guessing that is a bridge too far. If possible, that could fully mimic the 'doorbell pressed = video + announcement" use-case :slight_smile:

Let us know if you figure it out :slight_smile:

Interesting. But is there a special way of exposing the cameraā€™s to Homekit? Since I donā€™t have audio on the camera streams that I exposed through HA. I also expose the cameraā€™s through homebridge (on a seperate RPi 4) and there they have audio :frowning:

You have to configure HomeKit via yaml to enable audio support

1 Like

Is there a better example of this besides the example I found here HomeKit - Home Assistant (home-assistant.io)

  entity_config:
      camera.alexanderalpha_front_door:
          linked_doorbell_sensor: binary_sensor.front_door_doorbell_sensor
          linked_motion_sensor: binary_sensor.front_door_motion_sensor
          support_audio: true
          video_codec: copy
1 Like

I now have audio I hear the sound from outside but not from the phone, also the sound falls away, it is not a good audio stream, is it workable with you and does anyone hear you when you say something through your phone?
Turning down the streaming quality does not improve the audio.

I am using a UDM-Pro with only one camera attached and that is the doorbell :wink:

Iā€™m looking to get into the Unifi Protect ecosystem and as a home assistant user i want to integrate it obviously. This component seems the way to do this, but i have a couple of questions after reading through this topic:

  • Are there any plans on making this component an official integration/add-on?
  • When using the G4 Doorbell and Homekit will it be possible to use 2-way audio? If no, where is the bottleneck?

Thanks in advance for answering!

To your questions:
Yes, eventually I will make this an official Integration. I have no timeline for this. Having it as a Custom Integration has proven useful, as the Protect API is undocumented and changes often, so having the ability to send out frequent updates, has been good. But the Integration is pretty stabil now, so it might be time.

There is currently no support for 2-way audio. As you can see from the posts just about you, there is not a good solution currently. Personally, I just use the Protect APP on my phone for that specific use case.

Hi briis, thanks for your clear response and your hard work on this component!
One question remains unanswered though. Do you know whatā€™s keeping us from supporting 2-way audio? I know it takes time and effort, but i mean what component(s) in the chain need to be adjusted to support this: HAP-python? Homekit integration? Hass itself? This component? ā€¦? Asking this so i know where to start putting my effort into, if my somewhat limited skills will allow me to do so.

I honestly donā€™t know, exactly what is missing to do this. There is a Homebridge Plugin that does support this, and I tried to look at that code, but I am still not sure if this can be applied to Home Assistant and this Integration.

So the short answer: I donā€™t know exactly what is missing, it is just not an easy fix.

Thanks! I will try to look into this myself. Since the homebridge plugin supports this there seems to be an opening which gives a man hope :star_struck:

I have a similar thing. The audio comes and goes. 2 seconds of audio, 2 seconds of silence etc. Not sure where this is coming from. Using PI4 with hassos

  • binary_sensor - For each camera in Unifi Protect a binary sensor is created that shows if motion occurs on that camera. Note: This only works if the camera is armed.

Iā€™m sorry if this a stupid question but Iā€™m a newbie around here.
How can I ā€œarmā€ the camera? I canā€™t find anything on Unifi Protect or in Home Assistant.
I need to get the motion status on HA to trigger automations.

Armed means that recording is active in one of the available forms. Motion, Always or Smart.
But unless you are running a CloudKey+ with FW lower than 2.x, this is no longer needed. The binary motion sensor will always trigger, no matter what setting if motion is detected. I need to update the documentation.

My recording mode is set to Motion and I never get the binary motion sensor updated :-/
I may have a problem here. Any suggestions on how to troubleshoot it?