[solved] Python Framework DomoticzEx - onRemove Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
pipiche
Posts: 2034
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

[solved] Python Framework DomoticzEx - onRemove

Post 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)
    
  
Last edited by pipiche on Thursday 09 September 2021 21:16, edited 1 time in total.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Framework DomoticzEx - onRemove

Post 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?
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
pipiche
Posts: 2034
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python Framework DomoticzEx - onRemove

Post by pipiche »

Ok will cross check


Envoyé de mon iPhone en utilisant Tapatalk
pipiche
Posts: 2034
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python Framework DomoticzEx - onRemove

Post by pipiche »

@Dnpwwo sorry for wasting your time. It works as documented ... My fault.
Post Reply