Exemple #1
0
import time
import ouimeaux
from ouimeaux.environment import Environment

# http://pydoc.net/Python/ouimeaux/0.7.3/ouimeaux.examples.watch/
if __name__ == "__main__":
    print ""
    print "WeMo Randomizer"
    print "---------------"
    env = Environment()
    # TODO: run from 10am to 10pm
    try:
        env.start()
        env.discover(100)
        print env.list_switches()
        print env.list_motions()
        print "---------------"
        while True:
            # http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python
            switchRND = env.get_switch( random.choice( env.list_switches() ) )
            print switchRND
            switchRND.toggle()
            env.wait(90)
        
    except (KeyboardInterrupt, SystemExit):
        print "---------------"
        print "Goodbye!"
        print "---------------"
        # Turn off all switches
        for switch in ( env.list_switches() ):
            print "Turning Off: " + switch
Exemple #2
0
import time
import ouimeaux
from ouimeaux.environment import Environment

# http://pydoc.net/Python/ouimeaux/0.7.3/ouimeaux.examples.watch/
if __name__ == "__main__":
    print("")
    print("WeMo Randomizer")
    print("---------------")
    env = Environment()
    # TODO: run from 10am to 10pm
    try:
        env.start()
        env.discover(100)
        print(env.list_switches())
        print(env.list_motions())
        print("---------------")
        while True:
            # http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python
            switchRND = env.get_switch( random.choice( env.list_switches() ) )
            print(switchRND)
            switchRND.toggle()
            env.wait(90)
        
    except (KeyboardInterrupt, SystemExit):
        print("---------------")
        print("Goodbye!")
        print("---------------")
        # Turn off all switches
        for switch in ( env.list_switches() ):
            print("Turning Off: " + switch)
Exemple #3
0
import time
from datetime import datetime

from pyhue import Hue
from ouimeaux.environment import Environment
from ouimeaux.subscribe import SubscriptionRegistry

registry = SubscriptionRegistry()

env = Environment(with_cache=False)

env.start()

env.discover(3)

ms = env.list_motions()
ss = env.list_switches()

m = ms[0]

m = env.get_motion(ms[0])
ss = [env.get_switch(s) for s in ss]

h = Hue()
ls = h.lights
print ls

sunset = dict(sofa = [0.5543, 0.4098],
              room = [0.5452, 0.4164],
              bed  = [0.5848, 0.3872],
              desk = [0.5413, 0.4193])
Exemple #4
0
import time
import ouimeaux
from ouimeaux.environment import Environment

# http://pydoc.net/Python/ouimeaux/0.7.3/ouimeaux.examples.watch/
if __name__ == "__main__":
    print("")
    print("WeMo Randomizer")
    print("---------------")
    env = Environment()
    # TODO: run from 10am to 10pm
    try:
        env.start()
        env.discover(100)
        print(env.list_switches())
        print(env.list_motions())
        print("---------------")
        while True:
            # http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python
            switchRND = env.get_switch(random.choice(env.list_switches()))
            print(switchRND)
            switchRND.toggle()
            env.wait(90)

    except (KeyboardInterrupt, SystemExit):
        print("---------------")
        print("Goodbye!")
        print("---------------")
        # Turn off all switches
        for switch in (env.list_switches()):
            print("Turning Off: " + switch)
Exemple #5
0
import time
import ouimeaux
from ouimeaux.environment import Environment

# http://pydoc.net/Python/ouimeaux/0.7.3/ouimeaux.examples.watch/
if __name__ == "__main__":
    print ""
    print "WeMo Randomizer"
    print "---------------"
    env = Environment()
    # TODO: run from 10am to 10pm
    try:
        env.start()
        env.discover(100)
        print env.list_switches()
        print env.list_motions()
        print "---------------"
        while True:
            # http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python
            switchRND = env.get_switch(random.choice(env.list_switches()))
            print switchRND
            switchRND.toggle()
            env.wait(90)

    except (KeyboardInterrupt, SystemExit):
        print "---------------"
        print "Goodbye!"
        print "---------------"
        # Turn off all switches
        for switch in (env.list_switches()):
            print "Turning Off: " + switch