Материал из Module developer
Перейти к: навигация, поиск

SubDevice.AddAction (works via a function)

Add an action (used in macros and rules). Parameters in brackets are not obligatory

Синтаксис

SubDevice.AddAction(Name, ScriptCall, Method, Space, [Default], [SmartID], [AdvancedField], [Hidden])

Название Пример Описание
Name "Power on" type: String
Action name
ScriptCall true type: Boolean
feature that an action works via a function. Use true
Method function(in_data){...} type: Function
Fucntion that is being executed. The incoming parameter to the function can be:
  • if [Default: String] is used, the incoming parameter is Deafault value in String format, set by a module developer
  • if [AdvancedField] is used, the incoming parameter is a value of Object or String type depending on the format [AdvancedField]
Space this type: Object
Pointer to an object that services a function. If a pointer is not required an empty object or undefined can be put
Default "1" type: String
Value that is an arriving parameter to Method
SmartID type: Number
The parameter is not available yet, that's why set null
AdvancedField {Name, Type, ...} type: Object, Array
It is used to work with complicated actions. When AdvancedField is used, put null in Default parameter.

One object or an object can be sent in AdvancedField.

На выходе

{{{output}}}


Пример

{{{JSsample}}}

{{{attentions}}}