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:

  1. table or nil Status table
  2. nil or string error message

Usage:

    local info = netio1:info()
instance:general_info ()
Get device informations like serial number, firmware version etc.

Returns:

  1. table or nil Agent table
  2. 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:

  1. table or nil Outputs table
  2. 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:

  1. table or nil GlobalMeasure table
  2. 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
    • url string URL or IP of the netio you want to speak with
    • port int Additional port (can also be written directly into the URL) (optional)
    • user string Name of the user, who has the right to read and/or write to the API (optional)
    • pass string The password of the user (optional)

Returns:

    object Instance table

Usage:

    local Netio = require('netio.json')
    local netio_socket = Netio.new({
        url = 'http://netio.de',
        user = 'demo',
        pass = 'demo'
      })
generated by LDoc 1.4.6 Last updated 2018-10-17 11:41:24