Skip to content

Origin Source

Name Input Params Return Data Description
resiot_startfrom Empty String Get the LogData source origin
resiot_getparam Integer String Get the parameter with key Index passed by the resiot_runscene(...) function
resiot_getparamcount Empty Integer Get the number of params passed by the resiot_runscene(...) function
resiot_trigger_actionname Empty String Get the name of the action that turned on the Trigger
resiot_trigger_getparam String String Get the value of the parameter called VName
resiot_comm_getparam String String Get the value of the Payload with the value VName
resiot_inputparam Empty String Get all possible input to the scene

resiot_startfrom()

Get the LogData source origin.
Example
LDSourceOrigin = resiot_startfrom()
Input Parameters
 - * There are no parameters in Input.
Returns
 - LDSourceOrigin (String): * The function returns the LogData source origin as String.

LDSourceOrigin = resiot_startfrom()
resiot_debug(LDSourceOrigin)
-- 
-- Possible Results:
-- 
-- LDSourceOrigin = "Manual"
-- LDSourceOrigin = "Scene"
-- LDSourceOrigin = "Trigger"
-- LDSourceOrigin = "Payload"
-- LDSourceOrigin = "Api"
-- LDSourceOrigin = "Connector"
-- LDSourceOrigin = "Visual"
-- 

Return to index


resiot_getparam (Integer)

Get the parameter with key Index passed by the resiot_runscene(...) function.
Example
Value = resiot_getparam(Index)
Input Parameters
 - Index (Integer): * The index of the parameter.
Returns
 - Value (String): * The function returns the parameter with the key Index passed by the resiot_runscene(...) function.

-- 
-- Scene started by resiot_runscene(HexID, "Index 0", "Index 1", "Index 2")
-- 
Index = 1                       -- The index of the parameter
Value = resiot_getparam(Index)
resiot_debug(Value)
-- 
-- In This case:
-- 
-- Value = "Index 1"
-- 

Return to index


resiot_getparamcount()

Get the number of params passed by the resiot_runscene(...) function.
Example
Count = resiot_getparamcount()
Input Parameters
 - * There are no parameters in Input.
Returns
 - Count (Integer): * The function returns the number of params passed by the resiot_runscene(...) function.

-- 
-- Scene started by resiot_runscene(HexID, "Index 0", "Index 1", "Index 2")
-- 
Count = resiot_getparamcount()
resiot_debug(Count)
-- 
-- In This case:
-- 
-- Count = 3
-- 

Return to index


resiot_trigger_actionname()

Get the name of the action that turned on the Trigger.
Example
ActionName = resiot_trigger_actionname()
Input Parameters
 - * There are no parameters in Input.
Returns
 - ActionName (String): * The function returns the name of the action that turned on the Trigger.

ActionName = resiot_trigger_actionname()
resiot_debug(ActionName)
-- 
-- Result Example:
-- 
-- ActionName = "comm_rx"
-- 

Return to index


resiot_trigger_getparam(String)

Get the value of the parameter called VName.
Example
Value = resiot_trigger_getparam(VName)
Input Parameters
 - VName (String): * The name of the designed parameter.
Returns
 - Value (String): * The function returns the value of the parameter that match with the VName.

VName = "Temperature"               -- The name of the designed parameter
Value = resiot_trigger_getparam(VName)
resiot_debug(Value)
-- 
-- Result Example:
-- 
-- Value = "12°C"
-- 

Return to index


resiot_comm_getparam(String)

Get the value from the list of parameters with the index VName.
Example
Value = resiot_comm_getparam(VName)
Input Parameters
 - VName (String): * The name of the index.
Returns
 - Value (String): * The function returns the value of the parameter that match with the VName.

-- 
-- The List of possible values are:
-- 
-- appeui: the node AppEUI
-- deveui: the node DevEUI
-- retained: a string for carrier-grade environments stating if the message is a live one (value = ""), or a recovered one from the gateway retention (value = "retained")
-- time: the Unix Timestamp of the time the received data. Useful in case a value is retained. !!The timestamp is the timestamp of the gateway when the packet was received while offline, and not the time it finally reached the ResIOT platform.
-- port: the port of the communication
-- payload: the message sent
-- gateways: it represents the series of the gateways which the communication passed through divided by a ","
-- topic: the topic that triggered a smart scene( in case of a smart scene launching a new scene, if the smart scene condition was verified by a connector having a topic)
-- body: the body that triggered a smart scene( in case of a smart scene launching a new scene)
-- 
VName = "payload"       -- The name of the index
Value = resiot_comm_getparam(VName)
resiot_debug(Value)
-- 
-- Result Example:
-- 
-- Value = "4D657373616765"
-- 

Return to index

resiot_inputparam()

Get all possible input to the scene.
Example
InputValues = resiot_inputparam()
Input Parameters
 - * There are no parameters in Input.
Returns
 - InputValues (String): * Json containing the values given as input to the scene.

JsonInput = resiot_inputparam()
resiot_debug(JsonInput)
-- 
-- {"Input1": "Value1", "Input2": "Value2", "Input3": "Value3"}
-- 
-- Get Example:
Field = "appeui" -- to get the AppEUI
AppEUI, err = json_getfield(JsonInput, Field)
if err ~= "" then
    -- error 
    resiot_debug(err)
else
    -- value read correctly
    resiot_debug(AppEUI)
end
Field = "deveui" -- to get the DevEUI
DevEUI, err = json_getfield(JsonInput, Field)
if err ~= "" then
    -- error 
    resiot_debug(err)
else
    -- value read correctly
    resiot_debug(DevEUI)
end
-- 
-- Possible Inputs:
-- 
-- "startedfrom": what stated the scene. (Manual, Scene, Node Rx, API, etc.)
-- "scenename": name of the scene that started this scene. (only if another scene started this scene)
-- "sceneidhex": hexadecimal ID of the scene that started this scene. (only if another scene started this scene)
-- "scenetype": type of the scene that started this scene, "Smart" or "Advanced". (only if another scene started this scene)
-- "appeui" or "appeuisource": appEUI of the node that started the scene. (only if a node started this scene)
-- "deveui" or "deveuisource": devEUI of the node that started the scene. (only if a node started this scene)
-- "nodename": name of the node that started the scene. (only if a node started this scene)
-- "triggeraction": name of the action that started the scene. (Timeout, Edit, On Scheduler, Change Value, etc.)
-- "triggeractioneventname": name of the triggered event that started the scene. (only if a node event started this scene)
-- "triggeractionfieldname": name of the edited field that started the scene. (only if a node field edit started this scene)
-- "triggeractioncheck": what check on the value of the node field has been made against the reference value. (Higher, Lower, Differt, Equal) (only if a node field edit started this scene)
-- "triggeractionvaluereference": reference value for the field "triggeractioncheck". (only if a node field edit started this scene)
-- "variablename": name of the variable that started the scene. (only if a variable started the scene)
-- "oldval": old value of the variable that started the scene. (only if a variable started the scene)
-- "newval": new value of the variable that started the scene. (only if a variable started the scene)
-- "gatewayname": name of the gateway that started the scene. (only if a gateway started the scene)
-- "connectorname": name of the connector that started the scene. (only if a connector started the scene)
-- "connectortype": type of the connector that started the scene. (MQTT Broker, LoRa Server, Web Socket, etc.) (only if a connector started the scene)
-- "triggerdescription": description of the action that stated the scene.
-- 

Return to index