diff --git a/pyhomematic/devicetypes/generic.py b/pyhomematic/devicetypes/generic.py index ea456433c..5490deb37 100644 --- a/pyhomematic/devicetypes/generic.py +++ b/pyhomematic/devicetypes/generic.py @@ -59,6 +59,9 @@ def event(self, interface_id, key, value): % (self._ADDRESS, interface_id, key, value)) if key == PARAM_UNREACH: self._unreach = value + if not self._eventcallbacks: + LOG.debug("HMGeneric.event: No callbacks registered for event %s (%s)", key, str(self)) + for callback in self._eventcallbacks: LOG.debug("HMDevice.event: Using callback %s " % str(callback)) callback(self._ADDRESS, interface_id, key, value) @@ -352,9 +355,14 @@ def setEventCallback(self, callback, bequeath=True, channel=0): Signature for callback-functions: foo(address, interface_id, key, value) """ if hasattr(callback, '__call__'): + LOG.debug( + "Adding callback '%s' for %s:%s (%s)", + str(callback), self._name, channel, str(self) + ) + if channel == 0: self._eventcallbacks.append(callback) - elif not bequeath and channel > 0 and channel in self._hmchannels: + if not bequeath and channel in self._hmchannels: self._hmchannels[channel]._eventcallbacks.append(callback) if bequeath: for channel, device in self._hmchannels.items():