Custom Component: Unifi Protect

Yes Cameras shows up just fine in HomeKit. I do not have the G4 doorbell so not sure about that. I have the Nest doorbell (purchased long before the G4 doorbell became available) connected through HA to HomeKit and it does show up as a doorbell in HomeKit. So good chance G4 doorbell will also show up as a doorbell in HomeKit.

Well thatā€™s great. Does your Nest doorbell is recognized as an official doorbell in HomeKit? With the corresponding doorbell functionality in Homekit? Which means that it give you a notification on AppleTV when someones ring the door and it shows then the camera.

Yes that is correct. The websocket api isnā€™t documented so we are adjusting as we find issues with the implementation. Iā€™ve outlined a plan to refactor based on the new information here that will also solve the other case mentioned in that issue if websocket is available (we canā€™t fully fix it unless websocket is available):

https://github.com/briis/unifiprotect/issues/139

Unfortunately because of the scope, I donā€™t have time to do the work any time soon.

1 Like

Yes it will with the latest version.

Thanks for the update. So, its just a matter of waiting and time to develop. This is understandable. If I knew how to code, Iā€™d offer to assist.

Release 0.6.3

@bdraco made some serious changes to the underlying IO module, that gives the following new features:

  • When running UnifiOS on the Ubiquiti Device, events are now fully constructed from Websockets.

  • Motion Events are now triggered regardless of the Recording Mode, meaning you can use your cameras as Motion Detectors. Object detection still requires that the Cameras recording mode is enabled (Motion or Always) as this information is only passed back when either of these are on.

    BREAKING If your Automations trigger on Motion Detection from a Camera, and you assume that Recording is enabled on a camera then you now need to make a check for that in the Condition Section of your automation.

  • Bumped pyunifiprotect to 0.24.3

Hi,

Not sure if this is even possible butā€¦

In the unifi protect app, it now shows thumbnails for smart detections at the top.
These thumbnails then go to short videos of the person motion events.

Are these thumbnails / events / videos accessible through the API?
Or should I just capture video through an automation when a person event is triggered?

Does it wort to ask Home Assistant to start recording 5 seconds in the past?

Thanks for this excellent custom component, I use it a lot.
6 indoor G3 Flex.
2 G4 bullet
2 G4 Pro
Doorbell when they are available in the UK !

Thanks,
Bruce.

Glad you can use it Bruce.
I honestly donā€™t know if the SmartDetection Videos are available from the API, but Iā€™ll run a few tests.
Btw, it seems that the next SmartDetection object that will be implemented are Vehicles. There are references to it in the API, but it doesnā€™t work yet.

I donā€™t know if you can go back on this stream, but the camera.record service has a lookback option, that can go back x number of seconds. It states it can only be used on HLS streams and UI provides a RTSP stream - but to my knowledge this is converted in to a HLS stream. There is only one way to find out - test it, and let us know :slight_smile:

Hi @briis

Thanks for the new updated version.
After the update I have noticed ā€˜event_objectā€™ isnā€™t an available option under the optional attribute.

What should we put in the field for Peron Detection?

FYI - Testing still not able to get person detection to trigger an alert.

    entity_id: binary_sensor.motion_doorbell
    attribute: event_object
    to: person

Could you go to Developer Tools and see what attributes the sensor exposes. When I look at mine I get the following:

attribution: Powered by Unifi Protect Server
last_tripped_time: 2020-11-23 15:43:02
event_score: 98
event_length: 48.464
event_object: person
friendly_name: Motion DĆørklokke
device_class: motion

Please ignore my previous post. Noticed, for some reason, the user account had no access to Protect. Corrected and and the event_object is now there with couple others.

Performed couple more tests and the simple test alert went through to the phone indicating detection.
Checked the histort and sure enough, its triggering.

attribution: Powered by Unifi Protect Server
last_tripped_time: ā€˜2020-11-14 17:33:33ā€™
event_score: 0
event_length: 0
event_object: None Identified
friendly_name: Motion Doorbell
device_class: motion

History:
November 23, 2020
Cleared (no motion detected)
9:08:50 AM - 5 minutes ago
Detected motion
9:08:45 AM - 5 minutes ago
Cleared (no motion detected)
9:05:01 AM - 8 minutes ago
Detected motion
9:04:56 AM - 9 minutes ago

Now, I still seem to have an issue with displaying on the message on the TV.
With the latest beta UnifiOS, there are now two RTSP streams.

rtsps://192.168.200.1:7441/NF1TTnhen-------?enableSrtp
rtsp://192.168.200.1:7447/NF1TTnhen-------

Iā€™m still working to get the Message and Still Image to display on the TV.

The new RTSP stream is a secure stream (rtsps). This is not used by this Integration.

How are you trying to send the message and stream to the TV?

If execute the script manually the following happens:

  • Snapshot is stored in the folder
  • Message displays on the TV screen
  • NO picture from the snapshot

If triggering the person detect at the doorbell:

  • Nothing happens
  alias: (-Test LG TV - Video Notify)
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.motion_doorbell
    attribute: event_object
    to: person
  condition: []
  action:
  - data:
      filename: /home/homeassistant/.homeassistant/www/UnifiProtect/front-door-snapshot.jpg
    entity_id: camera.doorbell
    service: camera.snapshot
  - wait_template: ''
    timeout: 00:00:01
  - data:
      data:
        attachment:
          content-type: jpg
          hide-thumbnail: false
          url: http://192.168.200.241:8123/local/UnifiProtect/front-door-snapshot.jpg
      message: Someone at the Front Door
    service: notify.lg_webos_smart_tv
  mode: single

I just tested this on a WebOS TV I have, and I think it is a bug in the WebOS Notify Service. When you look at the documentation for the Service, the below is how you should send a message:

automation:
  - alias: Front door motion
    trigger:
      platform: state
      entity_id: binary_sensor.front_door_motion
      to: 'on'
    action:
      service: notify.livingroom_tv
      data:
        message: "Movement detected: Front Door"
        data:
          icon: "/home/homeassistant/images/doorbell.png"

Note the icon: attribute, which should be the way you add an image. But if I use this setup, nothing is send to the TV, if use any other (url, image, etcā€¦) I get the message, but not a picture. If you canā€™t find a solution in this Forum, I suggest to create an issue on Github for the LG WebOS Notify Service.

For example, the below Script is what I use when somebody pushes the Doorbell. It sends a message to my phone/Apple Watch, with an image and a url to a Video I recorded after the doorbell push.

service: notify.pushover
data:
  message: Someone is at the door
  data:
    sound: pianobar
    priority: 0
    url: >-
      https://MY_IP_ADDRESS/local/videos/{{states('var.doerklokke_video_fil') }}.mp4
    attachment: '/config/www/videos/{{ states(''var.doerklokke_video_fil'') }}.png'

Thanks. Looks like I will be opening an bug report on Github.

Update. I have opened a case against WebOSTV
LG WebOS Notify Service not displaying capture image Ā· Issue #43580 Ā· home-assistant/core (github.com)

1 Like

Anyone else notice that the doorbell trigger is now triggering on motion too in node red? On previous builds it only triggered on the button press, looks like the sensor is now tied to occupancy.

So are you saying that if motion is detected on your Doorbell, then the Ring sensor is also triggered? I donā€™t see that in my HA

yeah the binary_sensor.doorbell_front_door is triggering on motion now, which it never did before for me. The old states was off and on, now itā€™s detected or cleared.

I cannot replicate this. When I walk in front of my Doorbell I get the Motion Sensor to trigger, but not the doorbell. To get this triggered I need to press the button.

Hi all,
I have some users reporting that version 0.6.3 is not working on CloudKey+ devices that are running V1.1x software - so NON UnifiOS Devices. If you cannot upgrade your CloudKey+ to a 2.0.x release, I recommend you stay on the 0.6.2 release, until we have fixed the issue.

EDIT: Should be fixed in Release 0.6.4