Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check-manifest, check for pypi-description, flake8-docstrings #575

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repos:
rev: v2.3.0
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
Expand All @@ -25,3 +26,8 @@ repos:
# hooks:
# - id: mypy
# args: [--no-strict-optional, --ignore-missing-imports]

- repo: https://github.com/mgedmin/check-manifest
rev: "0.40"
hooks:
- id: check-manifest
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ steps:
- script: |
pytest --cov miio --cov-report html
displayName: 'Tests'

- script: |
pre-commit run check-manifest --all-files
displayName: 'Check MANIFEST.in'
85 changes: 85 additions & 0 deletions docs/yeelight.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Yeelight
========

.. NOTE::

Only basic support for controlling Yeelight lights is implemented at the moment.

You will likely want to use `python-yeelight <https://gitlab.com/stavros/python-yeelight>`_
for controlling your lights.


Currently supported features:

- Querying the status.
- Turning on and off.
- Changing brightness, colors (RGB and HSV), color temperature.
- Changing internal settings (developer mode, saving settings on change)


Use ``miiocli yeelight --help``
for help on available commands and their parameters.

To extract the token from a backup of the official Yeelight app, refer to :ref:`yeelight_token_extraction`.

.. _yeelight_token_extraction:

Token extraction
----------------

In order to extract tokens from the Yeelight Android app,
you need to create a backup like shown below.

.. code-block:: bash

adb backup -noapk com.yeelight.cherry -f backup.ab

If everything went fine and you got a ``backup.ab`` file,
from which you can extract the tokens with ``miio-extract-tokens`` as described in :ref:`token_extraction`.

.. code-block:: bash

miio-extract-tokens /tmp/yeelight.ab --password a

Unable to find miio database file apps/com.xiaomi.smarthome/db/miio2.db: "filename 'apps/com.xiaomi.smarthome/db/miio2.db' not found"
INFO:miio.extract_tokens:Trying to read apps/com.yeelight.cherry/sp/miot.xml
INFO:miio.extract_tokens:Reading tokens from Yeelight Android DB
Yeelight Color Bulb
Model: yeelink.light.color1
IP address: 192.168.xx.xx
Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAC: F0:B4:29:xx:xx:xx
Mi Bedside Lamp
Model: yeelink.light.bslamp1
IP address: 192.168.xx.xx
Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAC: 7C:49:EB:xx:xx:xx


Usage examples
--------------

Status reporting
~~~~~~~~~~~~~~~~

::

$ miiocli yeelight --ip 192.168.xx.xx --token xxxx status
Name:
Power: False
Brightness: 39
Color mode: 1
RGB: (255, 152, 0)
HSV: None
Temperature: None
Developer mode: True
Update default on change: True


.. NOTE::

If you find a new command please let us know by creating a pull request
or an issue, if you do not want to implement it on your own!


:py:class:`API <miio.yeelight>`
18 changes: 17 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist=py35,py36,py37,flake8,docs
envlist=py35,py36,py37,flake8,docs,manifest,pypi-description

[tox:travis]
3.5 = py35
Expand Down Expand Up @@ -85,3 +85,19 @@ omit =
[coverage:report]
exclude_lines =
def __repr__

[testenv:pypi-description]
basepython = python3.7
skip_install = true
deps =
twine
pip >= 18.0.0
commands =
pip wheel -w {envtmpdir}/build --no-deps .
twine check {envtmpdir}/build/*

[testenv:manifest]
basepython = python3.7
deps = check-manifest
skip_install = true
commands = check-manifest