Python Plugin Framework limitation to 256 Units Topic is solved
Moderator: leecollings
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Python Plugin Framework limitation to 256 Units
@pipiche,
I've pushed another version tonight that has a number of fixes and added a new Domoticz.Dump() function which will write out the full Python context at the point of invokation.
Have you struct any more issue with testing?
I've pushed another version tonight that has a number of fixes and added a new Domoticz.Dump() function which will write out the full Python context at the point of invokation.
Have you struct any more issue with testing?
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
-
- Posts: 2015
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Plugin Framework limitation to 256 Units
hi man,
Still didn't started as it looks quiet some heavy work on my plugin, but I'm still preparing myself and there is an area where I don't understand how it will work ?
Some of the callbacks like onCommand, onRemove ... are providing Unit as the parameter. How does it works with the DomoticzEx (as Unit won't be enought to find the right Device ?
We need Devices[ device_id "].Unit[ unit_id ]
Still didn't started as it looks quiet some heavy work on my plugin, but I'm still preparing myself and there is an area where I don't understand how it will work ?
Some of the callbacks like onCommand, onRemove ... are providing Unit as the parameter. How does it works with the DomoticzEx (as Unit won't be enought to find the right Device ?
We need Devices[ device_id "].Unit[ unit_id ]
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Python Plugin Framework limitation to 256 Units
@pipiche,
I went back to the wiki page and realised I had done a very average job of documenting the changes and have made a number of updates. I have also pushed a code change today which cleans up the event API so if you are thinking of starting then please make sure you have this version.
The event handling for onDeviceAdded, onDeviceModified, onDeviceRemoved and onCommand CAN be quite different in the extended plugin framework, have a look at https://www.domoticz.com/wiki/Developin ... ugin#Units. Basically you can choose where these events go depending on your requirements but to do so you need to create your own classes that override the default Domoticz objects using the 'Register' function.
When you are using the extended framework and one of these events arrives, rather than just dispatching it to the base plugin, it will do this:
), it shows onDeviceModified declared at the 3 possible levels an indicates which will be called:
I went back to the wiki page and realised I had done a very average job of documenting the changes and have made a number of updates. I have also pushed a code change today which cleans up the event API so if you are thinking of starting then please make sure you have this version.
The event handling for onDeviceAdded, onDeviceModified, onDeviceRemoved and onCommand CAN be quite different in the extended plugin framework, have a look at https://www.domoticz.com/wiki/Developin ... ugin#Units. Basically you can choose where these events go depending on your requirements but to do so you need to create your own classes that override the default Domoticz objects using the 'Register' function.
When you are using the extended framework and one of these events arrives, rather than just dispatching it to the base plugin, it will do this:
- Check the Python object type being used to represent Units and see if it supports the event. If it does, send the event to the object with appropriate parameters.
- If the above check failed, check the Python object type being used to represent Devices and see if it supports the event. If it does, send the event to the object with appropriate parameters.
- If both preceding steps failed, attempt to dispatch the event to the base plugin itself
- Unit: def onCommand(self, Command, Level, Hue). The onCommand target is 'self' so no DeviceID or Unit is supplied.
- Device: def onCommand(self, Unit, Command, Level, Hue). The onCommand target is 'self->Units[Unit]' so no DeviceID is supplied.
- Base: def onCommand(self, DeviceID, Unit, Command, Level, Hue). The onCommand target is 'Devices[DeviceID].Units[Unit]'.

Code: Select all
import DomoticzEx as Domoticz
...
class hvacDevice(Domoticz.Device):
def __init__(self, DeviceID):
super().__init__(DeviceID)
def onDeviceModified(self, Unit):
# This will never be called because the Unit specific version overrides it
Domoticz.Log("Device onDeviceModified for Unit: "+str(self.Units[Unit]))
class hvacUnit(Domoticz.Unit):
def __init__(self, Name, DeviceID, Unit, TypeName="", Type=0, Subtype=0, Switchtype=0, Image=0, Options="", Used=0, Description=""):
super().__init__(Name, DeviceID, Unit, TypeName, Type, Subtype, Switchtype, Image, Options, Used, Description)
def onDeviceAdded(self):
Domoticz.Log("Unit onDeviceAdded for "+str(self.Name))
def onDeviceModified(self):
Domoticz.Log("Unit onDeviceModified for "+str(self.Name))
def onDeviceRemoved(self):
Domoticz.Log("Unit onDeviceRemoved for "+str(self.Name))
def onCommand(self, Command, Level, Hue):
Domoticz.Log("onCommand called for '" + str(self.Name)+ "': Parameters '" + str(Command) + "', Level: " + str(Level))
Command = Command.strip()
action, sep, params = Command.partition(' ')
action = action.capitalize()
# Override the default Domoticz objects with custom ones
Domoticz.Register(Device=hvacDevice, Unit=hvacUnit)
def onDeviceModified(self, DeviceID, Unit):
# This will never be called because the Unit specific version overrides it
Domoticz.Log("Device onDeviceModified for Unit: "+str(Devices[DeviceID].Units[Unit]))
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
-
- Posts: 2015
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Plugin Framework limitation to 256 Units
Not sure I found what I was looking but I think I need to build a new plugin to better understand.
On the other side, I think this is very sad, because there is no chance to get an easy path from the legcay plugin to the new one. I think on one side, the DomoticzEx enhance a lot the framework, make it more modern ..., but too much work to get a plugin compatible with the 2 modes.
I really need to understand the consequences to the Domoticz-Zigate plugin
On the other side, I think this is very sad, because there is no chance to get an easy path from the legcay plugin to the new one. I think on one side, the DomoticzEx enhance a lot the framework, make it more modern ..., but too much work to get a plugin compatible with the 2 modes.
I really need to understand the consequences to the Domoticz-Zigate plugin
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Python Plugin Framework limitation to 256 Units
If you just want to be able to do 'Devices[DeviceID].Units[Unit]' then you don't need to override anything, just use:
that will give you what you want
Code: Select all
def onCommand(DeviceID, Unit, Command, Level, Hue):
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
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Python Plugin Framework limitation to 256 Units
Hi to all.
Looking forward this problem.
I do have also the z2m plugin running with more then 255 idx.
My question is there a solution?
Or this not getting better?
Like to hear, or can test if you want.
Thanks for the great work!!
Looking forward this problem.
I do have also the z2m plugin running with more then 255 idx.
My question is there a solution?
Or this not getting better?
Like to hear, or can test if you want.
Thanks for the great work!!
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 2015
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Plugin Framework limitation to 256 Units
You need to update the z2m plugin and use the new DomoticzEx module.
Envoyé de mon iPhone en utilisant Tapatalk
Envoyé de mon iPhone en utilisant Tapatalk
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Python Plugin Framework limitation to 256 Units
Thanks...
Please a how to?
Or how is this solution work?
Developr of the z2m says.. no solution:
https://github.com/stas-demydiuk/domoti ... -908921117
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 2015
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Plugin Framework limitation to 256 Units
@Dnpwwo
just to keep you posted, we are making good progress to reach a solution to our plugin where we would maintain compatibility between the 2 worlds ( Legacy and Extension). This requires a bit more testing, but so far so good.
I have posted some new posts here:
viewtopic.php?f=65&t=36953
viewtopic.php?f=65&t=36951
just to keep you posted, we are making good progress to reach a solution to our plugin where we would maintain compatibility between the 2 worlds ( Legacy and Extension). This requires a bit more testing, but so far so good.
I have posted some new posts here:
viewtopic.php?f=65&t=36953
viewtopic.php?f=65&t=36951
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
-
- Posts: 850
- Joined: Wednesday 15 August 2018 14:38
- Target OS: -
- Domoticz version:
- Contact:
Re: Python Plugin Framework limitation to 256 Units
And this can't be corrected ? It's the logic corrective no ?Internally Domoticz uses a byte for the Unit in some code so higher numbered units would not work properly.
Because the extended framework look more a "workaround" than an corrective.
And just to be sure, there is no more 255 limit with the new framework, no limit in Unit and no limit in DeviceID ?
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Python Plugin Framework limitation to 256 Units
@Thorgal789,
The extended framework is not a workaround but but a better implementation for certain types of plugins, specifically those where multiple 'device's (physical or virtual) that have more than one attribute that can be exposed to Domoticz. It is much easier to code the plugin for these because each 'device' tends to come with a DeviceID (IP Address, UUID, ...) and therefore the attributes (i.e. Units) can be grouped together.
For example, I have a plugin that handles ZWave devices on my network https://github.com/dnpwwo/Domoticz-ZWav ... /plugin.py that will handle unlimited devices although the restriction of 255 Units per device is still there.
The extended framework is not a workaround but but a better implementation for certain types of plugins, specifically those where multiple 'device's (physical or virtual) that have more than one attribute that can be exposed to Domoticz. It is much easier to code the plugin for these because each 'device' tends to come with a DeviceID (IP Address, UUID, ...) and therefore the attributes (i.e. Units) can be grouped together.
For example, I have a plugin that handles ZWave devices on my network https://github.com/dnpwwo/Domoticz-ZWav ... /plugin.py that will handle unlimited devices although the restriction of 255 Units per device is still there.
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
-
- Posts: 850
- Joined: Wednesday 15 August 2018 14:38
- Target OS: -
- Domoticz version:
- Contact:
Re: Python Plugin Framework limitation to 256 Units
Thx for informations.
I m starting to fight with it, since yesterday, not a problem for new plugin, but for older, it's harder to keep all the already created stuff working
I m starting to fight with it, since yesterday, not a problem for new plugin, but for older, it's harder to keep all the already created stuff working
Who is online
Users browsing this forum: No registered users and 1 guest