Change the device driver type using script

It may be basic but I would like to know if it is possible to change the driver of a device through a script in the console.

There’s no way to simply change the type. You would need to capture the settings, remove the device, and re-add it using the new driver type. You will probably need to do some settings translations as the new driver may not use exactly the same names for its properties or indeed have the same properties at all.
Functions here in the help.

Edit: I figured you could get the properties of an existing device, but now that I look at it more closely, listDevices returns a dataset and not a class object… Hopefully someone else in the know can clarify. @PGriffith or @Kevin.Herron?

2 Likes

This is basically never going to happen, because the list of common settings for device types is basically just ‘name’ and ‘description’. Literally everything else, including hostname, is not actually required/a part of every device driver, so it won’t map to other driver types.

2 Likes

I understand that, but couldn’t it return a dictionary of settings? Exactly what you provide the addDevice function

It could, but it’s impossible to change now, because it would invariably break existing scripts. Adding another system function with a different format for the same information is also…unlikely to happen.

Could an extra optional argument be added to existing function that changes the return to the params dictionary? (forgive my Java ignorance. Not sure if you can even change the return type of a function like python)

Well, changing the signature is tricky on the Java side, but that doesn’t make it impossible. But, either way, not going to happen unless it’s asked for :slight_smile: