Skip to main content

Python3 library for interacting with the Kuna camera mobile API

Project description

pykuna

Python3 library for interacting with the Kuna camera mobile API

Requirements: python3, requests

Install pykuna with python3 -m pip install pykuna.

Usage

pykuna's main class is KunaAPI. Create an API object, and authenticate it, like this:

import pykuna

kuna = pykuna.KunaAPI(USERNAME, PASSWORD)

Where:

  • USERNAME is the email address you use for the Kuna app; and,
  • PASSWORD is your password for the Kuna app.

After authenticating, populate a list of all cameras in the Kuna account by calling the update() method on the API object:

kuna.update()

Methods

The following methods are available on a camera device object returned by get_cameras():

  • update() - refresh device properties from the API.
  • get_thumbnail() - returns a camera snapshot as a jpeg image.
  • set_property(property=state) - sets a property of the device. Properties currently settable via pykuna are:
    • bulb_on (boolean) - set the lightbulb on (true) or off (false)
    • led_mask (boolean) - set the status led on the device on (true) or off (false)
    • notifications_enabled (boolean) - set notifications for the device on (true) or off (false)
    • volume (int) - set the speaker volume of the device (minimum 0, maximum 100)
  • light_on() - turn on the camera's light bulb
  • light_off() - turn off the camera's light bulb

example.py

An example script is provided to demonstrate the usage of pykuna; it prints a list of cameras associated with the Kuna account, retrieves a snapshot from each camera, and toggles the camera's light bulb.

python example.py USERNAME PASSWORD

Caveats

pykuna interacts with Kuna's (private) mobile device API, which could change at any time. And, without official documentation or terms of service, there's no way to know what type or rate of usage may result in your account being banned by Kuna. Use carefully!

pykuna is synchronous.

pykuna was inspired by the investigative work of @loghound: https://github.com/loghound/kuna-camera-api, but does not yet implement all known endpoints; this project is primarily intended to interface Home Assistant with the Kuna API, and will be further developed with that goal in mind.

pykuna implements no request timeouts.

pykuna will hit v1.0.0 when it's ready for Home Assistant. Until then, pykuna's API may change at any time!

Contributing

Please open issues or pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pykuna-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file pykuna-0.1.0.tar.gz.

File metadata

  • Download URL: pykuna-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for pykuna-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0b6714c7415ed58d3327c9c7bd409b208d5190f2a53e2bf276ba23ad30a2c449
MD5 550e63946b7bb1ca067dad2ead9d909e
BLAKE2b-256 07408aa2b26420fd64a874567a35ec339b004be42bd3e5b9e30608c9fef10d9d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page