If you haven't read Getting Started, we'd suggest reading that first.

Want to control your Lono with Python? The easiest way is probably with our Lono module!

Our Module

Our module is at https://pypi.python.org/pypi/lono. You can install it with pip install lono.

Single User Application Example

from lono import LonoClient

# lets set up the api with all the relevant info
lc = LonoClient(
    client_id="client id",
    client_secret="client secret",
    auth_token="auth token",
    scope=["write"]
)

# turn on the first zone
device = lc.get_device("device id")
print "Turn on zone:", device.set_zone(zone_id, True)

Multi User Application Example

from lono import LonoClient

# lets set up the api with all the relevant info
lc = LonoClient(
    client_id="client id",
    client_secret="client secret",
    scope=["write"]
)

# step one: redirect users here to sign in and give your app permission
auth_url = lc.authorize_url("http://on_success_redirect_here.com")

# step two: once the OAuth2 callback is received, specify the token
lc.save_token("auth token")

# turn on the first zone
device = lc.get_device("device id")
print "Turn on zone:", device.set_zone(zone_id, True)