Giter VIP home page Giter VIP logo

python-qube's Introduction

Python control for Qube LED bulbs

A simple Python API for controlling LED bulbs from Qube. This only covers local control via Bluetooth - the protocol for remote control should be similar, but is not yet implemented.

Example use

This will connect and set the bulb to full red, no green, no blue and half white using 05325983 as the firmware setup key (see below)

import qube

bulb = qube.qube("0A:84:20:16:00:01", "05325983")
bulb.connect()
bulb.set_rgbw(0xff, 0x00, 0x00, 0x80)

This will turn the bulb on

bulb.on()

This will turn the bulb off

bulb.off()

Get a list of the current red, green and blue values

(red, green, blue) = bulb.get_colour()

Get the current white intensity

white = bulb.get_state()

Get a boolean describing whether the bulb is on or off

on = bulb.get_on()

Obtaining the firmware setup key

If your device has been associated with your Qube account, it will require an authentication key for communication. This can be obtained as following. First, obtain an authentication token for your account:

curl -X POST https://home.qube-smarthome.com/api/v1/auth/tokens --data-urlencode email=your_email --data-urlencode password=your_password --data-urlencode grantType=password

where your_email and your_password are the email address and password used for your account. This will return some output including a field marked "accessToken". Now run:

curl 'https://home.qube-smarthome.com/api/v1/users/?expand=mobiles,houses,rooms,appliances,status&mobileFields=osTypeID,identifier,mobileClientUUID' -H "Authorization: Bearer your_token"

where your_token is the access token from the previous step. This will return a JSON block containing information about all associated devices in your account. Find the applianceFirmwareSetupKey field for the appropriate device and use that in the setup call.

python-qube's People

Watchers

James Cloos avatar JooYoung Lee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.