Skip to content

Object Nodes

Name Input Params Return Data Description
resiot_getlastpayload String, String String Get the last Payload of a Node
resiot_getlastpayloaddate String, String Integer Get the date (in seconds) of the last Payload of a Node
resiot_setnodevalue String, String, String, String Boolean, String Save the inserted value for the specified node field
resiot_setnodevalue_oid String, String, String, String Boolean, String Save the inserted value for the specified node field only if the inserted value is different than the old one
resiot_setnodevaluewithtime String, String, String, String, Integer Boolean, String Save the inserted value for the specified node field in a determinated time
resiot_node_getvalue String, String, String String, String Get the Content of a Payload field of a Node
resiot_node_getvaluewithtime String, String, String String, Integer, String Get the Content and the Last Set Time of a Payload field of a Node
resiot_getnodevalues String, String, []String []String, []String, String Get the Content of multiple Payload fields of a Node
resiot_node_getlastvalues String, String, String String, String, String Get the current and previous value of a Payload field of a Node
resiot_getnodedatafromtag String String, String Get the Node DevEUI and AppEUI with the Tag
resiot_tx String, String, String, String, String, String, Boolean, String, ... Error This function send a message to a Broker/WebSocket
resiot_txraw String, String, String, String, String, String, Boolean, String, ... Error This function send a message to a Broker/WebSocket
resiot_tx_gw String, String, String, String, String, String, Boolean, String, String, ... Error This function send a message to a Broker/WebSocket through the desired Gateway
resiot_txraw_gw String, String, String, String, String, String, Boolean, String, String, ... Error This function send a message to a Broker/WebSocket through the desired Gateway
resiot_setcounterdownlink String, String, Integer Error This function set the Downlink counter of an ABP node
resiot_setcountetuplink String, String, Integer Error This function set the Uplink counter of an ABP node
resiot_downlinkqueue_deleteall String, String String This function delete the Downlink Queue
resiot_setlatitudelongitude String, String, Float, Float Error This function update the Latitude and the Longitude of a Node
resiot_setlatitudelongitudewtime String, String, Float, Float, Integer Error This function update the Latitude and the Longitude of a Node in a determinated time
resiot_getlastdatejoin String, String Integer, Error Get the date of the last Join of a Node
resiot_getnodebyalias String String, String, String Get the node appEui and devEui from its alias
resiot_getnodebytag String String, String, String Get the node appEui and devEui from its tag
resiot_getnodealias String, String String, String Get the node Alias from its appEui and devEui
resiot_getnodetag String, String String, String Get the node Tag from its appEui and devEui
resiot_getnodegroup String, String String, String Returns the node group name and hex Id if present
resiot_getnodegroup2 String, String String, String Returns the node group 2 name and hex Id if present
resiot_maccommand_send String, String, String, String String Enqueues a mac maccomand to the device mac command list
resiot_nodecommandstart String, String, String, String Boolean, String Executes the selected Node Command of a specific Node
resiot_node_setname String, String, String String Sets the Name of a Node
resiot_node_getname String, String String Gets the Name of a Node
resiot_node_settag String, String, String String Sets the Tag of a Node
resiot_node_setalias String, String, String String Sets the Alias of a Node
resiot_node_getmodel String, String Integer, String, Error Gets the Model code and Model name of a Node
resiot_resendchannelconfig String, String Error Force a resend of device channel configuration in the upcoming downlinks to the given device
resiot_getnodealerts String, String String, String Returns a JSON which contains all Alerts linked to the given Node. These Alerts can be created using resiot_alertelement function
resiot_getnodelostframescount String, String, Integer, Integer Integer, Integer, Integer, Error Returns the number of lost frames of a Node in the given period, the first FCount and the last FCount
resiot_node_setalivewithpayload String, String, String String Sets the Node last message alive and payload for Nodes with Generic Auth

resiot_getlastpayload(String, String)

Get the last Payload of a Node.
Example
Payload = resiot_getlastpayload(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

Returns
 - Payload (String): * The function returns the last Payload of the node. *

DevEUI = "0e7e346433306517"     -- The DevEUI of the node
AppEUI = "4d454e4f57415454"     -- The AppEUI of the node
Payload = resiot_getlastpayload(AppEUI, DevEUI)
resiot_debug(Payload)   -- Result Example: Payload = "1e563CDa"

Return to index


resiot_getlastpayloaddate (String, String)

Get the date (in seconds) of the last Payload of a Node.
Example
Date = resiot_getlastpayloaddate(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

Returns
 - Date (Integer): * The function returns the Date (in seconds) of the last Payload of the node based on the DevEUI and AppEUI. *

DevEUI = "0e7e346433306517"     -- The DevEUI of the node
AppEUI = "4d454e4f57415454"     -- The AppEUI of the node
Date = resiot_getlastpayloaddate(AppEUI, DevEUI)
resiot_debug(Date)      -- Result Example: Date = 1501235867  -->  28 July 2017 11:57:47

Return to index


resiot_setnodevalue(String, String, String, String)

Save the inserted value for the specified node field.
Example
AllWorked, Error = resiot_setnodevalue(AppEUI, DevEUI, Field, Value)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

 - Field (String): * The field of the node.
 - Value (String): * The content type of a Payload field.

Returns
 - AllWorked (Boolean): * The functions return true if everything worked fine. Otherwise it returns false.
 - Error (String): * If AllWorked is false, than the error is written here.

AppEUI = "0022117344261579"     -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"    -- The DevEUI of the node
Field1 = "Decibel"              -- The name of the field contained in the node
Field2 = "Description"          -- The name of the field contained in the node
Field3 = "Alarm"                -- The name of the field contained in the node
Value1 = 22                     -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have 22 so the content type would be Numeric
Value2 = "This is a new node"   -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have a string so the content type would be String
Value3 = true                   -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have true so the content type would be Boolean
AllWorked1, Error = resiot_setnodevalue(AppEUI, DevEUI, Field1, tostring(Value1))
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked1)
end
AllWorked2, Error = resiot_setnodevalue(AppEUI, DevEUI, Field2, tostring(Value2))
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked2)
end
AllWorked3, Error = resiot_setnodevalue(AppEUI, DevEUI, Field3, tostring(Value3))
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked3)
end

Return to index


resiot_setnodevalue_oid(String, String, String, String)

Save the inserted value for the specified node field only if the inserted value is different than the old one.
Example
AllWorked, Error = resiot_setnodevalue_oid(AppEUI, DevEUI, Field, Value)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

 - Field (String): * The Field of the node.
 - Value (String): * The content type of a Payload field.

Returns
 - AllWorked (Boolean): * The functions return true if everything worked fine. Otherwise it returns false.
 - Error (String): * If AllWorked is false, than the error is written here.

AppEUI = "0022117344261579"     -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"    -- The DevEUI of the node
Field1 = "Decibel"              -- The name of the field contained in the node
Field2 = "Description"          -- The name of the field contained in the node
Field3 = "Alarm"                -- The name of the field contained in the node
Value1 = 22                     -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have 22 so the content type would be Numeric
Value2 = "This is a new node"   -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have a string so the content type would be String
Value3 = true                   -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have true so the content type would be Boolean
AllWorked1, Error = resiot_setnodevalue_oid(AppEUI, DevEUI, Field1, tostring(Value1))
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked1)
end
AllWorked2, Error = resiot_setnodevalue_oid(AppEUI, DevEUI, Field2, tostring(Value2))
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked2)
end
AllWorked3, Error = resiot_setnodevalue_oid(AppEUI, DevEUI, Field3, tostring(Value3))
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked3)
end

Return to index


resiot_setnodevaluewithtime(String, String, String, String, Integer)

Save the inserted value for the specified node field in a determinated time.
Example
AllWorked, Error = resiot_setnodevaluewithtime(AppEUI, DevEUI, Field, Value, Date)
Input Parameters
 - DevEUI (String): * The DevEUI of the node.
 - AppEUI (String): * The AppEUI of the node.

 - Field (String): * The Field of the node.
 - Value (String): * The content type of a Payload field.

 - Date (Integer): * The date you want to set, express in seconds.
Returns
 - AllWorked (Boolean): * The functions return true if everything worked fine. Otherwise it returns false.

 - Error (String): * If AllWorked is false, than the error is written here. *

AppEUI = "0022117344261579"     -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"    -- The DevEUI of the node
Field1 = "Decibel"              -- The name of the field contained in the node
Field2 = "Description"          -- The name of the field contained in the node
Field3 = "Alarm"                -- The name of the field contained in the node
Value1 = 22                     -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have 22 so the content type would be Numeric
Value2 = "This is a new node"   -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have a string so the content type would be String
Value3 = true                   -- The input value, the content type field is based on the content type detected form the value
                                -- In this case we have true so the content type would be Boolean
Date = os.time() - 14400 -- Today's date in seconds - 4 hours in seconds
AllWorked1, Error = resiot_setnodevaluewithtime(AppEUI, DevEUI, Field1, tostring(Value1), Date)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked1)
end
AllWorked2, Error = resiot_setnodevaluewithtime(AppEUI, DevEUI, Field2, tostring(Value2), Date)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked2)
end
AllWorked3, Error = resiot_setnodevaluewithtime(AppEUI, DevEUI, Field3, tostring(Value3), Date)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- bool value successfull call
    resiot_debug(AllWorked3)
end

Return to index


resiot_node_getvalue (String, String, String)

Get the Content of a Payload field of a Node.
If the tag has never been assigned a value, it will return, by default, a 0 int value, a empty "" text or a false boolean depending on the type of the tag.
Example
Content, Error = resiot_node_getvalue(AppEUI, DevEUI, Tag)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

 - Tag (String): * The tag of a Payload field.
Returns
 - Content (String): * The function returns the value of a Payload field of a Node, based on its Tag.

 - Error (String): * If ContentType is empty, than the error is written here. *

AppEUI = "0022117344261579"     -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"    -- The DevEUI of the node
Tag = "Decibel"                 -- The name of the Tag field contained in the node
Content, Error = resiot_node_getvalue(AppEUI, DevEUI, Tag)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(Content)
end

Return to index


resiot_node_getvaluewithtime (String, String, String)

Get the Content of a Payload field of a Node and the Last Set Date of the Content in seconds.
If the tag has never been assigned a value, as Content it will return, by default, a 0 int value, a empty "" text or a false boolean depending on the type of the tag.
If the tag has never been assigned a value, as Last Set Date it will return, by default, a negative int value.
Example
Content, LastSetDate, Error = resiot_node_getvaluewithtime(AppEUI, DevEUI, Tag)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.
 - Tag (String): * The tag of a Payload field.
Returns
 - Content (String): * The function returns the value of a Payload field of a Node, based on its Tag.
 - LastSetDate (Integer): * The function returns the last set date of a Payload field of a Node in seconds, based on its Tag. Example: 1.544188463e+09 (It means 1.544.188.463 seconds)
 - Error (String): * If ContentType is empty, than the error is written here.

AppEUI = "0022117344261579"     -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"    -- The DevEUI of the node
Tag = "Decibel"                 -- The name of the Tag field contained in the node
Content, LastSetDate, Error = resiot_node_getvaluewithtime(AppEUI, DevEUI, Tag)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(Content)
    resiot_debug(LastSetDate)
end

Return to index


resiot_getnodevalues(String, String, []String)

Get the Content of multiple Payload fields of a Node. This function is faster than using resiot_node_getvalue multiple times.
If the tag has never been assigned a value, as Content it will return, by default, a 0 int value, a empty "" text or a false boolean depending on the type of the tag.
Example
FieldNames, FieldValues, Error = resiot_getnodevalues(AppEUI, DevEUI, Tags)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.
 - Tags ([]String): * The tags of Payload fields.
Returns
 - FieldNames ([]String): * The function returns the fields Tags names.
 - FieldValues ([]String): * The function returns the values of Payload fields of a Node, following FieldNames order.
 - Error (String): * The error description.

AppEUI = "0022117344261579"         -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"        -- The DevEUI of the node
Tags = {"Decibel", "Temperature"}   -- The name of the Tag fields contained in the node
FieldNames, FieldValues, Error = resiot_getnodevalues(AppEUI, DevEUI, Tags)
Decibel = ""
Temperature = ""
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- values read correctly
    FieldsLength = #FieldNames
    for i=1, FieldsLength, 1 do
        if FieldNames[i] == "Decibel" then
            Decibel = FieldValues[i]
        elseif FieldNames[i] == "Temperature" then
            Temperature = FieldValues[i]
        end
    end
    resiot_debug("Decibel: "..Decibel)
    resiot_debug("Temperature: "..Temperature)
end

Return to index


resiot_node_getlastvalues (String, String, String)

Get the current and previous value of a Payload field of a Node.
If the tag has never been assigned a value, it will return, by default, a 0 int value, a empty "" text or a false boolean depending on the type of the tag.
Example
CurrentValue, PreviousValue, Error = resiot_node_getlastvalues(AppEUI, DevEUI, Tag)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

 - Tag (String): * The tag of a Payload field.
Returns
 - CurrentValue (String): * The current value of a Payload field of a Node, based on its Tag.

 - PreviousValue (String): * The previous value of a Payload field of a Node, based on its Tag.
 - Error (String): * Error is written here.

AppEUI = "0022117344261579"     -- The AppEUI of the node
DevEUI = "bc004a30b3519f861"    -- The DevEUI of the node
Tag = "Decibel"                 -- The name of the Tag field contained in the node
CurrentValue, PreviousValue, Error = resiot_node_getlastvalues(AppEUI, DevEUI, Tag)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(CurrentValue)
    resiot_debug(PreviousValue)
end

Return to index


resiot_getnodedatafromtag(String)

Get the Node DevEUI and AppEUI with the Tag (not Field Tags).
Example
DevEUI, AppEUI = resiot_getnodedatafromtag(Tag)
Input Parameters
 - Tag (String): * The Tag of the node.
Returns
 - DevEUI (String): * The function returns the DevEUI of the node with the same Tag.

 - AppEUI (String): * The function returns the AppEUI of the node with the same Tag. *

Tag = "Tag" 
DevEUI, AppEUI = resiot_getnodedatafromtag(Tag)
resiot_debug(DevEUI)
resiot_debug(AppEUI)
-- 
-- Result Example:
-- 
-- DevEUI = "bc004a30b3519f861"
-- AppEUI = "0022117344261579"
-- 

Return to index


resiot_tx(String, String, String, String, String, String, Boolean, String, ...)

This function sends a message to a Node.
It is best used when you are sending non ascii characters because of its required hex encoding for the payload.
Example
Error = resiot_tx(Data, Port, DevEUI, AppEUI, HexID, Reference, AskConfirmation, Command)
Input Parameters
 - Data (String): * The message that you want to send. This message has to be HEX ENCODED.
 - Port (String): * The comunication port that you need to use to communicate with the Broker/WebSocket. (ex. 200)

 - DevEUI (String): * The Device EUI of the node you want to contact.
 - AppEUI (String): * The Application EUI connected to your node.

 - HexID (String): * The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message.
 - AskConfirmation (Boolean): * If set to true, the network server will notify you this communication with reference Reference(see above) has been received with a tx_confirm message.

 - Reference (String): * Usually(this depends on your Connector) a 8 character long string used by the network server to notify you when this particular transmission has been received. Can be left empty.
 - Command (String): * A string that is used to filter only determinated messages. If not needed it can be left empty.

 - Extra Params JSON (String): * 10 optional fields used to crete dynamic topics. For example if the server require to know the user's identity the "p0" field may be "User": "Admin".
Returns
 - Error (String): * If the DevEUI or the AppEUI aren't found or the desired connector is not found, it prints the error in the console, otherwise it doesn' t do anything.

Data = "4D657373616765"         --"Message"
Port = "200"                    -- The port number
DevEUI = "6a5d4b89457dac89"     -- The DevEUI of the node
AppEUI = "1684b596ad352c14"     -- The AppEUI of the node
HexID = "69643d31"              -- The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message
Reference = "abcdefgh"          -- When this particular transmission has been received. Can be left empty
Confirm = true                  -- Allows the reference of the comunication
Command = ""                    -- A string that is used to filter determinated messages. It can be left empty
Error = resiot_tx(Data, Port, DevEUI, AppEUI, HexID, Reference, Confirm, Command, "{"p0":"10"}")
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_txraw(String, String, String, String, String, String, Boolean, String, ...)

This function sends a message to a Node.
It is best used when you are sending ascii characters because of its simple payload format.
Example
Error = resiot_txraw(Data, Port, DevEUI, AppEUI, HexID, Reference, AskConfirmation, Command)
Input Parameters
 - Data (String): * The message that you want to send. This message MUST NOT BE ENCODED.
 - Port (String): * The comunication port that you need to use to communicate with the Broker/WebSocket. (ex. 200)

 - DevEUI (String): * The Device EUI of the node you want to contact.
 - AppEUI (String): * The Application EUI connected to your node.

 - HexID (String): * The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message.
 - AskConfirmation (Boolean): * If set to true, the network server will notify you this communication with reference Reference(see above) has been received with a tx_confirm message.

 - Reference (String): * Usually(this depends on your Connector) a 8 character long string used by the network server to notify you when this particular transmission has been received. Can be left empty.
 - Command (String): * A string that is used to filter only determinated messages. If not needed it can be left empty.

 - Extra Params JSON (String): * 10 optional fields used to crete dynamic topics. For example if the server require to know the user's identity the "p0" field may be "User": "Admin".
Returns
 - Error (String): * If the DevEUI or the AppEUI aren't found or the desired connector is not found, it prints the error in the console, otherwise it doesn't do anything.

Data = "Message"             -- This message MUST NOT BE ENCODED
Port = "200"                 -- The port number
DevEUI = "6a5d4b89457dac89"  -- The DevEUI of the node
AppEUI = "1684b596ad352c14"  -- The AppEUI of the node
HexID = "69643d31"           -- The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message
Reference = "abcdefgh"       -- When this particular transmission has been received. Can be left empty
Confirm = true               -- Allows the reference of the comunication
Command = ""                 -- A string that is used to filter determinated messages. It can be left empty
Error = resiot_txraw(Data, Port, DevEUI, AppEUI, HexID, Reference, Confirm, Command, "{"p0":"10"}")
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_tx_gw(String, String, String, String, String, String, Boolean, String, String, ...)

This function sends a message to a Broker/WebSocket.
It is best used when you are sending non ascii characters because of its required hex encoding for the payload.
Example
Error = resiot_tx_gw(Data, Port, DevEUI, AppEUI, HexID, Reference, AskConfirmation, Command, GwEUI)
Input Parameters
 - Data (String): * The message that you want to send. This message MUST BE ENCODED.
 - Port (String): * The comunication port that you need to use to communicate with the Broker/WebSocket. (ex. 200)

 - DevEUI (String): * The Device EUI of the node you want to contact.
 - AppEUI (String): * The Application EUI connected to your node.

 - HexID (String): * The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message.
 - AskConfirmation (Boolean): * If set to true, the network server will notify you this communication with reference Reference(see above) has been received with a tx_confirm message.

 - Reference (String): * Usually(this depends on your Connector) a 8 character long string used by the network server to notify you when this particular transmission has been received. Can be left empty.
 - Command (String): * A string that is used to filter only determinated messages. If not needed it can be left empty.


 - GwEUI (String): * The GwEUI of the desired Gateway.
 - Extra Params JSON (String): * 10 optional fields used to crete dynamic topics. For example if the server require to know the user's identity the "p0" field may be "User": "Admin".

Returns
 - Error (String): * If the DevEUI or the AppEUI aren't found or the desired connector is not found, it prints the error in the console, otherwise it doesn't do anything. *

Data = "4d657373616765"     -- The example means "Message" in HEX
Port = "200"                -- The port number
DevEUI = "6a5d4b89457dac89" -- The DevEUI of the node
AppEUI = "1684b596ad352c14" -- The AppEUI of the node
HexID = "69643d31"          -- The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message
Reference = "abcdefgh"      -- When this particular transmission has been received. Can be left empty
Confirm = true              -- Allows the reference of the comunication
Command = ""                -- A string that is used to filter determinated messages. It can be left empty
GwEUI = "010FE2fc230304AA"  -- The GwEUI of the desired Gateway
Error = resiot_tx_gw(Data, Port, DevEUI, AppEUI, HexID, Reference, Confirm, Command, GwEUI, "{"p0":"10"}")
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_txraw_gw(String, String, String, String, String, String, Boolean, String, String, ...)

This function sends a message to a Broker/WebSocket.
It is best used when you are sending ascii characters because of its simple payload format.
Example
Error = resiot_txraw_gw(Data, Port, DevEUI, AppEUI, IdHex, Reference, AskConfirmation, Command, GwEUI)
Input Parameters
 - Data (String): * The message that you want to send. This message MUST NOT BE ENCODED.
 - Port (String): * The comunication port that you need to use to communicate with the Broker/WebSocket. (ex. 200)

 - DevEUI (String): * The Device EUI of the node you want to contact.
 - AppEUI (String): * The Application EUI connected to your node.

 - IdHex (String): * The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message.
 - AskConfirmation (Boolean): * If set to true, the network server will notify you this communication with reference Reference(see above) has been received with a tx_confirm message.

 - Reference (String): * Usually(this depends on your Connector) a 8 character long string used by the network server to notify you when this particular transmission has been received. Can be left empty.
 - Command (String): * A string that is used to filter only determinated messages. If not needed it can be left empty.


 - GwEUI (String): * The GwEUI of the desired Gateway.

 - Extra Params JSON (String): * 10 optional fields used to crete dynamic topics. For example if the server require to know the user's identity the "p0" field may be "User": "Admin".

Returns
 - Error (String): * If the DevEUI or the AppEUI aren't found or the desired connector is not found, it prints the error in the console, otherwise it doesn't do anything. *

Data = "Message"            -- This message MUST NOT BE ENCODED
Port = "200"                -- The port number
DevEUI = "6a5d4b89457dac89" -- The DevEUI of the node
AppEUI = "1684b596ad352c14" -- The AppEUI of the node
IdHex = "69643d31"          -- The Connector Id that identifies the Broker/WebSocket/LoRaServer you want to use to send your message
Reference = "abcdefgh"      -- When this particular transmission has been received. Can be left empty
Confirm = true              -- Allows the reference of the comunication
Command = ""                -- A string that is used to filter determinated messages. It can be left empty
GwEUI = "010FE2fc230304AA"  -- The GwEUI of the desired Gateway
Error = resiot_txraw_gw(Data, Port, DevEUI, AppEUI, IdHex, Reference, Confirm, Command, GwEUI, "{"p0":"10"}")
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


This function set the Downlink counter of an ABP node.
If the node you are trying to set isn't an ABP or isn't connected no any LoRaServer, then this function will return an error.
Example
Error = resiot_setcounterdownlink(AppEUI, DevEUI, Downlink)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

 - Downlink (Integer): * The Downlink counter you want to set. It cannot have negative value.
Returns
 - Error (String): * If there is any type of error, like "wrong DevEUI" or "invalid Downlink value", it is specified here.

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
Downlink = 560                  -- The Downlink counter you want to set. It cannot have negative value
Error = resiot_setcounterdownlink(AppEUI,DevEUI,Downlink)
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


This function set the Uplink counter of an ABP node.
If the node you are trying to set isn't an ABP or isn't connected no any LoRaServer, then this function will return an error.
Example
Error = resiot_setcountetuplink(AppEUI, DevEUI, Uplink)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

 - Uplink (Integer): * The Uplink counter you want to set. It cannot have negative value.
Returns
 - Error (String): * If there is any type of error, like "wrong DevEUI" or "invalid Uplink value", it is specified here.

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
Uplink = 230                    -- The Uplink counter you want to set. It cannot have negative value
Error = resiot_setcountetuplink(AppEUI,DevEUI,Uplink)
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_downlinkqueue_deleteall (String, String)

This function delete the Downlink Queue. It returns an empty string if there is no error.
Example
Error = resiot_downlinkqueue_deleteall(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

Returns
 - Error (String): * If there is any type of error, like "Invalid LoRaServer", it is specified here. *

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
Error = resiot_downlinkqueue_deleteall(AppEUI, DevEUI)
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_setlatitudelongitude (String, String, Float, Float)

This function update the Latitude and the Longitude of a Node.
Example
Error = resiot_setlatitudelongitude (AppEUI, DevEUI, Latitude, Longitude)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

 - Latitude (Float): * The Latitude value you want to set.
 - Longitude (Float): * The Longitude value you want to set.

Returns
 - Error (String): * If there is any type of error, it is specified here. *

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
Latitude = 75.56                -- The Latitude value you want to set
Longitude = 14.28               -- The Longitude value you want to set
Error = resiot_setlatitudelongitude (AppEUI, DevEUI, Latitude, Longitude)
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_setlatitudelongitudewtime (String, String, Float, Float, Integer)

This function update the Latitude and the Longitude of a Node.
Example
Error = resiot_setlatitudelongitudewtime (AppEUI, DevEUI, Latitude, Longitude, Date)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

 - Latitude (Float): * The Latitude value you want to set.
 - Longitude (Float): * The Longitude value you want to set.

 - Date (Integer): * The date you want to set, express in seconds.
Returns
 - Error (String): * If there is any type of error, it is specified here.

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
Latitude = 75.56                -- The Latitude value you want to set
Longitude = 14.28               -- The Longitude value you want to set
Date = os.time() - 14400 -- today's date in seconds - 4 hours in seconds
Error = resiot_setlatitudelongitudewtime (AppEUI, DevEUI, Latitude, Longitude, Date)
if Error ~= "" then
    -- error
    resiot_debug(Error)
end

Return to index


resiot_getlastdatejoin (String, String)

This function retreive the date of the last Join of a Node.
Example
Date, Error = resiot_getlastdatejoin (AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

Returns
 - Date (Integer): * The date of the last Join, the format is in Unix Timestamp in seconds.
 - Error (String): * If there is any type of error, it is specified here.

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
Date, Error = resiot_getlastdatejoin (AppEUI, DevEUI)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(Date)
end

Return to index


resiot_getnodebyalias (String)

Retrieves the node appEui and devEui from its alias.
Example
AppEui, DevEui, Error = resiot_getnodebyalias(Alias)
Input Parameters
 - Alias (String): * The node alias.
Returns
 - AppEUI (String): * The Application EUI connected to your node.

 - DevEUI (String): * The Device EUI of your node.
 - Error (String): * If there is any type of error, it is specified here.

Alias = "pushbutton"
AppEUI, DevEUI, Error = resiot_getnodebyalias(Alias)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(AppEUI)
    resiot_debug(DevEUI)
end

Return to index


resiot_getnodebytag (String)

Retrieves the node appEui and devEui from its tag.
Example
AppEui, DevEui, Error = resiot_getnodebytag(Tag)
Input Parameters
 - Tag (String): * The node tag.
Returns
 - AppEUI (String): * The Application EUI connected to your node.

 - DevEUI (String): * The Device EUI of your node.
 - Error (String): * If there is any type of error, it is specified here.

Tag = "pushbutton"
AppEUI, DevEUI, Error = resiot_getnodebytag(Tag)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(AppEUI)
    resiot_debug(DevEUI)
end

Return to index


resiot_getnodealias (String, String)

Retrieves the node alias from its appEui and devEui.
Example
alias, Error = resiot_getnodealias(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

Returns
 - Alias (String): * The node alias.
 - Error (String): * If there is any type of error, it is specified here.

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
alias, Error = resiot_getnodealias(AppEUI, DevEUI)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(alias)
end

Return to index


resiot_getnodetag (String, String)

Retrieves the node tag from its appEui and devEui.
Example
tag, Error = resiot_getnodetag(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

Returns
 - Alias (String): * The node tag.
 - Error (String): * If there is any type of error, it is specified here.

AppEUI = "1684b596ad352c14"     -- The Application EUI connected to your node
DevEUI = "6a5d4b89457dac89"     -- The Device EUI of your node
tag, Error = resiot_getnodetag(AppEUI, DevEUI)
if Error ~= "" then
    -- error
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(tag)
end

Return to index


resiot_getnodegroup (String, String)

Retrieves the node group from its appEui and devEui.
Example
groupName, groupHexId, Error = resiot_getnodegroup(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

Returns
 - Node Group Name (String): * The node group's name. Can be empty if a device does not have a group assigned.
 - Node Group Hex Id (String): * The node group's Hex Id. Can be empty if a device does not have a group assigned.

 - Error (String): * If not empty, an error occurred, the error message will be in this field and the two other fields will be empty string.. *

appeui = "1684b596ad352c14" -- The Application EUI connected to your node
deveui = "6a5d4b89457dac89" -- The Device EUI of your node
groupname, groupxhexid, err = resiot_getnodegroup(appeui, deveui)

if err ~= "" then
    resiot_debug(err) --prints the error encounter by ResIOT in retrieving the device group data
else
    resiot_debug(groupname) --prints the device group name
    resiot_debug(groupxhexid) --prints the device group hex Id
end

Return to index


resiot_getnodegroup2 (String, String)

Retrieves the node group 2 from its appEui and devEui.
Example
groupName, groupHexId, Error = resiot_getnodegroup2(AppEUI, DevEUI)
Input Parameters
 - AppEUI (String): * The Application EUI connected to your node.
 - DevEUI (String): * The Device EUI of your node.

Returns
 - Node Group Name (String): * The node group 2's name. Can be empty if a device does not have a group2 assigned.
 - Node Group Hex Id (String): * The node group 2's Hex Id. Can be empty if a device does not have a group2 assigned.

 - Error (String): * If not empty, an error occurred, the error message will be in this field and the two other fields will be empty string.. *

appeui = "1684b596ad352c14" -- The Application EUI connected to your node
deveui = "6a5d4b89457dac89" -- The Device EUI of your node
groupname, groupxhexid, err = resiot_getnodegroup2(appeui, deveui)

if err ~= "" then
    resiot_debug(err) --prints the error encounter by ResIOT in retrieving the device group data
else
    resiot_debug(groupname) --prints the device group name
    resiot_debug(groupxhexid) --prints the device group hex Id
end

Return to index


resiot_maccommand_send(String, String)

Enqueues a mac maccomand to the device mac command list. The server will try to send it on the next downlink.
This is for experienced users only, and might cause loss of communication with your devices. Use at your own risk.
The supported commands, at the moment, are RXTimingSetupReq and RXParamSetupReq.
The RXTimingSetupReq payload has to be a valid json {"delay": int}
The RXParamSetupReq payload has to be a valid json {"frequency": int,"dlSettings": {"rx2DataRate": int,"rx1DROffset": int}}
Example
err = resiot_maccommand_send(AppEUI, DevEUI, commandName, commandPayload)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

 - commandName (String): *
 - commandPayload (String): *

Returns
 - Error (String): * If not empty, this contains the error encountered. *

appeui="2324242424224242"
deveui="9999999999999999"
commandName = "RXTimingSetupReq"
commandPayload = "{\"delay\": 1}"
err = resiot_maccommand_send(appeui, deveui, commandName, commandPayload)
resiot_debug(err)

commandName = "RXParamSetupReq"
payload = "{\"frequency\": 869525000,\"dlSettings\": {\"rx2DataRate\": 0,\"rx1DROffset\": 0}}"
err = resiot_maccommand_send(appeui, deveui, commandName, commandPayload)
resiot_debug(err)

Return to index


resiot_nodecommandstart(String, String, String, String)

Executes the selected Node Command of a specific Node.
The InputFields parameter has to be a valid json array like [{"Name":"","Value":""}]. For each command input field you need to insert an element in the json array. "Value" field in json is always a string, then it is converted in the right format, so if you want to insert a number use this sintax: "Value":"15".
Example
ok, err = resiot_nodecommandstart(AppEUI, DevEUI, CommandTag, InputFields)
Input Parameters
 - AppEUI (String): * The AppEUI of the node.
 - DevEUI (String): * The DevEUI of the node.

 - CommandTag (String): *
 - InputFields (String): *

Returns
 - Ok (Boolean): * This contains true if the command has been executed, otherwise it contains false.
 - Error (String): * If not empty, this contains the error encountered.

appeui="2324242424224242"
deveui="9999999999999999"
commandTag = "SetLatitudeLongitude"
inputFields = '[{"Name":"Latitude","Value":"40.78"},{"Name":"Longitude","Value":"23.56"}]'
ok, err = resiot_nodecommandstart(appeui, deveui, commandTag, inputFields)
resiot_debug(ok)
resiot_debug(err)

Return to index


resiot_node_setname(String,String,String)

Sets the Name of a Node.
Example
Error = resiot_node_setname(AppEUI,DevEUI,newName)
Input Parameters
 - AppEUI (String): * The AppEUI of the Node you want to set the Name.
 - DevEUI (String): * The DevEUI of the Node you want to set the Name.

 - newName (String): * The Name you want to set to the selected Node. The max accepted length is 255 characters.
Returns
 - Error (String): * Error string.

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"
newName = "Node Name test"

Error = resiot_node_setname(AppEUI,DevEUI,newName)
if Error ~= "" then
    -- error 
    resiot_debug(Error)
else
    -- value set correctly
end

Return to index


resiot_node_getname(String,String)

Gets the Name of a Node. If the Node is not found it returns an empty string.
Example
NodeName = resiot_node_getname(AppEUI,DevEUI)
Input Parameters
 - AppEUI (String): * The AppEUI of the Node you want to get the Name.
 - DevEUI (String): * The DevEUI of the Node you want to get the Name.

Returns
 - NodeName (String): * The Name of the Node. If the Node is not found it contains an empty string. *

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"

NodeName = resiot_node_getname(AppEUI,DevEUI)
if NodeName ~= "" then
    resiot_debug(NodeName)
end

Return to index


resiot_node_settag(String,String,String)

Sets the Tag of a Node.
Example
Error = resiot_node_settag(AppEUI,DevEUI,Tag)
Input Parameters
 - AppEUI (String): * The AppEUI of the Node you want to set the Tag.
 - DevEUI (String): * The DevEUI of the Node you want to set the Tag.

 - Tag (String): * The Tag you want to set to the selected Node.
Returns
 - Error (String): * Error string.

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"
Tag = "NewTagNode"

Error = resiot_node_settag(AppEUI,DevEUI,Tag)
if Error ~= "" then
    -- error 
    resiot_debug(Error)
else
    -- value set correctly
end

Return to index


resiot_node_setalias(String,String,String)

Sets the Alias of a Node.
Example
Error = resiot_node_setalias(AppEUI,DevEUI,Alias)
Input Parameters
 - AppEUI (String): * The AppEUI of the Node you want to set the Alias.
 - DevEUI (String): * The DevEUI of the Node you want to set the Alias.

 - Alias (String): * The Alias you want to set to the selected Node.
Returns
 - Error (String): * Error string.

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"
Alias = "NewAliasNode"

Error = resiot_node_setalias(AppEUI,DevEUI,Alias)
if Error ~= "" then
    -- error 
    resiot_debug(Error)
else
    -- value set correctly
end

Return to index


resiot_node_getmodel(String,String)

Gets the Model code and Model name of a Node.
Example
ModelCode, ModelName, Error = resiot_node_getmodel(AppEUI,DevEUI)
Input Parameters
 - AppEUI (String): * The AppEUI of the Node you want to get the Model.
 - DevEUI (String): * The DevEUI of the Node you want to get the Model.

Returns
 - ModelCode (Integer): * The Model code of the Node.
 - ModelName (String): * The Model name of the Node.

 - Error (String): * Error string. *

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"

ModelCode, ModelName, Error = resiot_node_getmodel(AppEUI,DevEUI)
if Error ~= "" then
    -- error 
    resiot_debug(Error)
else
    resiot_debug(ModelCode)
    resiot_debug(ModelName)
end

Return to index


resiot_resendchannelconfig(String,String)

Force a resend of device channel configuration in the upcoming downlinks to the given device. This is the equivalent of pressing the Reset channel list in the channel configuration panel inside the device editing page.
Example
Error = resiot_resendchannelconfig(AppEUI,DevEUI)
Input Parameters
 - AppEUI (String): * The AppEUI of the device
 - DevEUI (String): * The DevEUI of the device

Returns
 - Error (String): * Error string. *

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"

err = resiot_resendchannelconfig(AppEUI,DevEUI)
if err ~= "" then
    -- error 
    resiot_debug(err)
end

Return to index


resiot_getnodealerts(String,String)

Returns a JSON which contains all Alerts linked to the given Node. These Alerts can be created using resiot_alertelement function.
Example
Result, Error = resiot_getnodealerts(AppEUI,DevEUI)
Input Parameters
 - AppEUI (String): * The AppEUI of the device
 - DevEUI (String): * The DevEUI of the device

Returns
 - Result (String): * A JSON which contains all Alerts linked to the given Node.
 - Error (String): * Error string.

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"

Result, err = resiot_getnodealerts(AppEUI,DevEUI)
if err ~= "" then
    -- error 
    resiot_debug(err)
else
    resiot_debug(Result)
end

Return to index


resiot_getnodelostframescount(String,String,Integer,Integer)

Returns the number of lost frames of a Node in the given period, the first Frame Count and the last Frame Count.
Example
LostFrames, FirstFrame, LastFrame, Error = resiot_getnodelostframescount(AppEUI,DevEUI,StartTime,EndTime)
Input Parameters
 - AppEUI (String): * The AppEUI of the device
 - DevEUI (String): * The DevEUI of the device

 - StartTime (Integer): * The Start of the period in seconds
 - EndTime (Integer): * The End of the period in seconds

Returns
 - LostFrames (Integer): * The total number of lost frames in the period.
 - FirstFrame (Integer): * The frame counter of the first frame of the period.

 - LastFrame (Integer): * The frame counter of the last frame of the period.
 - Error (String): * Error string.

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"
StartTime = os.time{year=2022, month=1, day=1, hour=0, min=0, sec=0}
EndTime = os.time{year=2022, month=1, day=2, hour=0, min=0, sec=0}

LostFrames, FirstFrame, LastFrame, err = resiot_getnodelostframescount(AppEUI,DevEUI,StartTime,EndTime)
if err ~= "" then
    -- error 
    resiot_debug(err)
else
    resiot_debug(LostFrames)
    resiot_debug(FirstFrame)
    resiot_debug(LastFrame)
end

Return to index


resiot_node_setalivewithpayload(String,String,String)

Sets the Node last message alive and payload for Nodes with Generic Auth.
Example
Error = resiot_node_setalivewithpayload(AppEUI,DevEUI,Payload)
Input Parameters
 - AppEUI (String): * The AppEUI of the device
 - DevEUI (String): * The DevEUI of the device

 - Payload (Integer): * The Payload to set
Returns
 - Error (String): * Error string.

AppEUI = "2324242424224242"
DevEUI = "3924798378547435"

Error = resiot_node_setalivewithpayload(AppEUI,DevEUI,Payload)
if Error ~= "" then
    -- error 
    resiot_debug(Error)
end

Return to index