Kuna Surveillance Camera Support

Not to download, no. But without a subscription they only save the last 2 hours of videos on their servers.

1 Like

@marthocoo Are we to be using the testing branch still? It looks like the master branch is fresher on github. And thanks for this.

Updated to 0.93.2 and the component always fails to load. The testing branch sometimes loaded correctly on 0.91.2 but it was intermittent. Here’s the error:

Sun May 26 2019 16:09:42 GMT-0500 (Central Daylight Time)
Error while authenticating Kuna:

Sun May 26 2019 16:09:42 GMT-0500 (Central Daylight Time)
Error during setup of component kuna
Traceback (most recent call last):
File “/config/custom_components/kuna/init.py”, line 194, in authenticate
raise err
File “/config/custom_components/kuna/init.py”, line 187, in authenticate
await self.account.authenticate()
File “/config/custom_components/kuna/pykuna/kuna.py”, line 34, in authenticate
result = await self._request(“post”, AUTH_ENDPOINT, json=json)
File “/config/custom_components/kuna/pykuna/kuna.py”, line 80, in _request
allow_redirects=allow_redirects,
File “/usr/local/lib/python3.7/site-packages/aiohttp/client.py”, line 1005, in aenter
self._resp = await self._coro
File “/usr/local/lib/python3.7/site-packages/aiohttp/client.py”, line 476, in _request
timeout=real_timeout
File “/usr/local/lib/python3.7/site-packages/aiohttp/connector.py”, line 522, in connect
proto = await self._create_connection(req, traces, timeout)
File “/usr/local/lib/python3.7/site-packages/aiohttp/connector.py”, line 854, in _create_connection
req, traces, timeout)
File “/usr/local/lib/python3.7/site-packages/aiohttp/connector.py”, line 974, in _create_direct_connection
req=req, client_error=client_error)
File “/usr/local/lib/python3.7/site-packages/aiohttp/connector.py”, line 924, in _wrap_create_connection
await self._loop.create_connection(*args, **kwargs))
File “uvloop/loop.pyx”, line 1894, in create_connection
File “uvloop/loop.pyx”, line 1883, in uvloop.loop.Loop.create_connection
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/setup.py”, line 153, in _async_setup_component
hass, processed_config)
File “/config/custom_components/kuna/init.py”, line 82, in async_setup
if not await kuna.authenticate():
File “/config/custom_components/kuna/init.py”, line 195, in authenticate
return False
File “/usr/local/lib/python3.7/site-packages/async_timeout/init.py”, line 55, in aexit
self._do_exit(exc_type)
File “/usr/local/lib/python3.7/site-packages/async_timeout/init.py”, line 92, in _do_exit
raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError

Just jumping back into this after an extended absence from dev work - what’s everyone’s current status with the component? I’ve recently upgraded to 0.94 and it’s working for me but I’m looking at some of the comments above and wondering.

I’ve merged the testing branch into master and released 7.2 so everyone should just be using the master branch now.

I’m still on the test branch, but I’ll try to update soon.

It has been working great overall. I’ve had a couple of cases where it wouldn’t connect and a restart fixed it…but that happens with several other things from time to time. I guess because of polling, I’ve also had a couple of times where it missed motion…like these Amazon drivers who drop and run. But those are minor nits.

Also, I couldn’t find a “viewer” that integrated with hass that I liked, so I wrote a custom panel to do it. If there’s any interest, I could bundle this up for others to use (though support would be hit or miss). Here’s a screenshot:

2 Likes

I posted my panel here:

I’m back in the master branch and everything is working fine except the downloads don’t have an extension so when viewing the files over Samba share, my MAC thinks they are unix executables.

@mcfarlde Can you show me the automation you are using to trigger the download? I can suggest a couple of ways to add the extension.

I thought I copied it out of the readme but cannot find it there. It is:

- id: '1561299243927'
  alias: Download Kuna recordings
  trigger:
    platform: event
    event_type: kuna_event
    event_data:
      category: recording
  action:
    service: downloader.download_file
    data_template:
      url: '{{ trigger.event.data.url }}'

When I edit the last line to:

url: '{{ trigger.event.data.url }}.mp4'

the downloads stop.

Try this:

- id: '1561299243927'
  alias: Download Kuna recordings
  trigger:
    platform: event
    event_type: kuna_event
    event_data:
      category: recording
  action:
    service: downloader.download_file
    data_template:
      url: '{{ trigger.event.data.url }}'
      filename: '{{ trigger.event.data.label }}.mp4'

Adding the filename parameter to the downloader service will get you mp4 files. Not sure why it isn’t working without it!

Works great! Now to figure out how to manage the amount of storage used.

Did you see this? Loading Met.no via platform config is deprecated

Today I got motion notifications on my phone app from Kuna, but when I go to log in, it had logged me out. I re-logged in, but it says my password is bad. I also tried from their website on the computer, but same story. I had my password saved on Google Chrome, so I know everything was logged correctly.
Perhaps their servers are down? Anybody else with issues today?

I did have the same problem, but all seems well today.

I’m also wondering if this will be migrated to the HACS component.

Also will there be any chance we could get access to the built in speaker? Even better yet if we could use it as a media player (a al Alexa type) I could find that extremely useful for sure.

This is the first I’ve heard of HACS - I’ll look into it!

As for the speaker, I haven’t had a chance to sit down with the camera and experiment. So it’s not a no, not possible, but I probably won’t get to it any time soon. PR’s welcome!

Thanks for your time and work on this! I’ll patiently wait for possible speaker support in the future. I hope one day I can learn how to help more!

Just released a major update to this custom component: v8. This version transitions this component away from configuration.yaml and to using config entries configured via the Configuration/Integrations menu. Because this is a major update, I suggest you completely delete the custom_components/kuna directory and re-clone from GitHub.

NOTE: v8 requires Home Assistant 0.96.0 or greater as this is the minimum version that supports custom integrations. If you are on HASS < 0.96.0, stay on v7.2 of this custom component.

Assuming all works as it should, the next step is PR’ing this component into Home Assistant as an official integration!

After installing and restarting Home Assistant, you will notice that your entities will be gone - not to worry. Configure the integration from Configuration/Integrations, and your entities will return with any customization you’ve given them (i.e. name, entity id).

Please let me know any issues here or on GitHub!

1 Like

I made the update on two devices and everything went smoothly. I did as you suggested and removed the directory and re-cloned it (I also deleted the pycache folder as well to be safe).

I was going to suggest adding this to HACS (the community store) but obviously PR’ing it as a first class citizen would be better.

Thanks again for your work on this. It’s fantastic.

Did you manage to get it working?

yep! the problem was on my end. Power went out at home, and cameras were off line.
the add-on works great via the integrations feature. thanks again.