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

Cleanup

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2774 b32b6428-25c9-4566-ad07-03861ab6144f
parent de4a223f
Branches
No related tags found
No related merge requests found
from xaal.lib import Device,Engine,tools,helpers
from xaal.lib import Device,Engine,tools
import sys
helpers.setup_console_logger()
def main(addr):
if addr == None:
addr = tools.get_random_uuid()
dev = Device("lamp.dimmer",addr)
dev.product_id = 'Dummy Dimming Lamp'
dev.url = 'http://www.acme.org'
dev.info = 'Dummy Lamp7'
# attributes
light = dev.new_attribute('light')
dimmer = dev.new_attribute('dimmer',50)
dev.dump()
# methods
def on():
light.value = True
......@@ -39,6 +36,7 @@ def main(addr):
# this is a simple dimmer w/ no white color settings.
dev.unsupported_methods = ['set_color_temperature']
dev.unsupported_attributes = ['color_temperature']
dev.dump()
eng = Engine()
eng.add_device(dev)
......
from xaal.schemas import devices
from xaal.lib import helpers
from xaal.lib import helpers,tools
import sys
def setup(engine):
dev = devices.lamp()
dev.product_id = 'Dummy Mini Lamp'
dev.dump()
def main(engine):
addr = None
if len(sys.argv) > 1:
addr = tools.get_uuid(sys.argv[-1])
if not addr:
print('Wrong address')
sys.exit(1)
dev = devices.lamp(addr)
dev.info = 'Dummy Mini Lamp'
# methods
def on():
......@@ -16,9 +23,10 @@ def setup(engine):
dev.methods['turn_on'] = on
dev.methods['turn_off'] = off
dev.dump()
engine.add_device(dev)
return True
if __name__ =='__main__':
helpers.run_async_package('lamp_minimal',setup)
helpers.run_async_package('lamp_minimal',main)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment