308 lines
14 KiB
HTML
308 lines
14 KiB
HTML
|
||
|
||
<!DOCTYPE html>
|
||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||
<head>
|
||
<meta charset="utf-8">
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
<title>blinkpy — blinkpy 0.7.0 documentation</title>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="index" title="Index"
|
||
href="genindex.html"/>
|
||
<link rel="search" title="Search" href="search.html"/>
|
||
<link rel="top" title="blinkpy 0.7.0 documentation" href="index.html"/>
|
||
<link rel="next" title="blinkpy.blinkpy" href="api/blinkpy.html"/>
|
||
<link rel="prev" title="Welcome to blinkpy’s documentation!" href="index.html"/>
|
||
|
||
|
||
<script src="_static/js/modernizr.min.js"></script>
|
||
|
||
</head>
|
||
|
||
<body class="wy-body-for-nav" role="document">
|
||
|
||
|
||
<div class="wy-grid-for-nav">
|
||
|
||
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||
<div class="wy-side-scroll">
|
||
<div class="wy-side-nav-search">
|
||
|
||
|
||
|
||
<a href="index.html" class="icon icon-home"> blinkpy
|
||
|
||
|
||
|
||
</a>
|
||
|
||
|
||
|
||
|
||
<div class="version">
|
||
0.7.0
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div role="search">
|
||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
||
<input type="text" name="q" placeholder="Search docs" />
|
||
<input type="hidden" name="check_keywords" value="yes" />
|
||
<input type="hidden" name="area" value="default" />
|
||
</form>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1 current"><a class="current reference internal" href="#">blinkpy </a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="#disclaimer">Disclaimer:</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="#installing-development-version">Installing Development Version</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="#purpose">Purpose</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="#usage">Usage</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="api/blinkpy.html"><code class="docutils literal"><span class="pre">blinkpy.blinkpy</span></code></a></li>
|
||
</ul>
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||
|
||
|
||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||
|
||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
<a href="index.html">blinkpy</a>
|
||
|
||
</nav>
|
||
|
||
|
||
|
||
<div class="wy-nav-content">
|
||
<div class="rst-content">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||
|
||
<ul class="wy-breadcrumbs">
|
||
|
||
<li><a href="index.html">Docs</a> »</li>
|
||
|
||
<li>blinkpy </li>
|
||
|
||
|
||
<li class="wy-breadcrumbs-aside">
|
||
|
||
|
||
<a href="_sources/README.rst.txt" rel="nofollow"> View page source</a>
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
|
||
<hr/>
|
||
</div>
|
||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||
<div itemprop="articleBody">
|
||
|
||
<div class="section" id="blinkpy-build-status-coverage-status-pypi-version">
|
||
<h1>blinkpy <a class="reference external" href="https://travis-ci.org/fronzbot/blinkpy"><img alt="Build Status" src="https://travis-ci.org/fronzbot/blinkpy.svg?branch=dev" /></a> <a class="reference external" href="https://coveralls.io/github/fronzbot/blinkpy?branch=dev"><img alt="Coverage Status" src="https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=dev" /></a> <a class="reference external" href="https://pypi.python.org/pypi/blinkpy"><img alt="PyPi Version" src="https://img.shields.io/pypi/v/blinkpy.svg" /></a><a class="headerlink" href="#blinkpy-build-status-coverage-status-pypi-version" title="Permalink to this headline">¶</a></h1>
|
||
<p>A Python library for the Blink Camera system
|
||
Only compatible with Python 3+</p>
|
||
<div class="section" id="disclaimer">
|
||
<h2>Disclaimer:<a class="headerlink" href="#disclaimer" title="Permalink to this headline">¶</a></h2>
|
||
<p>Published under the MIT license - See LICENSE file for more details.</p>
|
||
<p>“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.</p>
|
||
<p>Original protocol hacking by MattTW : <a class="reference external" href="https://github.com/MattTW/BlinkMonitorProtocol">https://github.com/MattTW/BlinkMonitorProtocol</a></p>
|
||
<p>API calls faster than 60 seconds is not recommended as it can overwhelm Blink’s servers. Please use this module responsibly.</p>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="installation">
|
||
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
|
||
<p><code class="docutils literal"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">blinkpy</span></code></p>
|
||
</div>
|
||
<div class="section" id="installing-development-version">
|
||
<h1>Installing Development Version<a class="headerlink" href="#installing-development-version" title="Permalink to this headline">¶</a></h1>
|
||
<p>To install the current development version, perform the following steps. Note that the following will create a blinkpy directory in your home area:</p>
|
||
<div class="code bash highlight-default"><div class="highlight"><pre><span></span>$ 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
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="purpose">
|
||
<h1>Purpose<a class="headerlink" href="#purpose" title="Permalink to this headline">¶</a></h1>
|
||
<p>This library was built with the intention of allowing easy communication with Blink camera systems, specifically so I can add a module into homeassistant <a class="reference external" href="https://home-assistant.io">https://home-assistant.io</a></p>
|
||
</div>
|
||
<div class="section" id="usage">
|
||
<h1>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h1>
|
||
<p>In terms of usage, you just need to instantiate the module with a username and password and call the <code class="docutils literal"><span class="pre">setup_system()</span></code> method.</p>
|
||
<div class="code python highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">blinkpy</span>
|
||
<span class="n">blink</span> <span class="o">=</span> <span class="n">blinkpy</span><span class="o">.</span><span class="n">Blink</span><span class="p">(</span><span class="n">username</span><span class="o">=</span><span class="s1">'YOUR USER NAME'</span><span class="p">,</span> <span class="n">password</span><span class="o">=</span><span class="s1">'YOUR PASSWORD'</span><span class="p">)</span>
|
||
<span class="n">blink</span><span class="o">.</span><span class="n">setup_system</span><span class="p">()</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>If you leave out either of those parameters, you need to call the login function which will prompt for your username and password</p>
|
||
<div class="code python highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">blinkpy</span>
|
||
<span class="n">blink</span> <span class="o">=</span> <span class="n">blinkpy</span><span class="o">.</span><span class="n">Blink</span><span class="p">()</span>
|
||
<span class="n">blink</span><span class="o">.</span><span class="n">login</span><span class="p">()</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Once the login information is entered, you can run the <cite>setup_system()</cite> function which will attempt to authenticate with Blink servers using your username and password, obtain network ids, and create a list of cameras.
|
||
The cameras are of a BlinkCamera class, of which the following parameters can be used (the code below creates a Blink object and iterates through each camera found)</p>
|
||
<div class="code python highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">blinkpy</span>
|
||
|
||
<span class="n">blink</span> <span class="o">=</span> <span class="n">blinkpy</span><span class="o">.</span><span class="n">Blink</span><span class="p">(</span><span class="n">username</span><span class="o">=</span><span class="s1">'YOUR USER NAME'</span><span class="p">,</span> <span class="n">password</span><span class="o">=</span><span class="s1">'YOUR PASSWORD'</span><span class="p">)</span>
|
||
<span class="n">blink</span><span class="o">.</span><span class="n">setup_system</span><span class="p">()</span>
|
||
|
||
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">camera</span> <span class="ow">in</span> <span class="n">blink</span><span class="o">.</span><span class="n">cameras</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="c1"># Name of the camera</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="c1"># Integer id of the camera (assigned by Blink)</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">armed</span><span class="p">)</span> <span class="c1"># Whether the device is armed/disarmed (ie. detecting motion)</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">clip</span><span class="p">)</span> <span class="c1"># Link to last motion clip captured</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">thumbnail</span><span class="p">)</span> <span class="c1"># Link to current camera thumbnail</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">temperature</span><span class="p">)</span> <span class="c1"># Current camera temperature (not super accurate, but might be useful for someone)</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">battery</span><span class="p">)</span> <span class="c1"># Current battery level... I think the value ranges from 0-3, but not quite sure yet.</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">battery_string</span><span class="p">)</span> <span class="c1"># Gives battery level as a string ("OK" or "Low"). Returns "Unknown" if value is... well, unknown</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">camera</span><span class="o">.</span><span class="n">notifications</span><span class="p">)</span> <span class="c1"># Number of unread notifications (ie. motion alerts that haven't been viewed)</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
<div class="articleComments">
|
||
|
||
</div>
|
||
</div>
|
||
<footer>
|
||
|
||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||
|
||
<a href="api/blinkpy.html" class="btn btn-neutral float-right" title="blinkpy.blinkpy" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||
|
||
|
||
<a href="index.html" class="btn btn-neutral" title="Welcome to blinkpy’s documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||
|
||
</div>
|
||
|
||
|
||
<hr/>
|
||
|
||
<div role="contentinfo">
|
||
<p>
|
||
© Copyright 2018, Kevin Fronczak.
|
||
|
||
</p>
|
||
</div>
|
||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||
|
||
</footer>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</section>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
var DOCUMENTATION_OPTIONS = {
|
||
URL_ROOT:'./',
|
||
VERSION:'0.7.0',
|
||
COLLAPSE_INDEX:false,
|
||
FILE_SUFFIX:'.html',
|
||
HAS_SOURCE: true,
|
||
SOURCELINK_SUFFIX: '.txt'
|
||
};
|
||
</script>
|
||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript" src="_static/js/theme.js"></script>
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
jQuery(function () {
|
||
SphinxRtdTheme.StickyNav.enable();
|
||
});
|
||
</script>
|
||
|
||
|
||
</body>
|
||
</html> |