/micloud

Library for connecting to xiaomi cloud.

Primary LanguagePythonMIT LicenseMIT

Contributors Forks Stargazers Issues MIT License


MiCloud

Library for connecting to xiaomi cloud.

Report Bug · Request Feature

About The Project

Simple implementation for logging in to your Xiaomi cloud account and fetch device information.

Usage

How to get and use micloud.

Getting it

To download micloud, either fork this github repo or use Pypi via pip.

$ pip install micloud

Using it

You can use micloud in your project or directly from the terminal.

In terminal:

Usage: micloud [OPTIONS]

Options:
  -u, --username TEXT  Your Xiaomi username.
  -c, --country TEXT   Language code of the server to query. Default: "de"
  --pretty             Pretty print json output.
  --help               Show this message and exit.

In code:

As of right now there's not much you can do. You can login and get device info from Xiaomi cloud:

from micloud import MiCloud

mc = MiCloud("USERNAME", "PASSWORD")
mc.login()
token = mc.get_token() # to get your cloud service token.
device_list = mc.get_devices() # get list of devices

To query a different server, use the country argument:

device_list = mc.get_devices(country="cn")

And to save the device list as json:

mc.get_devices(country="cn", save=True, file="devices.json")

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Sammy Svensson - @S_Svensson - sammy@ssvensson.se

Project Link: https://github.com/squachen/micloud