Kuna Surveillance Camera Support

Hi

I am very interested in this product https://www.getkuna.com/ in particular MAXIMUS SMART SECURITY LIGHT. It would be great if I can automate lights with this camera sensor and also notifications via Home Assistant. I would like to see the cameras using the HA frontpage as well. That way I can see all my cameras.

You can add me to the list of interested person! Kuna light are ideal for outside camera as it doesnā€™t stick out like standard camera. It doesnā€™t make your home look like a rockstar protected mansion!

Having them integrated in Home Assistant would be ideal!

1 Like

Anyone ever get into the Kuna thing. Is a way to see the kuna on your local network?

Donā€™t think so. I think Kuna is restrictive to their code for security purposes.

I poked at this a bit a month or two ago, as I have a Kuna (early kickstarter backer, back when they promised thereā€™d be API access and such, long before I started with Home Assistant.)

The camera actually connects back to their servers (running on AWS) via an SSL tunnel, so difficult to get anything meaningful from the data flow. No way to get any sort of status from the local device I could find, and the extent of their API/integration to date is ā€œyou can use our Alexa skill to turn the light on/off.ā€ They claim itā€™s due to security concernsā€¦ but I suspect it has more to do with a desire to sell their cloud video recording service.

I love the physical form factor of the light, but unfortunately canā€™t recommend it if you want any ability to integrate it into your Home Assistant system.

To update - if youā€™re logged in via the web, there are some (undocumented) APIs available. https://github.com/loghound/kuna-camera-api has much of the details, but in addition, https://server.kunasystems.com/api/v1/cameras/MYCAMERAID/thumbnail/ lets you get a thumbnail. Not local access, but might still be usable, though Iā€™m not sure how to auth HA so it can access that link to get images.

I donā€™t think those APIs have been exposed for more than a few months but yea Iā€™m happy we finally have a way of pulling info down from those cameras in real-time. I recently created a hassio addon (here), mainly to determine if/when the motion sensor gets triggered, but it is also bringing some other (semi-useful) information from the responses back to HA. The thumbnail endpoint doesnā€™t appear to be real-time so I avoided pulling the URL in, but as you suggested (and loghound appears to have documented to a greater extent), there may be other endpoints out there that we can take advantage of. At least we have a URL to hit :slight_smile:

This looks great! Iā€™ll test soon.

FWIW the thumbnail URL is real-time or close to it; I tested by pulling an image, switching the light off, pulling again and got a dark image immediately, so I think itā€™s useable. Just doesnā€™t update without a new pull.

Sounds good. Iā€™ll update so that it pulls in the URL sometime this week.

This is great to hear, I actually asked them a few days ago about APIā€™s and they replied there wouldnā€™t be any shared! And as another poster said they just want you to pay for their cloud service is the only reason they havenā€™t opened it up Yet.

Basic functionality works great; camera thumbnail function isnā€™t working for me (opened an issue), but itā€™s probably just me doing something dumb.

@HITChris, @radiationnow, @djf_jeff, @swiftvic, @Corey_Maxim

Hey all, Iā€™ve just started looking into this as I own a Maximus light myself and want to integrate it with Home Assistant. To that end, Iā€™ve written and released v0.1.0 of pykuna: https://github.com/marthoc/pykuna.

Before I start working heavily on the Home Assistant integration, it would be helpful if interested people could test pykuna (especially those who have more than one device in their account). To do so:

git clone https://github.com/marthoc/pykuna
cd pykuna
git checkout debug
python3 -m venv .
source bin/activate
python debug.py USERNAME PASSWORD

The debug script will log into your account and dump the data for each camera in it. Copy and paste the output into a DM to me. The only ā€œsensitiveā€ data contained in the dump will be your cameraā€™s serial number, but (among other things) Iā€™m trying to figure out if we can determine device model type from the serial number since it doesnā€™t appear to be indicated in the API response otherwise. For each camera in the dump, please let me know what model it is (i.e. Maximus Smart Security Light, Toucan, etc.) so that I can see if there are variations in the API response between different models of camera.

Thanks!

Absolutely Iā€™ll give it a try tonight after dinner and report back to you! Thanks so much for getting this back up and running

@HITChris, @radiationnow, @djf_jeff, @swiftvic, @Corey_Maxim

Building on my initial work, Iā€™ve written a custom component for HA that starts to integrate Kuna cameras.

Iā€™ve made a couple of big assumptions about how the API works given that I only have one device and, accordingly, I only know how the Maximus Smart Security Light is modelled in the API. Iā€™m assuming the other Kuna devices work similarly but Iā€™d be happy to hear otherwise so that I can fix and update.

If you would like to test, please grab the release from GitHub: https://github.com/marthoc/kuna/releases. Installation and configuration instructions are in the README. Currently you should get a binary sensor (motion) and switch (control the cameraā€™s light bulb) for each camera in your account - support for an actual camera entity will follow soon, Iā€™m working on it.

Very exciting!

Itā€™d be really great to eventually be able to have events around recordings - one of the inconveniences of the Kuna is having to download the videos via the mobile app. Itā€™d be great to have thumbnails and videos automatically pulled and available for notifications.

I cloned the component and installed it. Havenā€™t had a chance to test the motion detection yet, but light toggling and status checking seems to work, with one caveat - upon initial restart with the component, the light status was shown as ā€˜onā€™ when it was actually off. Once I manually toggled it once, it seems to keep up just fine, even with light changes triggered from the Kuna app.

Edit: I noticed that the switch state wasnā€™t reflecting the actual state of the light (showed on when it was off), despite it having been several hours since the Kunaā€™s light turned off. I opened the Kuna app on my phone to verify that the Kuna app showed the correct results and at that time HAā€™s view of the switch status finally updated, even though I didnā€™t do anything other than open the Kuna app.

The API does seem a bit finickyā€¦ Iā€™ve also noticed that sometimes the API responses donā€™t reflect the actual state of the device, which isnā€™t a problem I can solve unfortunately (the component just reads the values that are there). I also think that sometimes a command from the app (like light toggling) makes the correct API call but for whatever reason even though the device reacts as it should, the API isnā€™t updated.

Since opening the app (without actually toggling anything) seems to cause the status to properly update again, Iā€™m guessing that if thereā€™s been no motion activity from the camera, and nobody triggers a connect from the app, then the servers stop tracking the deviceā€™s state. Perhaps thereā€™s a particular endpoint that triggers them to refresh the state.

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