Kuna Surveillance Camera Support


#1

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.


#2

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!


#3

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


#4

Don’t think so. I think Kuna is restrictive to their code for security purposes.


#5

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.


#6

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.


#7

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:


#8

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.


#9

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


#10

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.


#11

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


#12

@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!


#13

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


#14

@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.


#15

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.


#16

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.


#17

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.


#18

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?


#19

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:


#20

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