This repository has been archived on 2024-05-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2018-10-17 11:18:29 -04:00
2018-10-18 12:23:23 -04:00
2018-10-18 12:23:23 -04:00
2017-03-11 23:21:26 -05:00
2018-10-18 12:23:23 -04:00
2018-05-09 10:02:58 -04:00
2018-10-16 15:43:02 -04:00
2017-03-20 13:22:12 -04:00
2018-10-16 16:24:39 -04:00
2017-03-12 18:45:52 -04:00
2018-08-09 09:37:57 -04:00
2018-09-26 13:02:48 -04:00
2018-09-27 16:13:19 -04:00
2018-10-16 15:41:12 -04:00

blinkpy |Build Status| |Coverage Status| |Docs|  |PyPi Version|
================================================================
A Python library for the Blink Camera system
Only compatible with Python 3+

Disclaimer:
~~~~~~~~~~~~~~~
Published under the MIT license - See LICENSE file for more details.

"Blink Wire-Free HS Home Monitoring & Alert Systems" is a trademark owned by Immedia Inc., see www.blinkforhome.com for more information.
I am in no way affiliated with Blink, nor Immedia Inc.

Original protocol hacking by MattTW : https://github.com/MattTW/BlinkMonitorProtocol

API calls faster than 60 seconds is not recommended as it can overwhelm Blink's servers.  Please use this module responsibly.

Installation
================
``pip3 install blinkpy``

Installing Development Version
==================================
To install the current development version, perform the following steps.  Note that the following will create a blinkpy directory in your home area:

.. code:: bash

    $ cd ~
    $ git clone https://github.com/fronzbot/blinkpy.git
    $ cd blinkpy
    $ rm -rf build dist
    $ python3 setup.py bdist_wheel
    $ pip3 install --upgrade dist/*.whl


Purpose
===========
This library was built with the intention of allowing easy communication with Blink camera systems, specifically so I can add a module into homeassistant https://home-assistant.io

Usage
=========
The simplest way to use this package from a terminal is to call ``Blink.start()`` which will prompt for your Blink username and password and then log you in.  Alternatively, you can instantiate the Blink class with a username and password, and call ``Blink.start()`` to login and setup without prompt, as shown below.  In addition, http requests are throttled internally via use of the ``Blink.refresh_rate`` variable, which can be set at initialization and defaults to 30 seconds.

.. code:: python

    from blinkpy import blinkpy
    blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD', refresh_rate=30)
    blink.start()

If you would like to log in without setting up the cameras or system, you can simply call the ``Blink.login()`` function which will prompt for a username and password and then authenticate with the server.  This is useful if you want to avoid use of the ``start()`` function which simply acts as a wrapper for more targeted API methods.

Cameras are instantiated as individual ``BlinkCamera`` classes within a ``BlinkSyncModule`` instance.  Note: currently the API only supports one sync module, but multiple sync modules are planned to be supported in the future.

The below code will display cameras and their available attributes:

.. code:: python

    from blinkpy import blinkpy

    blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
    blink.start()

    for name, camera in blink.sync.cameras.items():
        print(name)                   # Name of the camera
        print(camera.attributes)      # Print available attributes of camera

The most recent images and videos can be accessed as a bytes-object via internal variables.  These can be updated with calls to ``Blink.refresh()`` but will only make a request if motion has been detected or other changes have been found.  This can be overridden with the ``force_cache`` flag, but this should be used for debugging only since it overrides the internal request throttling.

.. code:: python
    
    camera = blink.sync.camera['SOME CAMERA NAME']
    blink.refresh(force_cache=True)  # force a cache update USE WITH CAUTION
    camera.image_from_cache.raw  # bytes-like image object (jpg)
    camera.video_from_cache.raw  # bytes-like video object (mp4)

The ``blinkpy`` api also allows for saving images and videos to a file and snapping a new picture from the camera remotely:

.. code:: python

    camera = blink.sync.camera['SOME CAMERA NAME']
    camera.snap_picture()       # Take a new picture with the camera
    blink.refresh()             # Get new information from server
    camera.image_to_file('/local/path/for/image.jpg')
    camera.video_to_file('/local/path/for/video.mp4')

.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=dev
   :target: https://travis-ci.org/fronzbot/blinkpy
.. |Coverage Status| image:: https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=dev
    :target: https://coveralls.io/github/fronzbot/blinkpy?branch=dev
.. |PyPi Version| image:: https://img.shields.io/pypi/v/blinkpy.svg
    :target: https://pypi.python.org/pypi/blinkpy
.. |Docs| image:: https://readthedocs.org/projects/blinkpy/badge/?version=latest
   :target: http://blinkpy.readthedocs.io/en/latest/?badge=latest
S
Description
No description provided
Readme
2.6 MiB
Languages
Python 99.3%
Shell 0.5%
Dockerfile 0.2%