Difference between revisions of "NETIO Lua Reference"

From wiki.netio-products.com
Jump to navigation Jump to search
(Redirected page to NETIO Specific Reference manual)
(Tag: New redirect)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Outlet Management ==
+
#REDIRECT [[NETIO Specific Reference manual]]
<big><b> devices.system </b></big>
 
* function [[Function devices.system.SetOut()|.SetOut()]] - turns the outlet on or off
 
* function [[Function devices.system.ResetOut()|.ResetOut()]] - turns the outlet off and then resets its previous state
 
* string [[String devices.system.output1_state|.output1_state]] - outlet's state
 
* number [[Number devices.system.output1_consumption|.output1_consumption]] - outlet's consumption (in Watts)
 
* number [[Number devices.system.output1_cumulatedConsumption|.output1_cumulatedConsumption]] - outlet's consumed energy (in Watthours)
 
* function [[Function devices.system.resetCumulativeConsumption()|.resetCumulativeConsumption()]] - resets outlet's energy counter
 
* string [[String devices.system.output1_consumptionStart|.output1_consumptionStart]] - date and time since the last energy counter reset
 
 
 
== Socket System Management ==
 
<big><b> devices.system</b> </big>
 
* number [[number devices.system.averageLoad|.averageLoad]] - socket's CPU load
 
* function [[Function devices.system.Reboot()|.Reboot()]] - reboot socket's system
 
* number [[Number devices.system.sessionCount|.sessionCount]] - number of connected users
 
* number [[Number devices.system.freeSpace|.freeSpace]] - free disk space
 
* number [[Number devices.system.totalSpace|.totalSpace]] - total disk space
 
* string [[String devices.system.serialNumber|.serialNumber]] <sup><code>3.3.1</code></sup> - returns serial number of the device (Eth Interface MAC address)
 
* number [[Number devices.system.voltage|.voltage]] - socket's voltage
 
* number [[Number devices.system.overallPowerFactor|.overallPowerFactor]] - overall power factor
 
* number [[Number devices.system.frequency|.frequency]] - socket's frequency
 
* number [[Number devices.system.totalCurrent|.totalCurrent]] - total current through socket
 
* number [[Number devices.system.totalLoad|.totalLoad]] - total load on socket
 
* number [[Number devices.system.totalEnergy|.totalEnergy]] - total energy consumed by socket
 
* string [[Number devices.system.energyStart|.energyStart]] - time of last consumption reset
 
 
 
 
 
== Socket Communication ==
 
* function [[Function ping()|ping()]] - tests socket's network responsivity
 
* function [[Function mail()|mail()]] - sends e-mail
 
* function [[Function devices.system.CustomCGI()|devices.system.CustomCGI()]] - send HTTP request
 
* function [[Function cgiGet()|cgiGet()]] <sup><code>2.3.5</code></sup> - send HTTP request and receive response
 
* table [[Table event.args|event.args]] - HTTP GET /event variables table
 
* function [[Function snmpGet()|snmpGet()]] <sup><code>3.3.0</code></sup> - send SNMP request
 
 
 
== XML Processing <sup><code>2.3.6</code></sup> ==
 
<big><b>xml</b></big>
 
* function [[Function xml.escape()|.escape()]] - escapes XML string to fit xml node contents
 
* function [[Function xml.check()|.check()]] - tests if string is well-formed XML
 
* function [[Function xml.parse()|.parse()]] - parses XML string into [[Function xml.parse()#XmlElement|XmlElement]] object
 
 
 
== JSON Processing <sup><code>3.3.1</code></sup> ==
 
<big><b>json</b></big>
 
* function [[Function json.decode()|.decode()]] - parse json string into obj table
 
* function [[Function json.encode()|.encode()]] - generate JSON string from table
 
 
 
(based on [http://dkolf.de/src/dkjson-lua.fsl/home dkjson])
 
 
 
== Modbus <sup><code>3.3.0</code></sup>==
 
<big><b>Read functions</b></big>
 
* function [[Function modbusReadCoil()|modbusReadCoil()]] - read value from coil
 
* function [[Function modbusReadDiscreteInput()|modbusReadDiscreteInput()]] - read value from discrete input
 
* function [[Function modbusReadHoldingRegister()|modbusReadHoldingRegister()]] - read value from holding register
 
* function [[Function modbusReadInputRegister()|modbusReadInputRegister()]] - read value from input register
 
 
 
<big><b>Write functions</b></big>
 
* function [[Function modbusWriteSingleCoil()|modbusWriteSingleCoil()]] - write value to single coil
 
* function [[Function modbusWriteSingleRegister()|modbusWriteSingleRegister()]] - write value to single register
 
 
 
== Standard Lua Functions ==
 
* function [https://www.lua.org/pil/8.3.html assert(), error()] issues an error
 
* function [https://www.lua.org/pil/7.3.html ipairs(), pairs(), next()] traverse tables
 
* function [https://www.lua.org/pil/2.4.html tonumber(), tostring()] data type conversion
 
* function [https://www.lua.org/pil/8.4.html pcall()] protected call function (handles error inside the function)
 
* function [https://www.lua.org/pil/5.2.html select()] selects from multiple return value
 
* function [https://www.lua.org/pil/2.html unpack] converts table into multiple values
 
* function [https://www.lua.org/pil/2.html type()] returns variable type
 
* function [https://www.lua.org/pil/22.1.html os.date(), os.time()] system date and time
 
* function os.difftime() returns time span between two times
 
 
 
== Miscellaneous ==
 
* function [[Function log()|log()]] - insert a record to the socket's event log
 
* function [[Function logf()|logf()]] - insert a formated record (incl. numbers) to the socket's event log
 
* function [[Function delay()|delay()]] - execute function with delay (seconds)
 
* function [[Function milliDelay()|milliDelay()]] - execute function with delay (milliseconds)
 
* function [[Function toboolean()|toboolean()]] - converts any variable to boolean type
 

Latest revision as of 18:51, 11 July 2019