Skip to content

imolein/lua-netio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Library to control outputs of NETIO 4 smart power sockets from https://www.netio-products.com

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages