Module netio.json
Implements the JSON API: Protocol version: JSON API Version 2.0(PDF)
Functions
instance:info () | Get all status informations from the device |
instance:general_info () | Get device informations like serial number, firmware version etc. |
instance:outputs_info ([id]) | Get output informations about a specific or all outputs |
instance:measure_info () | Get global metering informations like voltage, frequency et cetera |
new (opts) | Creates new instance. |
Functions
- instance:info ()
-
Get all status informations from the device
Returns:
- table or nil Status table
- nil or string error message
Usage:
local info = netio1:info()
- instance:general_info ()
-
Get device informations
like serial number, firmware version etc.
Returns:
- table or nil Agent table
- nil or string error message
Usage:
local info = netio1:general_info()
- instance:outputs_info ([id])
-
Get output informations
about a specific or all outputs
Parameters:
- id int Output ID (optional)
Returns:
- table or nil Outputs table
- nil or string error message
Usage:
local outputs = netio1:output_info() local output1 = netio1:output_info(2)
- instance:measure_info ()
-
Get global metering informations
like voltage, frequency et cetera
Returns:
- table or nil GlobalMeasure table
- nil or string error message
Usage:
local info = netio1:measure_info()
- new (opts)
-
Creates new instance.
After instantiated, also all methods from web_core are available.
Parameters:
- opts options table with arguments
Returns:
-
object
Instance table
Usage:
local Netio = require('netio.json') local netio_socket = Netio.new({ url = 'http://netio.de', user = 'demo', pass = 'demo' })