I saw it also - If that really works for 29$, then they have a killer Camera.
Hi Bjarne!
First of all, great work with this component - this is by far one of my favorite integrations in HA
With the new HA upgrade - the history state is introduced - and there i stumpled upon something āinterestingā -with the motion detections binary sensors.
Mine happens to get the state unavailable - several times during a day.
I have added a screenshot here:
I am not sure if this is ānormalā or if itās something in my setup.
I use the CK2+
br Ronni
I run Protect on a CK2+ and looking at the history of my binary sensors on 0.114.4 for the last two weeks can see no āunavailableā states for either camera.
If you scroll back through your Protect timeline for the relevant camera on the web ui / mobile do you see periods of disconnection in Protect?
I also checked mine, and donāt see āunavailableā either. Seems like some kind of communication issue between your CK2 and HA.
Hi Again.
I just took at look on the protect portal - and it doesnāt seem to be unavailable at any of those times.
It looks like it has something to do with the communication between CK2+ and HA
I am 115,
Do any of you guys know if there is a log file that i can study?
br Ronni
I am seeing a lot of these errors, and my sensor will go unavailable for long periods of time.
Log Details (ERROR)
Logger: aiohttp.server
Source: custom_components/unifiprotect/camera.py:202
First occurred: September 16, 2020, 12:19:54 AM (472 occurrences)
Last logged: 9:08:12 AM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 499, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 516, in handle
image = await camera.async_camera_image()
File "/config/custom_components/unifiprotect/camera.py", line 202, in async_camera_image
last_image = await self.upv_object.get_snapshot_image(self._camera_id)
File "/usr/local/lib/python3.8/site-packages/pyunifiprotect/unifi_protect_server.py", line 555, in get_snapshot_image
access_key = await self._get_api_access_key()
File "/usr/local/lib/python3.8/site-packages/pyunifiprotect/unifi_protect_server.py", line 192, in _get_api_access_key
async with self.req.post(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 504, in _request
await resp.start(conn)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 847, in start
message, payload = await self._protocol.read() # type: ignore # noqa
File "/usr/local/lib/python3.8/site-packages/aiohttp/streams.py", line 591, in read
await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer
Log Details (WARNING)
Logger: pyunifiprotect.unifi_protect_server
Source: /usr/local/lib/python3.8/site-packages/pyunifiprotect/unifi_protect_server.py:579
First occurred: September 16, 2020, 12:24:49 AM (133 occurrences)
Last logged: 9:01:27 AM
Error Code: 500 - Error Status: Internal Server Error
What is the reason for this 15 second delay? Is it something to do with Protect or the camera itself and (probably) wonāt be fixed, or is it something to do with HA that could potentially be fixed?
Also, is this only for the doorbell or other cameras as well? I just got a G3 Flex and while it has a delay and some lag, itās not 15 seconds. I was thinking about picking up the doorbell as well (but wanted to get this integration working first and now theyāre out of stock again ).
Edit: Never mind. It does seem to have a pretty signifcant delay of ~10 seconds. The lag is also mostly gone, so not sure what I was seeing with that. I also assume this is an issue with HA since I can enable RTSP on the camera but accessing that directly through HA has the same delay. However, if I add the RTSP stream to MotionEye and access that with the MJPEG camera in HA then the delay is gone.
Small question: is the detection of a doorbell press by this integration instant? Or is it better to add a relay to the chime output of the G4 Doorbell to make it more instant?
With the current pull model it is within 2 seconds - so if this is instant - I will leave up to you.
There is now a guy who found all the websocket commands (Homebridge component), meaning it should be possible to convert to a push model, and when that is done, it should be instant.
Websockets and listening for events, is all new to me, so might take a little while before it is done, unless someone want to jump in and help.
Just browsing the intro of the homekit integration, and the interesting push method might be MQTT integration.
Lotās of the events are published on the bus and with the standard mqtt integration one could ājustā subscribe to those messages and trigger automations.
Iām still in discovery mode of MQTT, so i could have it all wrong.
True, he has implemented MQTT, but that is more for people who want to use this. In the Homebridge Plugin, you are not setting up MQTT to get it to work, so this is not what gives the push model.
Hello,
First of all kudos for great job with the plugin!
Iām dealing with some issue when trying to use the stream in automation:
action:
- service: camera.play_stream
data:
entity_id: camera.front
media_player: media_player.salon_display
Iām getting an error as follows:
2020-09-26 12:01:10 ERROR (Thread-8) [homeassistant.components.cast.media_player] Failed to cast media https://<hassio_ip>:8123/api/hls/<some_hash>/playlist.m3u8 from internal_url (https://<hassio_ip>:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
The issue must be that itās looking for a stream on <hassio_ip> instead on <cloud_key_ip> if Iām thinking correctly.
Few details:
- camera is Unifi G3 with Firmware 4.26.13 (the same issue happens with G3 Flex)
- camera has RTSP enabled
- camera streaming properly in a Lovelace card
Camera entity in HA:
ENTITY_ID: camera.front
STATUS: recording
ATTRIBUTES:
access_token: <token>
model_name: UVC G3
brand: Ubiquiti
motion_detection: always
attribution: Powered by Unifi Protect Server
up_since: 2020-09-25 17:07:43
online: true
camera_id: <camera_id>
last_tripped_time: 2020-09-26 12:16:14
friendly_name: Front
entity_picture: /api/camera_proxy/camera.front?token=<token>
supported_features: 2
Any suggestions?
Are you running 0.115.x and casting to a Google Home Hub? Thereās a number of issues open for this scenario and its why Iām not upgrading from 0.114.4 today.
Yes I amā¦ 0.115.3
Iāve found in meantime that bug:
which seems related and interestingly it does solve the tts issue not working (when you set internal_url to an external one) but does not sort out the camera streaming although does not throw error anymore as the referenced playlist.m3u8 file becomes available routed through an external URL but wonāt play
There are a number of related bugs raised in github and that is one of them - but I believe this is the one to watch:
Particularly this comment
Iām expecting it to take a while to fix, so holding at 0.114.4 and subscribing to the various related issues. Whilst Iām particularly looking forward to the new automation features I need a working doorbell cast in the meantime.
Before i begin, this may not be the best place for me to post this but since its related to the protect integration im gonna take a shot that you guys can at least point me in the right direction.
New HA user here so maybe im just missing something simple but im running into an issue here (i think) using the protect integration and an automation. I originally set this up a month ago or so and setup an automation with my Unifi G4 doorbell where if someone pushed the button it would announce over a google home speaker group, ir worked flawlessly for a week or two then my G4 doorbell went to hell and i had to RMA it. Got a new one setup and the entity ID changed so i updated my automation to reflect this but i still cannot for the life of me get the automation to work. The automation itself is running, i can see that the binary sensor is tripping but its not making the announcement. If i take the chunk of text out to call tts it works without any issue but not when the automation itself kicks off.
- entity_id: binary_sensor.doorbell_front_doorbell_2
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
entity_id: group.media_players
message: Someone is at the front door.
service: tts.google_say
You are right this is not Unifi Protect specific, as you state that the Binary Sensor does react to Motion.
A couple of things to try:
- Remove the
from: 'off'
in your trigger. It is not needed, as this is a binary sensor. - I made the below script, and put that in as action in an automation, and this announces fine everytime. One change compared to your action is that I donāt have the Service
tts.google_say
I only havetts.google_translate_say
, but that might just be my setup.
service: tts.google_translate_say
data:
entity_id: media_player.office
language: en
message: Someone is at the Front Door
Hi all, I was up till the early hours trying to get this custom component working for the UDM Pro. I have read every post and tried all the suggestions my little brain cells could come up with and unfortunately still no dice
Hoping someone can validate my config.
In the following configuration.yaml, I have also tried the actual IP of the UDM pro, and I have tried the ports, 443, 7443 and 32770 (thanks for sharing @adandl ) I read that the port must be specified on UnifiOS.
#UniFi Protect
unifiprotect:
host: 61535f70-unifi-udm-api-proxy
port: 443
username: !secret unifi_usr
password: !secret unifi_pass
camera:
- platform: unifiprotect
binary_sensor: - platform: unifiprotect
sensor: - platform: unifiprotect
Also just to confirm I have installed HACS and installed this custom component sucessfully and also installed the Unifi UDM API Proxy using this method: https://github.com/Silvenga/unifi-udm-api-proxy-ha
@briis I followed your link for the unifi-udm-api-proxy - thanks for sharing
Iām not sure if I havenāt set this up properly because it says the easiest way is docker-compose
and I installed it via the gui, not sure if its missing any configuration.
Anyways here is my config for Unifi UDM API Proxy.
And GreyJackal thanks for providing your input as well, I tried running the command that worked for you in the SSH & Web Terminal
docker run -d -p 5000:443 -v /var/run/docker.sock:/var/run/docker.sock silvenga/unifi-udm-api-proxy
and it appeared to pull the latest image in, but it didnāt make any difference unfortunately
Thanks heaps in advance,
Kind regards,
Jib
Hi there,
I am not sure where you got the latest information from, but it seems what you are trying to do is old info. The proxy is not needed anymore, as the Integration supports the UDMP out of the box. Please see the README file on Github for instructions on how to set this up.
But in short:
- Install the Integration via HACS
- Restart Home Assistant
- Go to the Configuration section and select Integrations
- Click the + sign in the bottom right of the screen and search for Unifi Protect (If it does not show up, do a hard refresh of the browser page)
- When you then select Unifi Protect, you will be presented with a new screen where you enter your UDMP details.
- And you are done.
If you followed the Pre-Setup instructions on the README, everything should work now.