def action_dim(self, id, level): ''' Dim a lamp to a specific level @param id int ID of device in tellstick.conf @param level int Light level (0-255) ''' id = self.parseId(id) level = self.parseLevel(level) td.dim(id, level) self.sendDeviceEvent(id, level) self.deviceEventCallback(id, td.TELLSTICK_DIM, level, 1)
def dim(self, level): resCode = td.dim(level) return self.getErrorString(resCode).lower()
# DIM # try: dimlevel = int(options.dimlevel) except: parser.error('--dimlevel LEVEL needs to be an integer and 0-255') if dimlevel < 0 or dimlevel > 255: parser.error('--dimlevel LEVEL needs to be an integer and 0-255') deviceId, deviceName = getDeviceIdAndName(options.dim) if deviceId == -1: parser.error('unknown device: ' + options.dim) resCode = td.dim(deviceId, dimlevel) if resCode != 0: res = td.getErrorString(resCode) else: res = 'Success' print 'Dimming device:', deviceId, deviceName, 'to', dimlevel, '-', res elif options.on == None and options.off == None and options.bell == None and options.list == False and options.dim == None and options.learn != None and options.event == False: # # LEARN # deviceId, deviceName = getDeviceIdAndName(options.learn)
# DIM # try: dimlevel = int(options.dimlevel) except: parser.error('--dimlevel LEVEL needs to be an integer and 0-255') if dimlevel < 0 or dimlevel > 255: parser.error('--dimlevel LEVEL needs to be an integer and 0-255') deviceId, deviceName = getDeviceIdAndName(options.dim) if deviceId == -1: parser.error('unknown device: ' + options.dim) resCode = td.dim(deviceId, dimlevel) if resCode != 0: res = td.getErrorString(resCode) else: res = 'Success' print 'Dimming device:', deviceId, deviceName, 'to', dimlevel, '-', res elif options.on == None and options.off == None and options.bell == None and options.list == False and options.dim == None and options.learn != None and options.event == False: # # LEARN # deviceId, deviceName = getDeviceIdAndName(options.learn) if deviceId == -1: