Exemplo n.º 1
0
def set_scene(address, scene):
    if scene == 'bright':
        device = gatt.connect(address)
        s = state.from_rgb(255, 255, 255, 100)
        state_map[address] = s
        s.write(device)
    elif scene == 'night':
        device = gatt.connect(address)
        s = state.from_rgb(48, 24, 96, 25)
        state_map[address] = s
        s.write(device)
Exemplo n.º 2
0
 def GET(self, address):
     i = web.input()
     r = utils.try_get_input(i, 'red', 0)
     g = utils.try_get_input(i, 'green', 0)
     b = utils.try_get_input(i, 'blue', 0)
     duration = utils.try_get_input(i, 'duration', 0.25)
     action.thread.queue.put(action.ActionFlash(state.from_rgb(r, g, b, 100), duration))
Exemplo n.º 3
0
 def GET(self, address):
     i = web.input()
     r = utils.try_get_input(i, 'red', 0)
     g = utils.try_get_input(i, 'green', 0)
     b = utils.try_get_input(i, 'blue', 0)
     duration = utils.try_get_input(i, 'duration', 0.25)
     action.thread.queue.put(
         action.ActionFlash(state.from_rgb(r, g, b, 100), duration))
Exemplo n.º 4
0
import gatt
import state
import time
import random

device = gatt.connect('20:C3:8F:F3:09:98')
s = state.from_rgb(0, 0, 0, 5)

while True:
    s.set_rgb(random.randrange(25, 100), random.randrange(25, 100),
              random.randrange(25, 100))
    s.write(device)
Exemplo n.º 5
0
import gatt
import state
import time
import random

device = gatt.connect('20:C3:8F:F3:09:98')
s = state.from_rgb(0, 0, 0, 5)

while True:
    s.set_rgb(random.randrange(25, 100), random.randrange(25, 100), random.randrange(25, 100))
    s.write(device)