more G-Labs products

Author Topic: Virtual Switch  (Read 899 times)

December 04, 2015, 03:04:21 PM
Read 899 times

pim555

  • ****
  • Information
  • Sr. Member
  • Posts: 143
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

December 04, 2015, 04:07:24 PM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
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);

December 06, 2015, 09:58:37 PM
Reply #2

pim555

  • ****
  • Information
  • Sr. Member
  • Posts: 143