Skip to main content

Interface to control NETIO Products devices

Project description


python 3 Bindings and CLI for communication with NETIO Products devices

Install the latest package from pip

pip install Netio --upgrade

API Interface

Login to your device and enable JSON API

Configure Interface

Import Netio and create new instance with endpoint

from Netio import Netio

n = Netio('http://netio-4ll.local:8080/netio.json', auth_rw=('admin', 'password'))


When using HTTPS, you must provide correct certificate, or disable certificate verification altogether.

  1. Under Settings->Network Configuration enter correct hostname and domain.
  2. Goto Settings->Security Settings and select Generate new certificate
  3. Download the certificate from your browser using browser

If you're accessing Netio wia IP address, set verify=False to disable certificate verification.

Finally add verify parameter with path to downloaded certificate.

n = Netio('http://netio-4ll.local:8080/netio.json', auth_rw=('admin', 'password'), verify='/path/to/cert.pem')


to set the output use either action, or integer value

>>> n.set_output(1, 0)            # Set output 1 off
>>> n.set_output(1, n.ACTION.ON)  # Set output 1 on

To read the states of the outputs

>>> for x in range(4):
>>>    print(n.get_output(x))
Output(ID=1, Name='out_1', State=1, Action=1, Delay=500, Current=0, PowerFactor=0.0, Load=0, Energy=13346833)
Output(ID=2, Name='out_2', State=0, Action=0, Delay=500, Current=0, PowerFactor=0.0, Load=0, Energy=2311032)
Output(ID=3, Name='out_3', State=1, Action=1, Delay=500, Current=8610, PowerFactor=1.0, Load=2062, Energy=11387035)
Output(ID=4, Name='out_4', State=1, Action=1, Delay=500, Current=11540, PowerFactor=1.0, Load=2768, Energy=21077736)

CLI Interface

usage: Netio [-h] [-u U] [-p P] [-C] [-c CFG] [-v] [--no-cert-warning] [--version] DEVICE COMMAND ...

positional arguments:
  DEVICE                Netio device URL or alias from config
  COMMAND               device command
    get (GET, G, g)     GET output state
    set (SET, S, s)     SET output state
    info (INFO, I, i)   show device info

optional arguments:
  -h, --help            show this help message and exit
  -u U, --user U        M2M API username
  -p P, --password P    M2M API password
  -C, --cert            HTTPS Certificate
  -c CFG, --config CFG  Configuration file
  -v, --verbose         increase verbosity
  --no-cert-warning     Disable warnings about certificate's subjectAltName versus commonName
  --version             show program's version number and exit


Netio CLI supports 3 different commands, here are some examples about how to use them. For more detailed description see Netio device CMD --help


Prints current state of outputs from device. Unless specified otherwise, all are returned

$ NETIO_PASSWORD=secretPass Netio -u read http://netio.local GET
id      State   Action  Delay   Current PFactor Load    Energy  Name
1       1       IGNORED 5000    0       0.0     0       2500    MyNetioOutput12
2       1       IGNORED 5000    127     0.58    17      2363    output_2
3       1       IGNORED 5000    0       0.0     0       0       output_3
4       1       IGNORED 5000    0       0.0     0       1327    Notebook

By default, the header with description is shown, it can be switched off with --no-header. Default delimiter is tab, that can be changed with --delimiter ';' of -d\;

$ NETIO_PASSWORD=secretPass Netio -u read http://netio.local GET --delimiter ';' --no-header

To request single output just add positional argument with output ID

$ NETIO_PASSWORD=secretPass Netio -u read http://netio.local GET 2
id      State   Action  Delay   Current PFactor Load    Energy  Name
2       1       IGNORED 5000    80      0.49    9       2365    output_2


SET takes positional argument pairs ID - ACTION. At least one pair has to be provided. Non zero value is returned when request does not succeed.

$ NETIO_PASSWORD=secretPass Netio -u write http://netio.local SET 1 ON 2 OFF 3 OFF
$ echo $?

To set action of all outputs at once, use ALL as ID.

$ NETIO_PASSWORD=secretPass Netio -u write http://netio.local SET ALL TOGGLE

Warning: When toggling all outputs at once there is no delay in between, with high loads this can cause current spike and trigger your breakers.


Reports the state of the device

$ Netio -u write -p SecretPass http://netio.local INFO
   Model               NETIO 4All
   Version             3.4.0
   JSONVer             2.1
   DeviceName          myNetio
   VendorID            0
   OemID               0
   SerialNumber        24:A4:2C:33:27:78
   Uptime              1456245
   Time                2020-06-01T13:15:27+01:00
   NumOutputs          4
   Voltage             230.6
   Frequency           49.9
   TotalCurrent        85
   OverallPowerFactor  0.51
   TotalLoad           10
   TotalEnergy         6195
   EnergyStart         2020-03-31T06:38:11+01:00

Configuration file

You can also use configuration file, specified wia --config netio.ini or wia NETIO_CONFIG environment variable. For explanation and example of the file configuration see examples


Specifying credentials wia command line arguments is not prohibited, but it's advised against, as anyone on the system can see your username and password.

You can specify username and password either wia configuration file or wia Environmental variables

  • NETIO_USER for username.
  • NETIO_PASSWORD for password.

Parameter lookup

when supplying for example password, it's looked up in this order:

  1. command line argument
  2. ENV variable
  3. configuration file (if supplied)
    1. special section
    2. DEFAULT section
  4. Default value (if applicable)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netio-1.0.13.tar.gz (10.2 kB view hashes)

Uploaded source

Built Distribution

netio-1.0.13-py3-none-any.whl (11.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page