Custom Component: Unifi Protect

Nope. 10 charrrr

I am using the docker container and just tried changing the path to “/config/www/doorbell.mp3” (I opened a console session into the container to verify that the file was accessible at that location). However, that didn’t seem to work either. I appreciate the help though!

Here’s the YAML for that line:

service: media_player.play_media
data:
  media_content_id: /config/www/doorbell.mp3
  media_content_type: audio/mp3
target:
  entity_id: media_player.front_door_speaker

NOTE: I also tried using /tts/NAME_OF_RECENT_TTS_FILE.mp3 since i know those files played properly, but that also failed to play when calling the service. Do i need to call one of the media player turn-on services or anything else first?

EDIT2: Just to confirm, i am running the latest (0.11.1) and have restarted the camera. TTS commands sent through the home-assistant UI do play, just not the media_player.play_media service

EDIT3: I think I got it! The media content type needs to be set to “music”

Nope. 10 charrrr

Ah, I believe I had to set it to that for the google-cast devices to pick it up, however after testing, it seems like “music” works just fine for both. However, the google-cast needs the URL, not the local path. So, i switched the path to be the URL, the type to be “music” and combined both calls into one (so it lists both the doorbell and the google cast group as the targets) and everything is working now, thanks!!!

Nope. 10 charrrr

2 Likes

With the new version I can no longer see my G3 Flex cameras in HA, the G4 Bullets are working just fine and it all happened when I upgraded this component. I have the same settings for RTSP so not sure what could be wrong. Did anyone else experience the same?

Please open an issue on Github and attach anything you might see in the HA Logfile

Nope. 10 charrrr

My G3 Flex is still working fine.

The ‘Medium’ is active. The ‘Medium Insecure’ was/is disabled.
As I was writing this, I noticed 0.11.2 was available and upgraded. Still working fine.

Thank you all for the response regarding my G3’s. They are displayed as “Unavailable”. The log mentions nothing about my G3’s so maybe there isn’t an issue with code itself but with something I have done (wouldn’t be the first time :smiley: )…

I have to dig deeper to figure out what is going on but just wanted to through some hooks out in case someone else experience the same. Can I reset/restart the integration to these specific cameras somehow?

One of my G3 cameras (Otillgänglig = Unavailable):

Medium stream is ok, is it not?
High quality is not available, but that might be normal on this model.

I find that any streams that are enabled in the Protect App will show up in the HA integration (although they are initially disabled in the HA integration)

So is the doorbell not considered a camera that supports “talkback”?
I’ve tried paying an audio file to it.

(Node-Red)

image

{
    "media_content_id": "https://externalurl.com/local/media/dingfriesaredone.mp3",
    "media_content_type": "music"
}

I’ve tried sending TTS to it through a service all and through the lovelace interface .

(Node-Red)
image

{
    "message": "testing"
}

Any tricks? Or will this not work with the doorbell?
Thanks for the hard work.

ok the doorbell might have needed to be rebooted.
I couldn’t hear any audio from the camera.
Now I think I got it working.

Can someone smarter than me help me understand sensor.<camera>_detected_object?

I want to translate “vehicle” to a Swedish word but what confuses me is how to do that.

service: notify.johans_mobil
data:
  message: {{ state_attr("sensor.g4_framsidan_detected_object",
    "event_object")|replace("vehicle", "Bil") | capitalize}} på framsidan
  data:
    image: /media/local/cameras/G4-Framsidan/{{ time_stamp }}.png
    clickAction: app://com.ubnt.unifi.protect
    ttl: 0
    priority: high
    group: aktivitet_framsidan

What confuses me is that sensor.<camera>_detected_object is not listed here under Developer Tools:

Hi @Lunkobelix
The object detected is not an attribute, but the state of the sensor, so you should use states("sensor.g4_framsidan_detected_object") instead. But please note, the state will reset to none after a short while without detection.

1 Like

Thanks a lot! Worked fine :slight_smile:

Are the states, “none”, “person” and “vehicle”? Is there anyone like “Not identified” or similar?

These are currently the 3 different states. If Ubiquiti adds more classifications, these will be added also.

1 Like

Some more info about my G3’s that isn’t showing the stream anymore, maybe it can help someone to give me an idea what has happened:

  • Stream is working in the Unifi app
  • The motion sensor is reporting back motion information to Home Assistant. I can see history of when motion occured.
  • I can toggle things like status light, overlay information, privacy mode, microphone level
  • I can not toggle things like IR active, record always, record motion, high FPS

So it looks like it is the stream that is not working, most of the other functions are working. I have enabled all three RTSP quality options (changed that now from only having medium enabled). Removing and reinstalling the integration is my last option but I guess that will cause quite some work since so I would like to avoid it.

Any ideas?

Edit: Turns out that RTSP stream with low quality had to be enabled in the Protect camera settings. Working fine now.

Nope. 10 charrrr

1 Like