Custom Component: Unifi Protect

Thanks, yes i notice that too. Still, I need to have the low quality stream enabled, someone else with G3 Flex cameras please let me know your setting. For my G4 Bullets I don’t have RTSP enabled at all in the camera settings, so it works in some kind of magical way :grinning:

If you are having the “High” camera entity be enabled with the “Low” camera channel being enabled, the entity might be named incorrectly (i.e. it might actually be for the Low camera channel and mislabeled as High). You can check the entity_id on it to check (assuming you have not changed it).

The logic should be (or definitely will be in the next version of the integration, I have made some adjustments to improve it):

  • If RTSP is enabled for a channel (“High”, “Medium”, or “Low”), create two camera entities, one for RTSPS and one for RTSP (insecure). Both will be disabled by default unless it is the “default” camera entity.
  • If not RTSP is enabled for any channel, create a single camera entity with no streaming capabilities for the High channel (so that means you probably just cannot stream your G4 Bullets).

To determine the “default” camera entity, it should be the highest resolution RTSPS camera entity. So, if you enable only high, High RTSPS is the default. If you enable Medium and Low, Medium RTSPS should be the default.

The logic for the default is what was improved in the next version, it was not always choosing the correct default if the “High” channel was not enabled.

Additionally, you can also enable disable any of the camera entities you want your self. So, if you do not want to use the High RTSPS camera entity, and you instead want to use the Medium Insecure (RTSP) one, you can disable the High RTSPS one and enable the Medium Insecure one. After making changes to the enabled/disabled ones, it may take up to 1-2 minutes for Home Assistant to reload the entity so they appear correctly and then HA will remember your choices for the future.

Just wanting to shout out to @briis for all the effort and work put into this component. I’m excited to see 2022 for the next integrated release into HA. Hats off to @briis

2 Likes

Thank you, but I need to extend that thanks to @AngellusMortis and @bdraco who are really the guys behind most of the work in the last few month.

4 Likes

Hi,

Please forgive me for my noobness only really dabbled in HA/ Hacs for my protect doorbell coming from nest. This has worked for the most part since january but since about Nov it seems to stop working every day or two and I have no idea why. I have a G4 Doorbell connected to its own UI AP. RTSP high is enabled. This is the same script since jan. It triggers fine from within HA. If i reboot HA it works for a few days then just doesnt seem to detect anyone pressing the doorbell. Any ideas?

alias: Alexa Doorbell Ring
description: Alexa Notification on Doorbell press
trigger:
  - platform: state
    to: 'on'
    entity_id: binary_sensor.doorbell_g4_doorbell
    from: 'off'
condition: []
action:
  - service: notify.alexa_media_david_s_echo_dot
    data:
      message: Someone is at the front door!
      data:
        type: tts
  - service: notify.alexa_media_david_s_2nd_echo_dot
    data:
      message: Someone is at the front door!
      data:
        type: tts
  - service: notify.alexa_media_david_s_3rd_echo_dot
    data:
      message: Someone is at the front door!
      data:
        type: tts
mode: single

Probably caused by Upgrading the Protect App on my UNVR caused devices to stop updating. Needed to restart Hass · Issue #432 · briis/unifiprotect · GitHub.

The integration does not always gracefully reconnect everything when there is a disconnect with UniFi Protect. A recent UniFi Protect version, 1.20.2, actually had issues with the application crashing a lot. Make sure you are on 1.20.3 and restart HA. That should get it to be more reliable again.

The reconnect issues for the HA integration are WIP and will be resolved shortly (already have a fixed identified, just waiting to get it merged in and released).

1 Like

Hi,

Thanks my protect is still on 120.1 upgrading now

No idea why your doorbell trigger isn’t working but you can consolidate the notify for multiple devices:

- service: notify.alexa_media
      data:
        target:
          - media_player.david_s_echo_dot
          - media_player.david_s_2nd_echo_dot
          - media_player.david_s_3rd_echo_dot
        data:
          type: tts
          method: all
        message: Someone is at the front door!
2 Likes

Hi,

Thank you for that much appreciated have updated my automation.

David

Yes. Then a job well done → @AngellusMortis and @bdraco

Wanted to post a “more formal” update here for people that only follow the forums to know what is going on.

Release 0.12.0-beta and Home Assistant 2022.2

You may know or have missed that we are working on merging the HACS integration in the HA core. It will officially be in the 2022.2 release of Home Assistant. The 0.12.0-beta is the bridge for us to get some last-minute fixes/tests in before the 2022.2 release.

:warning: :warning: WARNING ABOUT Home Assistant v2022.2

Because unifiprotect will be an integration in 2022.2, it is very important that if you are running a version older then 0.11.x that you do not upgrade to 2022.2 of Home Assistant. The reason for this is that much of the migration code is being stripped out of the HA core release, so you must be running the version with all of the latest migrations ran, otherwise your unifiprotect integration will break.

0.12.0-beta Changes

If you are having any issues with your binary sensor/sensor entities not updating for motion/smart detections, I really recommend upgrading to this beta!

7 Likes

Unfortunately my automation based on state of the binary.sensor_doorbell also failed, somehow in ha it doesn’t switch to on (doorbell rings) to off (doorbell not ringing) anymore. When i see the sensor in my lovelace card i see it switch from not detected to detected but the it doesn’t seem to trigger the on/off of the sensor (weird i know). I then decided to switch to the event trigger(
unifiprotect_doorbell) instead of the state trigger in my automations, and all is working again

1 Like

Hi all – I’ve been using this integration (it’s awesome, thanks) for ~1 year. I have several cameras/doorbell. Recently had an issue crop up, I’m on the latest version of Unifi Protect and Home Assistant.

I have my cameras all feed into HomeKit – has worked great for a year. In the past week, for some reason, all of my still images on HomeKit go back to New Year’s Eve and don’t refresh (normally refresh after a few seconds). However, the motion notifications work and when I click on each camera, the live image comes through just fine. When I look at the feed in Home Assistant, it shows the most current image.

I have upgraded this integration to the latest beta, reloaded the integration, rebooted HassOs and the system itself – the old still image remains on HomeKit. One thing I haven’t done, is removed the camera entities from HomeKit and re-added them.

Any ideas? I’m stumped. Thanks!

The Lovelace card that shows the camera on dashboard is not made by our intergration. We only provide the RTSPS source to HA so it can make the information.

I recommend double-checking you have RTSP configured correct and your stream component configuration first. If that does not help, you might try asking in the #cameras channel on the official DIscord. Folks there are really helpful for troubleshooting camera issues.

As a last resort you try making an issue in the frontend Github. You can make a generic camera out of your camera entity, or just wait until 2022.2 is released and the integration is a core integration (that way you do not get told “custom_components are unsupported”).

I am sorry, ignore like everything I said. You said HomeKit. All of these Homes blend together. It is not Lovelace.

Can you try unpairing them with the homekit.unpair service and repairing them in the Home app?

I saw somewhere this is a general Homekit problem … so maybe it’s related to that?
https://www.reddit.com/r/HomeKit/comments/rpwcww/camera_snapshots_stuck_showing_now_but_image_is/

Yesterday I installed an update (via HACS) to v0.12.0-beta6 and had to change some of my attribute-based person/vehicle detection automations as a result.

Today, HACS updated the component again but this time to v0.11.4 - and failed to load after a reboot.

So I am not sure I understand what is going on with the version numbers and preparation for core integration. But it is now failing to load with the following error:

Logger: homeassistant.setup
Source: setup.py:153
First occurred: 10:16:37 (1 occurrences)
Last logged: 10:16:37

Setup failed for unifiprotect: Integration not found.

I had the same. In my case the custom_components folder had unifiprotect/unifiprotect/ when I moved the contents of the second unifiprotect folder to the first unifiprotect folder it worked again.

I accidently marked 0.12.0-beta6 as stable, when it was not. Then changed it back. That might have messed up HACS. That or the fact unifiprotect is in core now could be messing things up.

I am really sorry for whatever it is :confused:

@pcdave21 0.12.0-beta8 has a ton of fixes to make doorbell events a lot more reliable. Please let me know if you are still having issues after upgrading!