Unifi camera component not working

Having troubles with setting up a component. I have the Unifi Video Controller installed on the same host as Home Assistant. The camera itself is added to the controller software and works fine. The API key is correct.

camera:
  - platform: uvc
    nvr: localhost
    key: xxxxxxxxxxxxxxxx

I don’t see any camera entities showing up in Home Assistant. No errors in the HA logs either, so not sure where to look.

Correction: It does show up, but the component is unable to display the image. The following error is in the log:

16-11-24 08:03:14 homeassistant.components.camera.uvc: Unable to login to camera

I verified the API key, and it is correct.

Entity looks like this in HA:

access_token: xxxxx
brand: Ubiquiti
entity_picture: /api/camera_proxy/camera.office_camera?token=xxxxx
friendly_name: Office Camera
model_name: UVC Micro

I have a UVC Micro running properly with this:

camera:

  • platform: uvc
    nvr: 192.168.1.4
    key: my key

Then you have to edit the uvc camera component for some reason. The component is not passing the login data so you get the unable to login error. Go to .homeassistant/deps/uvcclient then find camera.py. You will want to edit this code to match your login info, ubnt is the username for all UVC cameras I believe, then set the camera password, which is different from your user login password.

def login(self):
headers = {‘Content-Type’: ‘application/json’}
data = json.dumps({‘username’: ‘ubnt’,
‘password’: ‘cam_pass_you_set’})
resp = self._safe_request(‘POST’, ‘/api/1.1/login’, data,
headers=headers)

then you should be set. Restart home assistant and it should work. The only issue I have is response time when you click the image of the camera, which then opens the full video feed. It takes a while to load the camera. Let me know how that goes for you!

@moshsom is correct. The link above has some of the same info he discussed.

I also agree that it seems to be slower using the component.

I went back to using the generic platform.

  - platform: generic
    still_image_url: http://192.169.0.21/snap.jpeg
    name: MC Frontyard

Generic and UVC are both slow for me. I click the camera and the popup comes up, then it seems to take anywhere from 20 to 30 seconds to load the video feed. Has that been your experience @PtP?

Edit: Tried on other devices besides the host computer that runs HASS and it loads instantly. Weird!

I believe this is fixed in Home Assistant 0.45.0. The uvc platform now accepts a password parameter.