Skip to content
Snippets Groups Projects
Commit 9700e350 authored by jkerdreu's avatar jkerdreu
Browse files

Added demo Alarm


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@2249 b32b6428-25c9-4566-ad07-03861ab6144f
parent 605e1cc6
No related branches found
No related tags found
No related merge requests found
from xaal.lib import Engine from xaal.lib import Engine
from xaal.schemas import devices from xaal.schemas import devices
from xaal.monitor import Monitor from xaal.monitor import Monitor
import platform import platform,time
PKG_NAME = 'btn_relay_labo' PKG_NAME = 'btn_relay_labo'
LAMPS=['ccc44227-d4fc-46eb-8578-159e2c47da03','ccc44227-d4fc-46eb-8578-159e2c47da04','ccc44227-d4fc-46eb-8578-159e2c47da05', 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'] 'ccc44227-d4fc-46eb-8578-159e2c47da06','ccc44227-d4fc-46eb-8578-159e2c47da07','ccc44227-d4fc-46eb-8578-159e2c47da08']
SPOTS=['6265eb30-8c59-11e9-98b1-b827ebe99201',]
# Edisio labo # Edisio labo
BTNS=['743034ca-c2f0-11e8-9485-a40074bcb601','743034ca-c2f0-11e8-9485-a40074bcb603','743034ca-c2f0-11e8-9485-a40074bcb605', 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'] '743034ca-c2f0-11e8-9485-a40074bcb607','743034ca-c2f0-11e8-9485-a40074bcb608']
# Aquara sw1 # Aquara sw1
AQUARA=['1ec6bbd0-20b5-11e9-b352-a4badbf92500'] 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']
# Edisio bureau # Edisio bureau
#BTNS = ['c4b33536-c314-11e8-a5d6-000673742b01','c4b33536-c314-11e8-a5d6-000673742b03','c4b33536-c314-11e8-a5d6-000673742b05', #BTNS = ['c4b33536-c314-11e8-a5d6-000673742b01','c4b33536-c314-11e8-a5d6-000673742b03','c4b33536-c314-11e8-a5d6-000673742b05',
...@@ -21,6 +27,8 @@ AQUARA=['1ec6bbd0-20b5-11e9-b352-a4badbf92500'] ...@@ -21,6 +27,8 @@ AQUARA=['1ec6bbd0-20b5-11e9-b352-a4badbf92500']
SHUTERS=['e4b05165-be5d-46d5-acd0-4da7be1158ed','2fe70f46-3ece-44d1-af34-2d82e10fb854'] SHUTERS=['e4b05165-be5d-46d5-acd0-4da7be1158ed','2fe70f46-3ece-44d1-af34-2d82e10fb854']
SIRENS =['980a639c-20b1-11e9-8d70-a4badbf92501',]
LAMPS_A = [LAMPS[0], LAMPS[2], LAMPS[5]] LAMPS_A = [LAMPS[0], LAMPS[2], LAMPS[5]]
LAMPS_B = [LAMPS[1], LAMPS[3], LAMPS[4]] LAMPS_B = [LAMPS[1], LAMPS[3], LAMPS[4]]
...@@ -75,12 +83,45 @@ def handle_msg(msg): ...@@ -75,12 +83,45 @@ def handle_msg(msg):
#send([SHUTERS[1],],'down') #send([SHUTERS[1],],'down')
pass pass
if msg.source == SDB[0]:
send([LAMPS[3],],'toggle')
if msg.source == SCEN[0]:
"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"
send([SHUTERS[0]],'up')
send([LAMPS[3],],'on')
send(SPOTS,'off')
send([SHUTERS[1]],'up')
if msg.source == SCEN[2]:
"stop"
send([SHUTERS[0]],'stop')
send([SHUTERS[1]],'stop')
send(SIRENS,'stop')
if msg.action == 'double_click': if msg.action == 'double_click':
if msg.source in AQUARA: if msg.source in AQUARA:
send([SHUTERS[0],],'stop') send([SHUTERS[0],],'stop')
send([SHUTERS[1],],'stop') send([SHUTERS[1],],'stop')
send(SIRENS,'stop')
if msg.action == 'attributesChange':
#print(msg)
if msg.source == '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))
if pres == False and light == True:
send(SIRENS,'play')
print('Alarme..')
def main(): def main():
global dev global dev
global mon global mon
...@@ -94,6 +135,6 @@ def main(): ...@@ -94,6 +135,6 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
try: try:
main() eng = main()
except KeyboardInterrupt: except KeyboardInterrupt:
print('Bye bye') print('Bye bye')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment