Difference between revisions of "NETIO Specific Reference manual"
								
								Jump to navigation
				Jump to search
				
				
		
XML Processing 
JSON Processing 
Modbus 
MQTT 
					
								
							
		 (Created page with "== Script triggers ==  * Power measurements changed * Global power characteristics changed * Schedule...")  | 
				 (→Socket System Management)  | 
				||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
== Script triggers ==    | == Script triggers ==    | ||
| − | * [[Power measurements changed|Power measurements changed]]  | + | * [[Power measurements changed|Power measurements changed]]<sup><code>3.3.1</code></sup>  | 
| − | * [[Global power characteristics changed|Global power characteristics changed]]  | + | * [[Global power characteristics changed|Global power characteristics changed]]<sup><code>3.3.1</code></sup>  | 
* [[Schedule has started or stopped|Schedule has started or stopped]]  | * [[Schedule has started or stopped|Schedule has started or stopped]]  | ||
* [[Incoming URL API request|Incoming URL API request]]  | * [[Incoming URL API request|Incoming URL API request]]  | ||
* [[System started up|System started up]]  | * [[System started up|System started up]]  | ||
| − | * [[Mqtt was disconnected from the broker|Mqtt was disconnected from the broker]]  | + | * [[Mqtt was disconnected from the broker|Mqtt was disconnected from the broker]]<sup><code>3.3.1</code></sup>  | 
| − | * [[Mqtt received message on subscribed topic|Mqtt received message on subscribed topic]]  | + | * [[Mqtt received message on subscribed topic|Mqtt received message on subscribed topic]]<sup><code>3.3.1</code></sup>  | 
* [[System variables updated|System variables updated]]  | * [[System variables updated|System variables updated]]  | ||
| − | * [[Mqtt has connected to the broker|Mqtt has connected to the broker]]  | + | * [[Mqtt has connected to the broker|Mqtt has connected to the broker]]<sup><code>3.3.1</code></sup>  | 
* [[DO state changed|DO state changed]]  | * [[DO state changed|DO state changed]]  | ||
| − | |||
== Outlet Management ==  | == Outlet Management ==  | ||
| Line 30: | Line 29: | ||
* number [[Number devices.system.totalSpace|.totalSpace]] - total 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)  | * 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.voltage|.voltage]] <sup><code>3.0.0</code></sup> - socket's voltage  | 
| − | * number [[Number devices.system.overallPowerFactor|.overallPowerFactor]] - overall power factor  | + | * number [[Number devices.system.overallPowerFactor|.overallPowerFactor]] <sup><code>3.0.0</code></sup> - overall power factor  | 
| − | * number [[Number devices.system.frequency|.frequency]] - socket's frequency  | + | * number [[Number devices.system.frequency|.frequency]] <sup><code>3.0.0</code></sup> - socket's frequency  | 
| − | * number [[Number devices.system.totalCurrent|.totalCurrent]] - total current through socket  | + | * number [[Number devices.system.totalCurrent|.totalCurrent]] <sup><code>3.0.0</code></sup> - total current through socket  | 
| − | * number [[Number devices.system.totalLoad|.totalLoad]] - total load on socket  | + | * number [[Number devices.system.totalLoad|.totalLoad]] <sup><code>3.0.0</code></sup> - total load on socket  | 
| − | * number [[Number devices.system.totalEnergy|.totalEnergy]] - total energy consumed by socket  | + | * number [[Number devices.system.totalEnergy|.totalEnergy]] <sup><code>3.0.0</code></sup> - total energy consumed by socket  | 
| − | * string [[Number devices.system.energyStart|.energyStart]] - time of last consumption reset  | + | * string [[Number devices.system.energyStart|.energyStart]] <sup><code>3.0.0</code></sup> - time of last consumption reset  | 
| − | |||
== Socket Communication ==  | == Socket Communication ==  | ||
Latest revision as of 19:45, 11 July 2019
Contents
Script triggers
- Power measurements changed
3.3.1 - Global power characteristics changed
3.3.1 - Schedule has started or stopped
 - Incoming URL API request
 - System started up
 - Mqtt was disconnected from the broker
3.3.1 - Mqtt received message on subscribed topic
3.3.1 - System variables updated
 - Mqtt has connected to the broker
3.3.1 - DO state changed
 
Outlet Management
devices.system
- function .SetOut() - turns the outlet on or off
 - function .ResetOut() - turns the outlet off and then resets its previous state
 - string .output1_state - outlet's state
 - number .output1_consumption - outlet's consumption (in Watts)
 - number .output1_cumulatedConsumption - outlet's consumed energy (in Watthours)
 - function .resetCumulativeConsumption() - resets outlet's energy counter
 - string .output1_consumptionStart - date and time since the last energy counter reset
 
Socket System Management
devices.system
- number .averageLoad - socket's CPU load
 - function .Reboot() - reboot socket's system
 - number .sessionCount - number of connected users
 - number .freeSpace - free disk space
 - number .totalSpace - total disk space
 - string .serialNumber 
3.3.1- returns serial number of the device (Eth Interface MAC address) - number .voltage 
3.0.0- socket's voltage - number .overallPowerFactor 
3.0.0- overall power factor - number .frequency 
3.0.0- socket's frequency - number .totalCurrent 
3.0.0- total current through socket - number .totalLoad 
3.0.0- total load on socket - number .totalEnergy 
3.0.0- total energy consumed by socket - string .energyStart 
3.0.0- time of last consumption reset 
Socket Communication
- function ping() - tests socket's network responsivity
 - function mail() - sends e-mail
 - function devices.system.CustomCGI() - send HTTP request
 - function cgiGet() 
2.3.5- send HTTP request and receive response - table event.args - HTTP GET /event variables table
 - function snmpGet() 
3.3.1- send SNMP request 
XML Processing 2.3.6
xml
- function .escape() - escapes XML string to fit xml node contents
 - function .check() - tests if string is well-formed XML
 - function .parse() - parses XML string into XmlElement object
 
JSON Processing 3.3.1
json
- function .decode() - parse json string into obj table
 - function .encode() - generate JSON string from table
 
(based on dkjson)
Modbus 3.3.1
Read functions
- function modbusReadCoil() - read value from coil
 - function modbusReadDiscreteInput() - read value from discrete input
 - function modbusReadHoldingRegister() - read value from holding register
 - function modbusReadInputRegister() - read value from input register
 
Write functions
- function modbusWriteSingleCoil() - write value to single coil
 - function modbusWriteSingleRegister() - write value to single register
 
MQTT 3.3.1
- function .MqttLuaSubscribe() - subscribe to MQTT topic
 - function .MqttPublish() - send message to MQTT topic
 
Standard Lua Functions
- function assert(), error() issues an error
 - function ipairs(), pairs(), next() traverse tables
 - function tonumber(), tostring() data type conversion
 - function pcall() protected call function (handles error inside the function)
 - function select() selects from multiple return value
 - function unpack converts table into multiple values
 - function type() returns variable type
 - function os.date(), os.time() system date and time
 - function os.difftime() returns time span between two times
 
Miscellaneous
- function log() - insert a record to the socket's event log
 - function logf() - insert a formated record (incl. numbers) to the socket's event log
 - function delay() - execute function with delay (seconds)
 - function milliDelay() - execute function with delay (milliseconds)
 - function toboolean() - converts any variable to boolean type