Skip to content
Snippets Groups Projects
Commit 416cd857 authored by jkerdreu's avatar jkerdreu
Browse files

This is the end for version 0.5

parent b1607668
No related branches found
No related tags found
No related merge requests found
......@@ -113,7 +113,8 @@ function run_sio() {
});
}
//================ refresh attributes =======================================
// the old refresh_attributes blocks the page rendering process.
function sio_refresh_attributes_old() {
console.log('refresh_attributes');
var addrs = [];
......
......@@ -11,6 +11,13 @@ BTN1 = 'ec069c08-92af-11e8-80cd-408d5c18c800'
BTN2 = '6fa87ef2-9975-11e8-b1fa-82ed25e6aa00'
BTN3 = '821c6026-92ae-11e8-82af-408d5c18c800'
BTN1 = '63b5ece6-c266-11e8-a0fc-400074bcb601'
BTN4 = '63b5ece6-c266-11e8-a0fc-400074bcb605'
BTN5 = 'c38e3f04-92b1-11e8-85ee-408d5c18c800'
BTN3 = '6fa87ef2-9975-11e8-b1fa-82ed25e6aa00'
RGB1 = 'b97c687c-d700-11e8-b0df-408d5c18c8f7'
dev = None
def send(targets,action,body=None):
......@@ -18,22 +25,42 @@ def send(targets,action,body=None):
engine = dev.engine
engine.send_request(dev,targets,action,body)
def rand_color_code():
import random
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
color='#%x%x%x' % (r,g,b)
return color
def handle_msg(msg):
if not msg.is_notify():
return
# search for the buttons
"""
if msg.action == 'click':
if msg.source == BTN2:
if msg.source == BTN4:
send([REL1,REL2],'toggle')
if msg.source == BTN1:
if msg.source in [BTN1,BTN5]:
send([REL1],'toggle')
if msg.source == BTN3:
send([REL2,],'toggle')
if msg.action == 'double_click':
if msg.source in [BTN1,BTN3]:
send([REL1,REL2],'off')
send([REL2,],'toggle')
"""
if msg.action == 'click':
send([RGB1,],'toggle')
if msg.action == 'click':
if msg.source in [BTN1,BTN3,BTN5]:
#send([REL1,REL2],'toggle')
#send([RGB1,],'setWhite',{'target':'5000'})
send([RGB1,],'toggle')
if msg.source == '6fa87ef2-9975-11e8-b1fa-82ed25e6aa01':
send([RGB1,],'setRGB',{'target':rand_color_code()})
if msg.source == '6fa87ef2-9975-11e8-b1fa-82ed25e6aa02':
send([RGB1,],'off')
def main():
global dev
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment