Page 1 of 1

[solved] Python Framework DomoticzEx - onRemove

Posted: Monday 06 September 2021 18:57
by pipiche
When removing a device from Domoticz and with a plugin using DomoticzEx, I'm getting this error !
Sep 06 18:55:33 rasp domoticz[9565]: 2021-09-06 18:55:33.759 Error: DomoticzEx: (DomoticzEx) 'onDeviceRemoved' failed 'TypeError':'onDeviceRemoved() takes 1 positional argument but 2 were given'.
Sep 06 18:55:33 rasp domoticz[9565]: 2021-09-06 18:55:33.760 Error: DomoticzEx: (DomoticzEx) No traceback available

Code: Select all

    def onDeviceRemoved( self, DeviceID, Unit ):
        Domoticz.Log("onDeviceRemoved... Ex")



def onDeviceRemoved(DeviceID,Unit):
    global _plugin
    _plugin.onDeviceRemoved(DeviceID, Unit)
    
  

Re: Python Framework DomoticzEx - onRemove

Posted: Thursday 09 September 2021 12:52
by Dnpwwo
Hmmm ... not sure.

This worked for me:

Code: Select all

    def onDeviceRemoved(self, DeviceID, Unit):
        Domoticz.Log("Device onDeviceRemoved for Plugin")

def onDeviceRemoved(DeviceID,Unit):
    global _plugin
    _plugin.onDeviceRemoved(DeviceID,Unit)
I also added this at the 'Device' level and it worked as well (correctly overrode the base plugin one):

Code: Select all

    def onDeviceRemoved(self, Unit):
        Domoticz.Log("Device onDeviceRemoved")
Are you sure the DomoticzEx module was loaded and not Domoticz?

Re: Python Framework DomoticzEx - onRemove

Posted: Thursday 09 September 2021 12:53
by pipiche
Ok will cross check


Envoyé de mon iPhone en utilisant Tapatalk

Re: Python Framework DomoticzEx - onRemove

Posted: Thursday 09 September 2021 21:15
by pipiche
@Dnpwwo sorry for wasting your time. It works as documented ... My fault.