Материал из Module developer
Перейти к: навигация, поиск
// Get the unique ID of the bus at launching 
 module.AddListener(IR.EVENT_MODULE_START, 0, function(){
   var netWorkName = "HDL-BUS Pro Network (UDP)"'; 
   // Take the existing device and assign it ot the variable ''device'' 
   var device = module.getDevice(netWorkName); 
   // Create a new subdevice with the following parameters:
   // Device - driver object 
   // The name of the created subdevice, that will be used for calling this device and will be displayed to a user
   var NewSubDevice = module.addSubDevice({
       Device: device,
       DeviceName: "HDL Dimmer 1"
    });
 });

If a subdevice is created successfully, NewSubDevice variable will have the object of the created subdevice with the following operations:

  • Work with subdevice widgets
  • Work with subdevice commands and tags
  • Work with с AEC(Actions, Events, Conditions)