The problem was that the slot is meant to receive arguments from the signal, so in this case a boolean:
#!/usr/bin/python3 import sys from PyQt5 import QtCore, QtWidgets, QtDBus class Main(QtWidgets.QMainWindow): def __init__(self, parent): super().__init__() service = "org.freedesktop.login1" if QtDBus.QDBusConnection.systemBus().interface().isServiceRegistered(service).value(): path = "/org/freedesktop/login1" interface = "org.freedesktop.login1.Manager" name = "PrepareForSleep" self.bus = QtDBus.QDBusConnection.systemBus() self.bus.connect(service, path, interface, name, self._slot) self.bus.connect(service, path, interface, name, "b", self._slotOverloaded) @QtCore.pyqtSlot() def _slot(self): print("Got 'PrepareForSleep' Signal") @QtCore.pyqtSlot(bool) def _slotOverloaded(self, data): print(f"Got '{data}' from 'PrepareForSleep' Signal") if __name__== '__main__': app = QtWidgets.QApplication([]) daemon = Main(app) sys.exit(app.exec_())Therefore the solution for my problem is to create an object for each signals-command pair:
#!/usr/bin/python3 import sys from PyQt5 import QtCore, QtWidgets, QtDBus SIGNALS = \ { 0: { "description": "Mute speaker on resume", "bus": "system", "service": "org.freedesktop.login1", "path": "/org/freedesktop/login1", "interface": "org.freedesktop.login1.Manager", "name": "PrepareForSleep", "exec": "amixer -D pulse sset Master mute" } } class DBusSignalMonitor(QtCore.QObject): def __init__(self, parent, signal): super().__init__() service = signal["service"] path = signal["path"] interface = signal["interface"] name = signal["name"] bus = signal["bus"] self.cmd = signal["exec"] if bus == "session": if QtDBus.QDBusConnection.sessionBus().interface().isServiceRegistered(service).value(): parent.sessionBus.connect(service, path, interface, name, self._slot) elif bus == "system": if QtDBus.QDBusConnection.systemBus().interface().isServiceRegistered(service).value(): parent.systemBus.connect(service, path, interface, name, self._slot) @QtCore.pyqtSlot() def _slot(self): print(f"exec '{self.cmd}'") class DBusDaemon(QtCore.QObject): def __init__(self, parent): super().__init__() self.sessionBus = QtDBus.QDBusConnection.systemBus() self.systemBus = QtDBus.QDBusConnection.systemBus() self.signals = {} for s in SIGNALS: self.signals[s] = DBusSignalMonitor(self, SIGNALS[s]) if __name__== '__main__': app = QtWidgets.QApplication(sys.argv) daemon = DBusDaemon(app) sys.exit(app.exec_())