Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
… into history2
  • Loading branch information
ChristianKuehnel committed Apr 26, 2018
2 parents e0e0845 + 137d61f commit 79fd001
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ matrix:
include:
- python: "2.7"
env: TOXENV=py27
- python: "3.4.2"
- python: "3.4"
env: TOXENV=py34
- python: "3.5"
env: TOXENV=py35
Expand Down
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,24 @@ Xiaomi Mi Flora plant sensor.
## Backends
As there is unfortunately no universally working Bluetooth Low Energy library for Python, the project currently
offers support for two Bluetooth implementations:
* bluez tools (via a wrapper around gatttool)

* bluepy library
* bluez tools (via a wrapper around gatttool)
* pygatt library


### bluepy
To use the [bluepy](https://github.com/IanHarvey/bluepy) library you have to install it on your machine, in most cases this can be done via:
```pip3 install bluepy```

Example to use the bluepy backend:
```python
from miflora.miflora_poller import MiFloraPoller
from btlewrap.bluepy import BluepyBackend

poller = MiFloraPoller('some mac address', BluepyBackend)
```
This is the backend library to be used.

### bluez/gatttool wrapper
To use the bluez wrapper, you need to install the bluez tools on your machine. No additional python
Expand All @@ -38,22 +54,13 @@ binaray available on your machine.
Example to use the bluez/gatttool wrapper:
```python
from miflora.miflora_poller import MiFloraPoller
from miflora.backends.gatttool import GatttoolBackend
from btlewrap.gatttool import GatttoolBackend

poller = MiFloraPoller('some mac address', GatttoolBackend)
```

### bluepy
To use the [bluepy](https://github.com/IanHarvey/bluepy) library you have to install it on your machine, in most cases this can be done via:
```pip3 install bluepy```

Example to use the bluepy backend:
```python
from miflora.miflora_poller import MiFloraPoller
from miflora.backends.bluepy import BluepyBackend

poller = MiFloraPoller('some mac address', BluepyBackend)
```
This backend should only be used, if your platform is not supported by bluepy.
Note: gatttool is depracated in many Linux distributions.

### pygatt
If you have a Blue Giga based device that is supported by [pygatt](https://github.com/peplin/pygatt), you have to
Expand All @@ -63,16 +70,18 @@ install the bluepy library on your machine. In most cases this can be done via:
Example to use the pygatt backend:
```python
from miflora.miflora_poller import MiFloraPoller
from miflora.backends.pygatt import PygattBackend
from btlewrap.pygatt import PygattBackend

poller = MiFloraPoller('some mac address', PygattBackend)
```
# Dependencies
miflora depends on the [btlewrap](https://github.com/ChristianKuehnel/btlewrap) library. If you install miflora via PIP btlewrap will automatically be installed. If not, you will have to install btlewrap manually:

```pip3 install btlewrap```

## Conttributing
please have a look at [CONTRIBUTING.md](CONTRIBUTING.md)

----

## Projects Depending on `miflora`

The following shows a selected list of projects using this library:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bluepy==1.1.4
pygatt==3.2.0
btlewrap==0.0.1
btlewrap==0.0.2
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
"""Python package description."""
import os
from setuptools import setup, find_packages


def readme():
"""Load the readme file."""
readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
with open(readme_path, 'r') as readme_file:
return readme_file.read()


setup(
name='miflora',
version='0.3',
version='0.4',
description='Library to read data from Mi Flora sensor',
long_description=readme(),
long_description_content_type='text/markdown',
url='https://github.com/open-homeautomation/miflora',
author='Daniel Matuschek',
author_email='daniel@matuschek.net',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: System :: Hardware :: Hardware Drivers',
'License :: OSI Approved :: MIT License',
Expand All @@ -21,6 +32,6 @@
packages=find_packages(),
keywords='plant sensor bluetooth low-energy ble',
zip_safe=False,
install_requires=['btlewrap==0.0.1'],
install_requires=['btlewrap==0.0.2'],
extras_require={'testing': ['pytest']}
)

0 comments on commit 79fd001

Please sign in to comment.