Thank you. Works!
Code:
def location_selected(self, loc):
enabled = loc == 'library'
self.qaction.setEnabled(enabled)
self.menuless_qaction.setEnabled(enabled)
I do not want to add dont_add_to for 'toolbar-device', because the plugin is neutral and works always, but only in libraries.