Permalink
Cannot retrieve contributors at this time
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?
smarthotels/web/lights/test.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
31 lines (22 sloc)
563 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import time | |
from .discover import Discover | |
from .smartbulb import SmartBulb | |
""" | |
This is a test file to show how things work. | |
First it discovers all the bulbs on the local | |
network, then turns them all on, plays with | |
brightness, then turns them off. | |
""" | |
lightbulbs = [] | |
for dev in Discover.discover(): | |
lightbulbs.append(SmartBulb(dev)) | |
for bulb in lightbulbs: | |
bulb.state("ON") | |
time.sleep(3) | |
for bulb in lightbulbs: | |
bulb.brightness(10) | |
time.sleep(3) | |
for bulb in lightbulbs: | |
bulb.brightness(100) | |
bulb.state("OFF") |