HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: pim555 on December 04, 2015, 03:04:21 PM

Title: Virtual Switch
Post by: pim555 on December 04, 2015, 03:04:21 PM
Hi,

I am using attached code for a virtual switch which was posted on this forum before. It works fine but I dont know how to instantiate multiple switches using this code?

Once I have created a first module where I can select a virtual module from the modules list, the second time I try to create a module, the virtual module is not there anymore.

If I just add the same program again, it seems to mess up so that is also not the approach I believe.

Any help is appreciated.

Cheers
Pim
Title: Re: Virtual Switch
Post by: mvdarend on December 04, 2015, 04:07:24 PM
Hi Pim,

In Program.AddVirtualModules you can define the number of 'devices'

Code: [Select]
Program.Setup(()=>
{                 
  Program.AddVirtualModules(moduleDomain, "Generic", "homegenie/generic/switch", 1, 1);
});

Change the last digit to the number of virtual devices you would like to create, for example 5:

Code: [Select]
Program.AddVirtualModules(moduleDomain, "Generic", "homegenie/generic/switch", 1, 5);
Title: Re: Virtual Switch
Post by: pim555 on December 06, 2015, 09:58:37 PM
Thanks