Skip to content
Snippets Groups Projects
Commit 097c9d33 authored by jkerdreu's avatar jkerdreu
Browse files

Switched to toggle lamp


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2960 b32b6428-25c9-4566-ad07-03861ab6144f
parent 5f9d6e4c
Branches
No related tags found
No related merge requests found
from xaal.schemas import devices
from xaal.lib import helpers, tools
import sys
def main(engine):
addr = None
if len(sys.argv) > 1:
......@@ -11,7 +11,7 @@ def main(engine):
print('Wrong address')
sys.exit(1)
dev = devices.lamp(addr)
dev = devices.lamp_toggle(addr)
dev.info = 'Dummy Mini Lamp'
dev.attributes['light'] = False
......@@ -22,12 +22,17 @@ def main(engine):
def off():
dev.attributes['light'] = False
def toggle():
dev.attributes['light'] = not dev.attributes['light']
dev.methods['turn_on'] = on
dev.methods['turn_off'] = off
dev.methods['toggle'] = toggle
dev.dump()
engine.add_device(dev)
return True
if __name__ =='__main__':
helpers.run_async_package('lamp_minimal', main)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment