Created
November 2, 2017 02:11
-
-
Save davidthewatson/1ee22f7a5e4b7ee833e75020ef273910 to your computer and use it in GitHub Desktop.
Flash the house lights like an insane asylum for halloween
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
from lightify import Lightify | |
lightify = Lightify('192.168.1.10') | |
lightify.update_all_light_status() | |
lights = lightify.lights() | |
ls = {light.name(): light for light in lights.values()} | |
def rainbow(): | |
r, g, b = 255, 0, 0 | |
for g in range(256): | |
yield r, g, b | |
for r in range(255, -1, -1): | |
yield r, g, b | |
for b in range(256): | |
yield r, g, b | |
for g in range(255, -1, -1): | |
yield r, g, b | |
for r in range(256): | |
yield r, g, b | |
for b in range(255, -1, -1): | |
yield r, g, b | |
for c in rainbow(): | |
ls['Entryway'].set_rgb(c[0], c[1], c[2], 1) | |
for i in range(10): | |
t1 = datetime.datetime.now() | |
for light in lightify.lights().values(): | |
if light.devicetype() == DeviceType.LIGHT: | |
print(light.name()) | |
light.set_onoff(True) | |
light.set_onoff(False) | |
t2 = datetime.datetime.now() | |
print(t2-t1, (t2-t1)/17) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment