Feature request: adding driver automatically or detecting the missing ones

I just tried calling addChildDevice() with a driver specified that I knew wouldn't work, and I got:

com.hubitat.app.exception.UnknownDeviceTypeException: Device type 'TestName' in namespace 'TestNamespace' not found

So, a catch (com.hubitat.app.exception.UnknownDeviceTypeException ex) ... or similar should do the trick. :slight_smile: But there are a few other things that could go wrong when creating a device, so you may want to also still catch a general Exception, and note that the addChildDevice() method should return the device that was created (technically a DeviceWrapper), so if that is null, something went wrong. If you only do this at the point when you actually create devices, I don't see any problems, but I'm not sure it satisfies the "check before you actually try" criterion that some are wishing for above.

I can't belive I've not think about that solution ... my God, I think I'm getting lazy ... or older ... or both!

I'll try it and post the results here. And do a proper test plan, by the way - lazy, lazy, lazy ...

Thanks @bertabcd1234!

That's how I do it, 'catch' the error then react to that.