Library to control outputs of NETIO 4 smart power sockets from NETIO products a.s. https://www.netio-products.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sebastian c8a816b4e4 Merge branch 'develop' of imo/lua-netio into master 1 year ago
docs Updated documentation 1 year ago
examples Updated documentation 1 year ago
spec make linter happy 1 year ago
src make linter happy 1 year ago
.drone.yml .drone.yml: fixed typo 1 year ago
.luacheckrc added .luackechrc 1 year ago
LICENSE LICENSE: added year and name 1 year ago
README.md README: fixed typo 1 year ago

README.md

lua-netio

Description

lua-netio is a library to control outputs of NETIO 4x smart power sockets from NETIO products a.s.. These Ethernet- or WiFi-connected power sockets can be accessed using a varity of protocols and M2M-API methods, including HTTP(s) CGI, Telnet, XML, JSON and many more.

Currently implemented:

TODO

  • implement Telnet (Offical doc)
  • implement Telnet support for NETIO 230B (older model) (Offical doc)
  • add rockspec

I’m not planing to implement the XML API, because in my opinion the JSON API is enough, but if someone want to contribute, do it :)

Example Usage

local Netio = require('netio')
local netio1 = Netio.new({
    url = 'http://netio-4.netio-products.com',
    port = 8080,
    user = 'write',
    pass= 'demo',
    api = 'json'
  })

local resp, err = netio1:outputs_info(1)
print('Current state of Output1 is ' .. resp.State)
resp, err = netio1:outputs_toggle(1)
print('State after toggle of Output1 is ' .. resp[1].State)

Documentation

Documentation was generated with LDoc and can be read here: https://imolein.github.io/lua-netio/

Dependencies

Tests

You need busted to run the tests.

busted spec/

Some tests might fail sporadically. That’s because the demo instaces sporadically rejects the commands silently and just return the status JSON object. If you take a look into the NETIO’s logfile, you see that the command is rejected, but not why.