Skip to content
Permalink
8dcd9c7af4
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (18 sloc) 1.03 KB

Usage

To start, set up the Raspberry Pi as a wireless access point. For instructions on how to do so, check out this guide on Raspberry Pi's site Afterwards, connect the bulbs to the Pi's access point using the TP-Link KASA app on Android or iPhone [Currently working on a way to bypass this part]. Once connected to the AP, you import smartbulb.py into your file using

from smartbulb import SmartBulb

From there, you can add a lightbulb using

bulb = SmartBulb("XXX.XXX.XXX.XXX")

with XXX.XXX.XXX.XXX being the lightbulb's IP address. You can use discover.py to find all IP addresses of any smart bulbs on the local network.

from discover import Discover

for dev in Discover.discover():
	print(dev)

Once you have set up your bulb, you can control them using bulb.state("X"), where X = "ON" | "OFF", and bulb.brightness(Y), where Y is an integer from 0 to 100. You can look at test.py for examples on how to use the libraries.