Skip to main content

a python library for the Skydrop sprinkler controller API

Project description

A python library to interface with the Skydrop sprinkler controller API.

first things first: OAuth your app with your users

To use this library you must have a developer account to the Skydrop API. You can try emailing api@skydrop.com asking for developer access to your account.

You’ll have to navigate the OAuth2 flow per the docs to get a user code which can be used to collect the access and refresh token for users: Skydrop API Documentation

There are a few helper methods in the client to assist with that

example code

documentation coming later, for now, feel free to explore the code

example code:

import skydroppy
import time

async def main():
    client = skydroppy.SkydropClient(client_key, client_secret)
    # load tokens for the user from your favorite long term storage
    # should match the structure below.
    tokens = load_tokens()
    #{
    #    'access': <access token>,
    #    'refresh': <refresh token>>,
    #    'expires': <epoch timestamp for when access token expires>
    #}

    if tokens:
        client.load_token_data(tokens) # little helper method
    else:
        tokens = await client.get_access_token(code)
        save_tokens(client._tokens)

    if client.is_token_expired():
        tokens = await client.refresh_access_token()
        save_tokens(client._tokens)

    controllers = await client.update_controllers()
    for controller in controllers:
        print(controller)
        for zone in controller.zones:
            if zone.status == 'wired':
                print(zone)

    front_yard = controllers[0]
    back_yard = controllers[1]
    await front_yard.update() #updates status of all zones and controller status
    await front_yard.get_zone(3).start_watering()
    await back_yard.get_zone(1).start_watering()
    time.sleep(120)
    print(back_yard.get_zone(1).time_remaining)
    await back_yard.stop_watering() # stops all zones
    await front_yard.get_zone(3).stop_watering() # also stops all zones.. API/Skydrop limitation

asyncio.run(main())

Project details


Download files

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

Source Distribution

skydroppy-0.1.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skydroppy-0.1.2-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file skydroppy-0.1.2.tar.gz.

File metadata

  • Download URL: skydroppy-0.1.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for skydroppy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 aaa611c6a35c578e8379db88eea75621be44cc44d3c757f61fd31ef4190002fc
MD5 2c0bcb582f702e18b689b21bdb9bdf2d
BLAKE2b-256 810d85e633412fbf0db3a8c49b12a9ef87b21838890b956b375cfcf50af38cac

See more details on using hashes here.

File details

Details for the file skydroppy-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: skydroppy-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for skydroppy-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e728f44178e5ff8b68ba26822ec05793cab3ab3c506f43e8d863804b7dae948c
MD5 37f35518f34b0884d741b49ee3e4aa8c
BLAKE2b-256 599d51053c4ccb165bfd61c8ddd2a978a4d7b4ee6cd9d959372ac5d96dd901e8

See more details on using hashes here.

Supported by

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