Skip to main content

Aqara Cloud API SDK

Project description

Aqara Cloud API

CodeFactor

Python SDK for Aqara Cloud API

(Functionality is not full, but already has core for futher upgrades)

Install

pip install aqara_capi

Example of usage

from aqara_capi import CloudApiClient, Locality

# create client
client = CloudApiClient(
    app_id=APP_ID,  # your params from https://developer.aqara.com/console
    app_key=APP_KEY,
    key_id=KEY_ID,
    locality=Locality.RU,  # for cloud domain
)

# set access and refresh tokens
client.set_tokens(access_token='...', refresh_token='...')

# or generate them
client.get_auth_code(
    account='my@example.com',
    account_type=0,
    access_token_validity='7d',
)
client.get_access_token(
    auth_code='secret code from ur email',
    account='my@example.com',
    account_type=0,
)


# print your devices
response = client.query_device_info()
print(response.result)

# print device attributes
response = client.query_resource_info(
    model='lumi.light....',
)
print(response.result)

# trigger some action (for example turn on light)
client.write_resource_device(
    subject_id='lumi...',
    resource_id='4.1.85',
    value='1',
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

aqara_capi-1.1.3-py2.py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page