Материал из Module developer
- To add an action for the subdevice.
You can use the following method to add actions for subdevices:
// Example of the function for an action
function changeLight(in_data){
// To output the message about method activation
IR.Log("changeLight run");
// To output the sent parameters
// lamp: 1, set: 100 - the message output in the log
IR.JSONLog(in_data);
// Send the received parameters to the device
device.Send(in_data); }
// To add an action for the light
NewSubDevice.addAction({
ActionType: "Simple", // Indicate the type of action
Type: "script_call", // Indicate the type of action
Param: {lamp: 1, set: 100}, // Send parameters, it is not required for activating the function
Space: this, // Send the space for activationg the function - not required
Method: changeLight, // Send the method
Name: "Turn On" // Indicate the method name
})
