Skip to content

Commit

Permalink
Rename the project to python-miio
Browse files Browse the repository at this point in the history
This commit renames the project to its new name, python-miio.
The name of the package has been changed to 'miio',
although the old 'mirobo' is still available for backwards compatibility.

Anyone trying to access and use the 'mirobo' package will be welcomed
by a deprecation warning, although there are no plans to break the API currently.

README.md got also updated to links for other home-assistant integrations available.
  • Loading branch information
rytilahti committed Oct 2, 2017
1 parent 5d0f7bb commit 0089c22
Show file tree
Hide file tree
Showing 29 changed files with 128 additions and 116 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Python-mirobo
# Python-miio

[![PyPI version](https://badge.fury.io/py/python-mirobo.svg)](https://badge.fury.io/py/python-mirobo)
[![Build Status](https://travis-ci.org/rytilahti/python-mirobo.svg?branch=0.2.0)](https://travis-ci.org/rytilahti/python-mirobo)
[![Code Health](https://landscape.io/github/rytilahti/python-mirobo/master/landscape.svg?style=flat)](https://landscape.io/github/rytilahti/python-mirobo/master)
[![Coverage Status](https://coveralls.io/repos/github/rytilahti/python-mirobo/badge.svg?branch=master)](https://coveralls.io/github/rytilahti/python-mirobo?branch=master)
[![PyPI version](https://badge.fury.io/py/python-miio.svg)](https://badge.fury.io/py/python-miio)
[![Build Status](https://travis-ci.org/rytilahti/python-miio.svg?branch=0.2.0)](https://travis-ci.org/rytilahti/python-miio)
[![Code Health](https://landscape.io/github/rytilahti/python-miio/master/landscape.svg?style=flat)](https://landscape.io/github/rytilahti/python-miio/master)
[![Coverage Status](https://coveralls.io/repos/github/rytilahti/python-miio/badge.svg?branch=master)](https://coveralls.io/github/rytilahti/python-miio?branch=master)

This project was started to allow controlling locally available Xiaomi Vacuum cleaner robot with Python (hence the name),
This project was started to allow controlling locally available Xiaomi Vacuum cleaner robot with Python (hence the old name, *python-mirobo*),
however, thanks to contributors it has been extended to allow controlling other Xiaomi devices using the same protocol.

**The project has now been renamed to *python-miio*. The *mirobo* python package (as well as the console tool with the same name) are still available,
although users of the library are encouraged to start using the *miio* name in their tools.
The console tools (and the API) are expected to stay backwards-compatible for the near future.**

Thanks for the nice people over [ioBroker forum](http://forum.iobroker.net/viewtopic.php?f=23&t=4898) who figured out the encryption to make this possible.
[Information about the underlying communication protocol](https://github.com/OpenMiHome/mihome-binary-protocol) ([another source for vacuum-specific documentation](https://github.com/marcelrv/XiaomiRobotVacuumProtocol))

Expand Down Expand Up @@ -38,7 +42,7 @@ The [miio javascript library](https://github.com/aholstenson/miio) contains some
Please make sure you have libffi and openssl headers installed, you can do this on Debian-based systems (like Rasperry Pi) with ```apt-get install libffi-dev libssl-dev```.
Also do note that the setuptools version is too old for installing some requirements, so before trying to install this package you should update the setuptools with ```pip3 install -U setuptools```.

The easiest way to install the package is to use pip: ```pip3 install python-mirobo``` . [Using virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) is recommended.
The easiest way to install the package is to use pip: ```pip3 install python-miio``` . [Using virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) is recommended.

In case you get an error similar like ```ImportError: No module named 'packaging'``` during the installation,
you need to upgrade pip and setuptools:
Expand Down Expand Up @@ -279,4 +283,7 @@ Clean #1: 2017-03-05 16:17:52-2017-03-05 17:14:59 (complete: False, unknown: 0)

## Home Assistant support

See [Xiaomi Mi Robot Vacuum](https://home-assistant.io/components/vacuum.xiaomi/).
* [Xiaomi Mi Robot Vacuum](https://home-assistant.io/components/vacuum.xiaomi_miio/)
* [Xiaomi Philips Light](https://home-assistant.io/components/light.xiaomi_miio/)
* [Xiaomi Mi Air Purifier](https://github.com/syssi/xiaomi_airpurifier)
* [Xiaomi WiFi Plug](https://github.com/syssi/xiaomiplug)
17 changes: 17 additions & 0 deletions miio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# flake8: noqa
from miio.protocol import Message, Utils
from miio.vacuumcontainers import (VacuumStatus, ConsumableStatus,
CleaningDetails, CleaningSummary, Timer)
from miio.vacuum import Vacuum, VacuumException
from miio.plug import Plug
from miio.plug_v1 import PlugV1
from miio.airpurifier import AirPurifier
from miio.airhumidifier import AirHumidifier
from miio.waterpurifier import WaterPurifier
from miio.strip import Strip
from miio.ceil import Ceil
from miio.philips_eyecare import PhilipsEyecare
from miio.chuangmi_ir import ChuangmiIr
from miio.fan import Fan
from miio.device import Device, DeviceException
from miio.discovery import Discovery
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions mirobo/ceil_cli.py → miio/ceil_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
sys.version_info)
sys.exit(1)

import mirobo # noqa: E402
import miio # noqa: E402

_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(mirobo.Ceil)
pass_dev = click.make_pass_decorator(miio.Ceil)


def validate_percentage(ctx, param, value):
Expand Down Expand Up @@ -73,7 +73,7 @@ def cli(ctx, ip: str, token: str, debug: int):
click.echo("You have to give ip and token!")
sys.exit(-1)

dev = mirobo.Ceil(ip, token, debug)
dev = miio.Ceil(ip, token, debug)
_LOGGER.debug("Connecting to %s with token %s", ip, token)

ctx.obj = dev
Expand All @@ -85,12 +85,12 @@ def cli(ctx, ip: str, token: str, debug: int):
@cli.command()
def discover():
"""Search for plugs in the network."""
mirobo.Ceil.discover()
miio.Ceil.discover()


@cli.command()
@pass_dev
def status(dev: mirobo.Ceil):
def status(dev: miio.Ceil):
"""Returns the state information."""
res = dev.status()
if not res:
Expand All @@ -108,30 +108,30 @@ def status(dev: mirobo.Ceil):

@cli.command()
@pass_dev
def on(dev: mirobo.Ceil):
def on(dev: miio.Ceil):
"""Power on."""
click.echo("Power on: %s" % dev.on())


@cli.command()
@pass_dev
def off(dev: mirobo.Ceil):
def off(dev: miio.Ceil):
"""Power off."""
click.echo("Power off: %s" % dev.off())


@cli.command()
@click.argument('level', callback=validate_percentage, required=True,)
@pass_dev
def set_brightness(dev: mirobo.Ceil, level):
def set_brightness(dev: miio.Ceil, level):
"""Set brightness level."""
click.echo("Brightness: %s" % dev.set_brightness(level))


@cli.command()
@click.argument('level', callback=validate_percentage, required=True,)
@pass_dev
def set_color_temperature(dev: mirobo.Ceil, level):
def set_color_temperature(dev: miio.Ceil, level):
"""Set CCT level."""
click.echo("Color temperature level: %s" %
dev.set_color_temperature(level))
Expand All @@ -140,43 +140,43 @@ def set_color_temperature(dev: mirobo.Ceil, level):
@cli.command()
@click.argument('seconds', callback=validate_seconds, required=True,)
@pass_dev
def delay_off(dev: mirobo.Ceil, seconds):
def delay_off(dev: miio.Ceil, seconds):
"""Set delay off in seconds."""
click.echo("Delay off: %s" % dev.delay_off(seconds))


@cli.command()
@click.argument('scene', callback=validate_scene, required=True,)
@pass_dev
def set_scene(dev: mirobo.Ceil, scene):
def set_scene(dev: miio.Ceil, scene):
"""Set scene number."""
click.echo("Eyecare Scene: %s" % dev.set_scene(scene))


@cli.command()
@pass_dev
def smart_night_light_on(dev: mirobo.Ceil):
def smart_night_light_on(dev: miio.Ceil):
"""Smart Night Light on."""
click.echo("Smart Night Light On: %s" % dev.smart_night_light_on())


@cli.command()
@pass_dev
def smart_night_light_off(dev: mirobo.Ceil):
def smart_night_light_off(dev: miio.Ceil):
"""Smart Night Light off."""
click.echo("Smart Night Light Off: %s" % dev.smart_night_light_off())


@cli.command()
@pass_dev
def automatic_color_temperature_on(dev: mirobo.Ceil):
def automatic_color_temperature_on(dev: miio.Ceil):
"""Auto CCT on."""
click.echo("Auto CCT On: %s" % dev.automatic_color_temperature_on())


@cli.command()
@pass_dev
def automatic_color_temperature_off(dev: mirobo.Ceil):
def automatic_color_temperature_off(dev: miio.Ceil):
"""Auto CCT on."""
click.echo("Auto CCT Off: %s" % dev.automatic_color_temperature_off())

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 17 additions & 17 deletions mirobo/philips_eyecare_cli.py → miio/philips_eyecare_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
sys.version_info)
sys.exit(1)

import mirobo # noqa: E402
import miio # noqa: E402

_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(mirobo.PhilipsEyecare)
pass_dev = click.make_pass_decorator(miio.PhilipsEyecare)


def validate_bright(ctx, param, value):
Expand Down Expand Up @@ -73,7 +73,7 @@ def cli(ctx, ip: str, token: str, debug: int):
click.echo("You have to give ip and token!")
sys.exit(-1)

dev = mirobo.PhilipsEyecare(ip, token, debug)
dev = miio.PhilipsEyecare(ip, token, debug)
_LOGGER.debug("Connecting to %s with token %s", ip, token)

ctx.obj = dev
Expand All @@ -85,12 +85,12 @@ def cli(ctx, ip: str, token: str, debug: int):
@cli.command()
def discover():
"""Search for plugs in the network."""
mirobo.PhilipsEyecare.discover()
miio.PhilipsEyecare.discover()


@cli.command()
@pass_dev
def status(dev: mirobo.PhilipsEyecare):
def status(dev: miio.PhilipsEyecare):
"""Returns the state information."""
res = dev.status()
if not res:
Expand All @@ -110,88 +110,88 @@ def status(dev: mirobo.PhilipsEyecare):

@cli.command()
@pass_dev
def on(dev: mirobo.PhilipsEyecare):
def on(dev: miio.PhilipsEyecare):
"""Power on."""
click.echo("Power on: %s" % dev.on())


@cli.command()
@pass_dev
def off(dev: mirobo.PhilipsEyecare):
def off(dev: miio.PhilipsEyecare):
"""Power off."""
click.echo("Power off: %s" % dev.off())


@cli.command()
@click.argument('level', callback=validate_bright, required=True,)
@pass_dev
def set_bright(dev: mirobo.PhilipsEyecare, level):
def set_bright(dev: miio.PhilipsEyecare, level):
"""Set brightness level."""
click.echo("Brightness: %s" % dev.set_brightness(level))


@cli.command()
@click.argument('scene', callback=validate_scene, required=True,)
@pass_dev
def set_scene(dev: mirobo.PhilipsEyecare, scene):
def set_scene(dev: miio.PhilipsEyecare, scene):
"""Set eyecare scene number."""
click.echo("Eyecare Scene: %s" % dev.set_scene(scene))


@cli.command()
@click.argument('minutes', callback=validate_minutes, required=True,)
@pass_dev
def delay_off(dev: mirobo.PhilipsEyecare, minutes):
def delay_off(dev: miio.PhilipsEyecare, minutes):
"""Set delay off in minutes."""
click.echo("Delay off: %s" % dev.delay_off(minutes))


@cli.command()
@pass_dev
def bl_on(dev: mirobo.PhilipsEyecare):
def bl_on(dev: miio.PhilipsEyecare):
"""Night Light on."""
click.echo("Night Light On: %s" % dev.smart_night_light_on())


@cli.command()
@pass_dev
def bl_off(dev: mirobo.PhilipsEyecare):
def bl_off(dev: miio.PhilipsEyecare):
"""Night Light off."""
click.echo("Night Light off: %s" % dev.smart_night_light_off())


@cli.command()
@pass_dev
def notify_on(dev: mirobo.PhilipsEyecare):
def notify_on(dev: miio.PhilipsEyecare):
"""Eye Fatigue Reminder On."""
click.echo("Eye Fatigue Reminder On: %s" % dev.reminder_on())


@cli.command()
@pass_dev
def notify_off(dev: mirobo.PhilipsEyecare):
def notify_off(dev: miio.PhilipsEyecare):
"""Eye Fatigue Reminder off."""
click.echo("Eye Fatigue Reminder Off: %s" % dev.reminder_off())


@cli.command()
@pass_dev
def ambient_on(dev: mirobo.PhilipsEyecare):
def ambient_on(dev: miio.PhilipsEyecare):
"""Ambient Light on."""
click.echo("Ambient Light On: %s" % dev.ambient_on())


@cli.command()
@pass_dev
def ambient_off(dev: mirobo.PhilipsEyecare):
def ambient_off(dev: miio.PhilipsEyecare):
"""Ambient Light off."""
click.echo("Ambient Light Off: %s" % dev.ambient_off())


@cli.command()
@click.argument('level', callback=validate_bright, required=True,)
@pass_dev
def set_amb_bright(dev: mirobo.PhilipsEyecare, level):
def set_amb_bright(dev: miio.PhilipsEyecare, level):
"""Set Ambient Light brightness level."""
click.echo("Ambient Light Brightness: %s" %
dev.set_ambient_brightness(level))
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions mirobo/plug_cli.py → miio/plug_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
sys.version_info)
sys.exit(1)

import mirobo # noqa: E402
import miio # noqa: E402

_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(mirobo.Plug)
pass_dev = click.make_pass_decorator(miio.Plug)


def validate_ip(ctx, param, value):
Expand Down Expand Up @@ -53,7 +53,7 @@ def cli(ctx, ip: str, token: str, debug: int):
click.echo("You have to give ip and token!")
sys.exit(-1)

dev = mirobo.Plug(ip, token, debug)
dev = miio.Plug(ip, token, debug)
_LOGGER.debug("Connecting to %s with token %s", ip, token)

ctx.obj = dev
Expand All @@ -65,12 +65,12 @@ def cli(ctx, ip: str, token: str, debug: int):
@cli.command()
def discover():
"""Search for plugs in the network."""
mirobo.Plug.discover()
miio.Plug.discover()


@cli.command()
@pass_dev
def status(dev: mirobo.Plug):
def status(dev: miio.Plug):
"""Returns the state information."""
res = dev.status()
if not res:
Expand All @@ -83,14 +83,14 @@ def status(dev: mirobo.Plug):

@cli.command()
@pass_dev
def on(dev: mirobo.Plug):
def on(dev: miio.Plug):
"""Power on."""
click.echo("Power on: %s" % dev.on())


@cli.command()
@pass_dev
def off(dev: mirobo.Plug):
def off(dev: miio.Plug):
"""Power off."""
click.echo("Power off: %s" % dev.off())

Expand All @@ -99,7 +99,7 @@ def off(dev: mirobo.Plug):
@click.argument('cmd', required=True)
@click.argument('parameters', required=False)
@pass_dev
def raw_command(dev: mirobo.Plug, cmd, parameters):
def raw_command(dev: miio.Plug, cmd, parameters):
"""Run a raw command."""
params = [] # type: Any
if parameters:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0089c22

Please sign in to comment.