Error when trying to add device programmatically

You can’t do this. Please read the wiki.