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

New schema

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2464 b32b6428-25c9-4566-ad07-03861ab6144f
parent 1073d75b
Branches
No related tags found
No related merge requests found
......@@ -24,15 +24,19 @@ def main(addr):
light.value = False
print("%s OFF" %dev)
def dim(_target):
val = int(_target)
def dim(_brightness,_smooth):
# this device doesn't support _smooth parameter
val = int(_brightness)
if (val <= 100) and (val >=0):
dimmer.value = val
print("Dimming to %d" % val)
dev.add_method('on',on)
dev.add_method('off',off)
dev.add_method('dim',dim)
dev.add_method('turn_on',on)
dev.add_method('turn_off',off)
dev.add_method('default_set_brightness',dim)
# this is a simple dimmer w/ no white color settings.
dev.unsupported_methods = ['set_color_themperature']
dev.unsupported_attributes = ['color_themperature']
eng = Engine()
eng.add_device(dev)
......@@ -43,7 +47,7 @@ if __name__ =='__main__':
try:
addr = None
if len(sys.argv) > 1:
addr = tools.str_to_uuid(sys.argv[-1])
addr = tools.get_uuid(sys.argv[-1])
if not addr:
print("Wrong address")
main(addr)
......
......@@ -14,8 +14,8 @@ def setup(engine):
def off():
dev.attributes['light'] = False
dev.methods['on'] = on
dev.methods['off'] = off
dev.methods['turn_on'] = on
dev.methods['turn_off'] = off
engine.add_device(dev)
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment