8000 Merge to master by antohaUa · Pull Request #1 · blynkkk/lib-python · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Merge to master #1

Merged
merged 32 commits into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
eb8cc90
Added initial raw base of python lib
antohaUa Feb 11, 2019
f9bf043
Added protocol error handling
antohaUa Feb 12, 2019
dc11b18
Small changes to decrease get time operations
Feb 13, 2019
5168563
Added license and copyright
antohaUa Feb 13, 2019
a29c4fb
Added virtual_pin_sync and socket timeout
antohaUa Feb 13, 2019
1fb6dc4
Added 'handle_event' decorator support
antohaUa Feb 14, 2019
358d30d
First working examples with docs
antohaUa Feb 15, 2019
817ddfc
Added flow schema to examples
antohaUa Feb 16, 2019
a80da43
Added flow schema to examples
antohaUa Feb 16, 2019
a8604e1
added on_connect/on_disconnect events and example; changed module nam…
antohaUa Feb 17, 2019
a2ff69a
Added email call and example for it.
antohaUa Feb 17, 2019
eb382cb
raw items adding for micropython support
Feb 20, 2019
01716fb
Additions for micropython compatibility
antohaUa Feb 20, 2019
12322cd
Added set_property and notify
antohaUa Feb 21, 2019
66a0f70
Corrections for p2/micropython compatibility; terminal raw example
Feb 22, 2019
2686b9f
Docs placed to separate file
antohaUa Feb 23, 2019
f84f246
Terminal example completed
antohaUa Feb 24, 2019
ef86115
small corrections for print strings
Feb 25, 2019
5f0b35f
Weather station PI3b+ example
antohaUa Feb 25, 2019
ec735c7
added how-to description for weather example
Feb 26, 2019
e91597b
Added heartbeat and max_cmd_buffer to init
antohaUa Feb 26, 2019
84877df
refactoring and optimization
Feb 27, 2019
e11189d
esp32 compatibility
antohaUa Feb 27, 2019
a582aab
Added touch button esp32 test
antohaUa Feb 28, 2019
30bbddc
code compressing
Mar 1, 2019
fb7b237
Started to write project doc
antohaUa Mar 1, 2019
5abd6a0
Added local installer and tester
antohaUa Mar 2, 2019
d3af19f
Added Project documentation
antohaUa Mar 2, 2019
ee5c34a
Added esp32 documentation
antohaUa Mar 3, 2019
b1e0db4
Corrections after review
antohaUa Mar 3, 2019
0ef2327
Added tweet call and test
Mar 4, 2019
e02fee0
Create package create preparations
antohaUa Mar 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions LICENSE
8000
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2019 Anton Morozenko
Copyright (c) 2015-2019 Volodymyr Shymanskyy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
115 changes: 113 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,113 @@
# lib-python
Blynk Library for Python
# Blynk Python Library
Blynk Python/Micropython Library

## What is Blynk?
**[Blynk][blynk-io]** provides **iOS** and **Android** apps to control any hardware **over the Internet** or **directly using Bluetooth**.
You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets, **right on your smartphone**.
Blynk is **the most popular IoT platform** used by design studios, makers, educators, and equipment vendors all over the world.

![Blynk Banner][blynk-banner]

## Download

**Blynk App:
[<img src="https://cdn.rawgit.com/simple-icons/simple-icons/develop/icons/googleplay.svg" width="18" height="18" /> Google Play][blynk-app-android] |
[<img src="https://cdn.rawgit.com/simple-icons/simple-icons/develop/icons/apple.svg" width="18" height="18" /> App Store][blynk-app-ios]**

Optionally: **[Blynk Server][blynk-server]**. Public Blynk Cloud is free for anyone who is using Blynk for personal (non-commercial) purposes.

![Blynk Architecture][blynk-architecture]

## Installation

#### Installation via Python pip
sudo pip install blynklib


#### Manual installation
git clone https://github.com/blynkkk/lib-python.git
cd lib-python
pip install --user -e .

# sudo pip install -e . # if installation needed not for current but for all users

#### Testing
You can run unit tests using the command:

python setup.py test

## Features
Library allows to communicate with public or custom [Blynk Server][blynk-server].

Supports Python2/Python3/Micropython.

HW support of RaspberryPi/ESP32

##### List of available operations:
- connect/disconnect events subscribe
- read/write [virtual pins][blynk-vpins] events subscribe
- [virtual pin][blynk-vpins] write
- [virtual pin][blynk-vpins] sync
- internal app notifications
- email notifications
- set widget property


## [Quickstart][blynk-docs]
Install Blynk python library
Download Blynk App ([GooglePlay][blynk-app-android] | [Apple][blynk-app-ios]) and register within it.
During registration personal auth token will be provided. Use this token within your python scripts to pass
[public][blynk-server-public] or [custom][blynk-server] Blynk server authentification.

#### Usage example
```py
import blynklib

BLYNK_AUTH = '<YourAuthToken>'
blynk = blynklib.Blynk(BLYNK_AUTH)

# register handler for virtual pin V11 reading
# for example when some Blynk App widget asks virtual pin data from server periodically
@blynk.handle_event('read V11')
def read_virtual_pin_handler(pin):

# user code for this event goes here
# ...
# Example: calculate, get sensor values, current time etc

# update current virtual pin value on server
blynk.virtual_write(pin, <USER_CALCULATED_VALUE>)
# or any other pin if needed
# blynk.virtual_write(24, '<ANY_OTHER_USER_CALCULATED_VALUE>')

# actions if calculated value become CRITICAL
if <USER_CALCULATED_VALUE> >= <USER_DEFINED_CRITICAL_VALUE>
# set red color for widget that performs periodical virtual pin read operations
blynk.set_property(pin, 'color', '#FF0000')
# send internal notification to Blynk App and notification to defined e-mail
blynk.notify('Warning critical value')
blynk.email(<Your e-mail>, 'Device alarm', 'Critical value!')

# main loop that starts program and handles registered events
while True:
blynk.run()
```

Examine more **[examples][blynk-py-examples]** to be familiar with basic features usage.


### License
This project is released under The MIT License (MIT)



[blynk-io]: https://github.com/blynkkk/blynkkk.github.io
[blynk-architecture]: https://github.com/blynkkk/blynkkk.github.io/blob/master/images/architecture.png
[blynk-banner]: https://github.com/blynkkk/blynkkk.github.io/blob/master/images/GithubBanner.jpg
[blynk-server]: https://github.com/blynkkk/blynk-server
[blynk-server-public]: http://blynk-cloud.com
[blynk-docs]: https://docs.blynk.cc/
[blynk-py-examples]: https://github.com/blynkkk/lib-python/blob/master/examples
[blynk-app-android]: https://play.google.com/store/apps/details?id=cc.blynk
[blynk-app-ios]: https://itunes.apple.com/us/app/blynk-control-arduino-raspberry/id808760481?ls=1&mt=8
[blynk-vpins]: http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/what-is-virtual-pins
Loading
0