|
1 |
| -blinkpy |Build Status| |Coverage Status| |PyPi Version| |
2 |
| -=========================================================== |
| 1 | +blinkpy |Build Status| |Coverage Status| |Docs| |PyPi Version| |
| 2 | +================================================================ |
3 | 3 | A Python library for the Blink Camera system
|
4 | 4 | Only compatible with Python 3+
|
5 | 5 |
|
6 |
| -UPDATE (Dec. 29, 2017) |
7 |
| -====================== |
8 |
| -Work on this API has been halted indefinitely since Blink has seemed to cut off API access. Looks like it's time to cut losses and go with a different camera system that's more friendly to the DIY community. |
9 |
| - |
10 | 6 | Disclaimer:
|
11 | 7 | ~~~~~~~~~~~~~~~
|
12 | 8 | Published under the MIT license - See LICENSE file for more details.
|
@@ -42,105 +38,35 @@ This library was built with the intention of allowing easy communication with Bl
|
42 | 38 |
|
43 | 39 | Usage
|
44 | 40 | =========
|
45 |
| -In terms of usage, you just need to instantiate the module with a username and password |
| 41 | +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. |
46 | 42 |
|
47 | 43 | .. code:: python
|
48 | 44 |
|
49 | 45 | import blinkpy
|
50 | 46 | blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
|
| 47 | + blink.start() |
51 | 48 |
|
| 49 | +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. |
52 | 50 |
|
53 |
| -If you leave out either of those parameters, you need to call the login function which will prompt for your username and password |
54 |
| - |
55 |
| -.. code:: python |
56 |
| -
|
57 |
| - import blinkpy |
58 |
| - blink = blinkpy.Blink() |
59 |
| - blink.login() |
60 |
| -
|
61 |
| -
|
62 |
| -Once the login information is entered, you can run the `setup_system()` function which will attempt to authenticate with Blink servers using your username and password, obtain network ids, and create a list of cameras. |
63 | 51 | 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)
|
64 | 52 |
|
65 | 53 | .. code:: python
|
66 | 54 |
|
67 | 55 | import blinkpy
|
68 | 56 |
|
69 | 57 | blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
|
70 |
| - blink.setup_system() |
| 58 | + blink.start() |
71 | 59 |
|
72 | 60 | for name, camera in blink.cameras.items():
|
73 | 61 | print(name) # Name of the camera
|
74 |
| - print(camera.id) # Integer id of the camera (assigned by Blink) |
75 |
| - print(camera.armed) # Whether the device is armed/disarmed (ie. detecting motion) |
76 |
| - print(camera.clip) # Link to last motion clip captured |
77 |
| - print(camera.thumbnail) # Link to current camera thumbnail |
78 |
| - print(camera.temperature) # Current camera temperature (not super accurate, but might be useful for someone) |
79 |
| - print(camera.battery) # Current battery level... I think the value ranges from 0-3, but not quite sure yet. |
80 |
| - print(camera.battery_string) # Gives battery level as a string ("OK" or "Low"). Returns "Unknown" if value is... well, unknown |
81 |
| - print(camera.notifications) # Number of unread notifications (ie. motion alerts that haven't been viewed) |
82 |
| - print(camera.motion) # Dictionary containing values for keys ['video', 'image', 'time'] |
83 |
| - # which corresponds to last motion recorded, thumbnail of last motion, and timestamp of last motion |
84 |
| -
|
85 |
| -
|
86 |
| -Class Descriptions |
87 |
| -=================== |
88 |
| -.. code:: python |
89 |
| -
|
90 |
| - class Blink() |
91 |
| -
|
92 |
| -* ``Blink.cameras`` Returns a dictionary of ``BlinkCamera`` objects where the key corresponds to the camera name and the value is the actual BlinkCamera object. |
93 |
| -* ``Blink.network_id`` Returns the current network id. |
94 |
| -* ``Blink.account_id`` Returns the account id. |
95 |
| -* ``Blink.events`` Returns a list of events recorded by blink. This information will contain links to any motion caught by an armed camera.. |
96 |
| -* ``Blink.online`` Returns online status of sync module (True = online, False = offline). |
97 |
| -* ``Blink.last_motion()`` Finds last motion information for each camera and stores it in the ``BlinkCamera.motion`` field. |
98 |
| -* ``Blink.arm`` Set to True to arm, False to disarm. Can be used to see the status of the system as well. |
99 |
| -* ``Blink.refresh()`` Forces a refresh of all camera information. |
100 |
| -* ``Blink.get_summary()`` Returns json formatted summary of the system. |
101 |
| -* ``Blink.get_cameras()`` Finds all cameras in the system and creates ``BlinkCamera`` objects to represent them. |
102 |
| -* ``Blink.set_links()`` Gives each BlinkCamera object the links needed to find recent images and videos. |
103 |
| -* ``Blink.login()`` Prompts user for login information. |
104 |
| -* ``Blink.get_auth_token()`` Uses login information to retrieve authorization token from Blink for further communication. |
105 |
| -* ``Blink.get_ids()`` Retrieves the network_id and account_id from Blink in order to access video and image pages on their server. |
106 |
| -* ``Blink.setup_system()`` A wrapper script that calls: |
107 |
| -
|
| 62 | + print(camera.attributes) # Print available attributes of camera |
108 | 63 |
|
109 |
| -.. code:: python |
110 |
| -
|
111 |
| - Blink.get_auth_token() |
112 |
| - Blink.get_ids() |
113 |
| - Blink.get_camers() |
114 |
| - Blink.set_links() |
115 | 64 |
|
116 |
| -.. code:: python |
117 |
| -
|
118 |
| - class BlinkCamera(config, urls) |
119 |
| - |
120 |
| -The ``BlinkCamera`` class expects to receive: |
121 |
| -
|
122 |
| -* A dictionary ``config`` that contains the camera name, device id, armed status, thumbnail url, camera temperature, camery battery level, number of notifications, and region id |
123 |
| -* A ``BlinkURLHandler`` object that contains all the links necessary for communication. |
124 |
| - |
125 |
| - |
126 |
| -Ultimately, this class is just a wrapper for each individual camera in order to make communication with individual cameras less clunky. The following properties/methods are availiable (in addition to the ones mentioned earlier): |
127 |
| - |
128 |
| -* ``BlinkCamera.snap_picture()`` Takes an image with the camera and saves it as the new thumbnail. The ``Blink.refresh()`` method should be called after this if you want to store the new thumbnail link. |
129 |
| -* ``BlinkCamera.set_motion_detect(enable=True/False)`` Sending True to this function will enable motion detection for the camera. Setting to False will disable motion detection. |
130 |
| -* ``BlinkCamera.image_to_file(path)`` This will write the current thumbnail to the location indicated in 'path' |
131 |
| -* ``BlinkCamera.image_refresh()`` Refreshes the current thumbnail. |
132 |
| - |
133 |
| - |
134 |
| -.. code:: python |
135 |
| -
|
136 |
| - class BlinkURLHandler(region_id) |
137 |
| - |
138 |
| -The ``BlinkURLHandler`` class expects to be initialized with the region id found in the ``Blink.get_auth_token()`` function. The class will then create the necessary links required for various communication. |
139 |
| -
|
140 |
| -.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=master |
| 65 | +.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=dev |
141 | 66 | :target: https://travis-ci.org/fronzbot/blinkpy
|
142 |
| -.. |Coverage Status| image:: https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=master |
143 |
| - :target: https://coveralls.io/github/fronzbot/blinkpy?branch=master |
| 67 | +.. |Coverage Status| image:: https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=dev |
| 68 | + :target: https://coveralls.io/github/fronzbot/blinkpy?branch=dev |
144 | 69 | .. |PyPi Version| image:: https://img.shields.io/pypi/v/blinkpy.svg
|
145 | 70 | :target: https://pypi.python.org/pypi/blinkpy
|
146 |
| - |
| 71 | +.. |Docs| image:: https://readthedocs.org/projects/blinkpy/badge/?version=latest |
| 72 | + :target: http://blinkpy.readthedocs.io/en/latest/?badge=latest |
0 commit comments