Kuna Surveillance Camera Support

One way to test your hypothesis would be to wait till the light is out of sync in Hass then trigger a motion detection. Does the switch status update to the correct state?

Thanks for working on this, great to see support. Unfortunately, due to the lack of support at the time, I did not purchase a Kuna and went with a Nest Hello. Also placement of my Kuna would not have worked well for my front door.

Best of luck, keep me posted. Maybe I will purchase one in the future for my backyard. :slight_smile:

RE: the addon - I had something unexpected come up and couldn’t look at HA for 3 months. The one thing keeping me from releasing a fix now is an issue being tracked on git related to the recently released webhook component, which is needed for bringing thumbnails in via the push camera platform. Once resolved, the addon should be reliable for bringing polling-based status updates and thumbnails into HA.

@marthocoo - thanks for working to wrap an HA component around the API. My use case is limited only to motion detection, which is why the docker addon made sense. But now knowing the full scope of what the API allows, it definitely makes sense to create a more complete integration directly in the HA code base.

FYI, I poked around with Charles and noticed that in addition to allowing certain camera settings to be updated, a live websocket rtsp stream exists @ wss://server.kunasystems.com/ws/rtsp/proxy?authtoken=authtokengoeshere

1 Like

Good to know that you had found rtsp!

@marthocoo I installed your hassio custom component and it works like a charm! Thx.

@marthocoo I’m new to hass and just found this thread. I installed the component and it also works well for me.

Very excited about this, as the kuna has been great…all except their monopoly hold on what you can do with it. With your add on, there is much promise that we can work around it. Thanks!

@Corey_Maxim, @HITChris, @radiationnow, @Martso, @Nico74350, @TarheelGrad1998

I’ve just released a new version of the custom component (v3). This one adds support for an actual Camera entity in HA so that you can see the latest snapshot from the camera in the HA frontend.

I’ve also re-packaged the component to make it very easy to install, BUT this requires you to wipe the previous version and be running version 0.86 or higher of Home Assistant. To install the new version:

  1. Remove all files from the previous release from your custom_components directory (e.g. kuna.py, binary_sensor/kuna.py, switch/kuna.py).
  2. cd into your custom_components directory (normal install: ~/.homeassistant/custom_components, hassio: /config/custom_components)
  3. git clone the repo: git clone https://github.com/marthoc/kuna.

That’s it! From now on, when there’s a new release you can just cd into the custom_components/kuna directory and do a git pull.

This release features still images, but the next release will feature support for displaying the actual camera stream in the front end. Please let me know any feedback here or on GitHub!

Quick new release to v3.1 - forgot to bump the underlying python library, which fixes a couple of bugs.

I updated my components and have the new camera entity, so far working well. I haven’t tested any automations yet but certainly will. At the moment it appears the image is of better quality than what is shown in the Kuna app somehow, but it’s hard to get a good read as this camera doesn’t do great in the dark.

The only issue I noticed is the camera status is always “recording” but maybe that’s a side effect of not having the stream, as you mention. Nice work!

@TarheelGrad1998 Thanks for testing! Glad to hear it works.

Regarding the always “recording” - thanks for pointing that out. I made a small fix and bumped to v3.2, now the frontend should show “Recording” only when motion is detected and a recording is happening. Otherwise, the frontend should show “Streaming”.

You can update by cd’ing into the custom_components/kuna directory and doing git pull.

Works great man :ok_hand:

v4 now pushed which allows you to specify update_interval in configuration.yaml if you want to override the default polling interval of 15s (to make the binary_sensor more responsive). This is a non-breaking change as update_interval is an optional parameter.

Last update for today: v5 pushed which allows for “streaming” in the HA frontend when the camera is clicked on. Default is 1 image every 5 seconds when the streaming view is open but you can reduce that interval in configuration.yaml with the stream_interval parameter if you wish (practically speaking, it appears to take roughly 1s to fetch an image from the Kuna API, so don’t go too low).

Validated, at least for my 1 device account. Great work.

Updated, and it’s working well overall.

I am seeing a lot of timeouts in my log…FYI in case this is on the hass side of things:

Request to Kuna API timed out.
8:11 AM deps/lib/python3.6/site-packages/pykuna/kuna.py (ERROR)

Likewise, working well on my single device account (original Kuna kickstarter device, fwiw.)

I’ll try to get this going this weekend, I haven’t had much time to take a good look at it. Thanks for pushing this out!!!

I got it working too, seems to work well so far! The quality is so so, but its dark outside. IMO in the day it will be great!

Thanks So much for this!

Is it possible to add a switch service for the light?

You should get three entities per camera: a binary sensor (motion), a camera (images), and a switch (the light).

The image isn’t great as the thumbnail images from the Kuna API are only 320x240. Once I figure out the best way to proxy the camera stream into HA, the stream should be 720p.

ok, Ty I see them! Strange but it had a different label on it. (The kuna used to be on the front porch but was moved to the backyard, item was renamed before this addon but it kept the same name) However the camera showed as camera.back_yard.