Skip to content
Snippets Groups Projects
Commit 18e90fe0 authored by jkerdreu's avatar jkerdreu
Browse files

- 0.7 migration of search for light

- Added fake click, to test scripts




git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2548 b32b6428-25c9-4566-ad07-03861ab6144f
parent 49dad309
No related branches found
No related tags found
No related merge requests found
from xaal.lib import Engine
from xaal.lib import Engine,tools
from xaal.schemas import devices
from xaal.monitor import Monitor
import platform,time
PKG_NAME = 'btn_relay_labo'
LAMPS=['ccc44227-d4fc-46eb-8578-159e2c47da03','ccc44227-d4fc-46eb-8578-159e2c47da04','ccc44227-d4fc-46eb-8578-159e2c47da05',
'ccc44227-d4fc-46eb-8578-159e2c47da06','ccc44227-d4fc-46eb-8578-159e2c47da07','ccc44227-d4fc-46eb-8578-159e2c47da08']
SPOTS=['6265eb30-8c59-11e9-98b1-b827ebe99201',]
def UUID(uuids):
r = []
for k in uuids:
r.append(tools.get_uuid(k))
return r
LAMPS= UUID(['ccc44227-d4fc-46eb-8578-159e2c47da03','ccc44227-d4fc-46eb-8578-159e2c47da04','ccc44227-d4fc-46eb-8578-159e2c47da05',
'ccc44227-d4fc-46eb-8578-159e2c47da06','ccc44227-d4fc-46eb-8578-159e2c47da07','ccc44227-d4fc-46eb-8578-159e2c47da08'])
SPOTS = UUID(['6265eb30-8c59-11e9-98b1-b827ebe99201',])
# Edisio labo
BTNS=['743034ca-c2f0-11e8-9485-a40074bcb601','743034ca-c2f0-11e8-9485-a40074bcb603','743034ca-c2f0-11e8-9485-a40074bcb605',
'743034ca-c2f0-11e8-9485-a40074bcb607','743034ca-c2f0-11e8-9485-a40074bcb608']
BTNS = UUID(['743034ca-c2f0-11e8-9485-a40074bcb601','743034ca-c2f0-11e8-9485-a40074bcb603','743034ca-c2f0-11e8-9485-a40074bcb605',
'743034ca-c2f0-11e8-9485-a40074bcb607','743034ca-c2f0-11e8-9485-a40074bcb608'])
# Aquara sw1
AQUARA=['1ec6bbd0-20b5-11e9-b352-a4badbf92500']
SDB = ['fb1f8648-20ba-11e9-b352-a4badbf92500','fb1f8648-20ba-11e9-b352-a4badbf92501','fb1f8648-20ba-11e9-b352-a4badbf92502']
SCEN = ['00796898-20bb-11e9-b352-a4badbf92500','00796898-20bb-11e9-b352-a4badbf92501','00796898-20bb-11e9-b352-a4badbf92502']
AQUARA= UUID(['1ec6bbd0-20b5-11e9-b352-a4badbf92500'])
SDB = UUID(['fb1f8648-20ba-11e9-b352-a4badbf92500','fb1f8648-20ba-11e9-b352-a4badbf92501','fb1f8648-20ba-11e9-b352-a4badbf92502'])
SCEN = UUID(['00796898-20bb-11e9-b352-a4badbf92500','00796898-20bb-11e9-b352-a4badbf92501','00796898-20bb-11e9-b352-a4badbf92502'])
# Edisio bureau
......@@ -26,15 +33,15 @@ SCEN = ['00796898-20bb-11e9-b352-a4badbf92500','00796898-20bb-11e9-b352-a4badbf9
# 'c4b33536-c314-11e8-a5d6-000673742b07','c4b33536-c314-11e8-a5d6-000673742b08']
SHUTERS=['e4b05165-be5d-46d5-acd0-4da7be1158ed','2fe70f46-3ece-44d1-af34-2d82e10fb854']
SIRENS =['980a639c-20b1-11e9-8d70-a4badbf92501',]
SHUTERS = UUID(['e4b05165-be5d-46d5-acd0-4da7be1158ed','2fe70f46-3ece-44d1-af34-2d82e10fb854'])
SIRENS = UUID(['980a639c-20b1-11e9-8d70-a4badbf92501',])
LAMPS_A = [LAMPS[0], LAMPS[2], LAMPS[5]]
LAMPS_B = [LAMPS[1], LAMPS[3], LAMPS[4]]
mon = None
def send(targets,action,body=None):
global mon
engine = mon.dev.engine
......@@ -87,21 +94,21 @@ def handle_msg(msg):
send([LAMPS[3],],'toggle')
if msg.source == SCEN[0]:
"soirée TV"
# "soirée TV"
send([SHUTERS[0]],'down')
send(LAMPS,'off')
send(SPOTS,'on')
send([SHUTERS[1]],'down')
if msg.source == SCEN[1]:
"Début journée"
# "Début journée"
send([SHUTERS[0]],'up')
send([LAMPS[3],],'on')
send(SPOTS,'off')
send([SHUTERS[1]],'up')
if msg.source == SCEN[2]:
"stop"
# "stop"
send([SHUTERS[0]],'stop')
send([SHUTERS[1]],'stop')
send(SIRENS,'stop')
......@@ -114,7 +121,7 @@ def handle_msg(msg):
if msg.action == 'attributesChange':
#print(msg)
if msg.source == 'd9993018-20b1-11e9-a250-a4badbf92500':
if msg.source == tools.get_uuid('d9993018-20b1-11e9-a250-a4badbf92500'):
pres = msg.body.get('presence')
light = mon.devices.get_with_addr(LAMPS[3]).attributes.get('light')
print("pres & light %s/%s" % (pres,light))
......
from xaal.lib import Engine,tools,MessageType
from xaal.schemas import devices
import sys
eng = Engine()
mf = eng.msg_factory
uuid = tools.get_uuid(sys.argv[1])
dev = devices.button(uuid)
msg = mf.build_msg(dev,[],MessageType.NOTIFY,action='click')
eng.send_msg(msg)
eng.loop()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment