Strategy for multiple device instances
Posted: Saturday 11 March 2017 21:49
What is the best strategy to add multiple instances of devices supported by the same plugin?
Think about a plugin implementing a special type of switch device. I don't know how many switches I need from the beginning, and I want to add more switches later.
I guess one way to do this is to add more instances of the same hardware. With this approach the obvious question is if all variables in the plugin module are unique and bound to each instance of the module, or if global variables are shared between the instances.
What I look for is a way to create new Domoticz devices by incrementing the unit identifier. But how should I trigger this event? I lack a callback function for this kind of operation.
Any advice on this topic is appreciated.
Think about a plugin implementing a special type of switch device. I don't know how many switches I need from the beginning, and I want to add more switches later.
I guess one way to do this is to add more instances of the same hardware. With this approach the obvious question is if all variables in the plugin module are unique and bound to each instance of the module, or if global variables are shared between the instances.
What I look for is a way to create new Domoticz devices by incrementing the unit identifier. But how should I trigger this event? I lack a callback function for this kind of operation.
Any advice on this topic is appreciated.