Kuna Surveillance Camera Support

No problem! Glad to hear it’s working.

Does the download feature still work? I had it downloading some crazy file names that were actually videos when you manually put the .mp4 extension on them. I tried jlax47’s addition to the data_template with your suggestion of .mp4 appended and nothing. I have tried both with space after label as jlax47 shows and without the space as you suggest and nothing. Getting errors in system log.

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/aiohttp/connector.py”, line 955, in _create_direct_connection
traces=traces), loop=self._loop)
File “/usr/local/lib/python3.7/site-packages/aiohttp/connector.py”, line 825, in _resolve_host
self._resolver.resolve(host, port, family=self._family)
File “/usr/local/lib/python3.7/site-packages/aiohttp/resolver.py”, line 30, in resolve
host, port, type=socket.SOCK_STREAM, family=family)
File “uvloop/loop.pyx”, line 1464, in getaddrinfo
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/config/custom_components/kuna/init.py”, line 174, in update
await self.account.update()
File “/config/custom_components/kuna/pykuna/kuna.py”, line 48, in update
result = await self._request(“get”, CAMERAS_ENDPOINT)
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 959, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host server.kunasystems.com:443 ssl:None [Try again]

Ok, I’ll keep waiting for word on downloads. Any chance on getting the light dimmer exposed?

I’m using Hassio and have created the necessary custom_components folder, downloaded the files, and have added the necessary config lines, but am receiving the following errors:

2019-05-14 19:25:12 ERROR (MainThread) [homeassistant.setup] Error during setup of component kuna
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 151, in _async_setup_component
    hass, processed_config)
  File "/config/custom_components/kuna/__init__.py", line 69, in async_setup
    from pykuna import AuthenticationError, UnauthorizedError
ModuleNotFoundError: No module named 'pykuna'

Is there something obvious I’m missing?

Edit: Switching to the dev branch worked–thanks!

You have to be using the Dev (testing) Branch and mine wouldn’t authenticate until I enabled a 5GHz radio on my router. It doesn’t make sense, but that is what I experienced. Everything works except the downloads. I had those working but edits to try and make the file names make sense broke it and I can’t recover.

I was looking at purchasing one of these cameras, but was curious to know if you had to have a subscription with Kuna to be able to download your videos. I know with my Ring, a subscription is required. Thanks!

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.