Skip to main content

PyNetioConf

A Python module for configuring, controlling and monitoring NETIO devices with a unified API no matter which device or firmware version you're using.

Warning

This module is currently under development and is not ready for production use. There might be breaking changes happening with relative frequency until the official release. The module is tested internally and should work correctly, but should still be considered beta release.

Currently, the module supports control and many configuration options on ESP devices running the 2.x.x through 5.x.x firmware versions.
NOTE: Even though this library uses an API that supports older firmware versions such as 3.2.6, they are no longer supported as firmware versions and any bugs on deprecated firmware versions won't be fixed.

Installation

Git

  • Clone this repository and install the module from the cloned folder:
git clone https://github.com/netioproducts/PyNetioConf.git
cd PyNetioConf

# with uv: creates a .venv in the project folder and installs the module into it in editable mode
uv sync

# or with pip: if you can't or don't want to install site-wide packages, create a virtual environment first
python3 -m venv pnc_venv
source pnc_venv/bin/activate
pip3 install -e .
  • To update, run git pull in the PyNetioConf directory. Since the package is installed in editable mode, the changes are picked up straight away, but to be sure you can rerun uv sync (or pip3 install -e .).

Manual

  • Alternatively if you don't have git installed, you can download the code as a ZIP file from GitHub by clicking the green "Code" button.
  • After downloading the code, extract it to a directory and open that location in the terminal.
  • Once in the target directory run uv sync, or pip3 install -e . if you use pip.
    • With pip, if this produces an error or you wish to keep site-wide packages separate, create a virtual environment first: python3 -m venv pnc_venv && source pnc_venv/bin/activate then run pip3 install -e .

PyPI

# with uv
uv add PyNetioConf

# or with pip
pip install PyNetioConf

This installs the latest stable version. Betas and other pre-releases have to be requested explicitly with uv add --prerelease=allow PyNetioConf or pip install --pre PyNetioConf.

Usage

Development

  • After installing the pip package, you can easily use the library in your projects. To start off, you need to connect to the device, for that you need to create a NetioManager class instance which will handle any devices you connect to and their user sessions.
from PyNetioConf import NetioManager

nm = NetioManager()
# The NetioManager instance handles all the devices and their sessions, preventing any session crowding and
# collisions in case of multiple device instances

device = nm.init_device("powerpdu-8qs.netio-products.com", "demo", "demo")

# You can now control and configure the device using its class methods
# To check all the available methods check the NETIODevice class documentation.
device.set_output(1, False)

# While some cases should be universally available on all device versions, some featuers require
# certain firmware versions or user permissions, to be sure consult the NETIODevice class documentation.*

# To avoid any problems, encapsulate your logic in a try/except block
from PyNetioConf.exceptions import FeatureNotSupported

try:
    # MQTT certificate auth is only available on version 5.0.x or later
    device.upload_mqtt_ca_certificate("certificate_string")
except FeatureNotSupported as e:
    print("Device doesn't support MQTT cert authentication.")

# or

try:
    device.set_output(1, True)
except PermissionError as e:
    print("Logged in account doesn't have permissions to alter output states.")

Note: Currently the firmware version and permission requirements might be missing and will be added over time. In the meantime please check method implementations for your specific version in esp_xxx_device.py files.

  • To see sample usage of the package functions see: examples/*

Using pre-made scripts

  • This repository contains some common usage scenarios as pre-made example scripts, if you are only looking for specific use-case and don't intend to develop using this library this section goes over the usage of those scripts.
  • All the pre-made scripts are located in ./examples/ and to use them you will need to have installed the library as described in the Installation section of the readme.
  • Once you have the library installed you can choose whichever script you want to use and open the file in any text editor.
  • In the editor you change any necessary constants (variables in UPPER_CASE) such as: USERNAME and PASSWORD
  • For this example let's say I want to update the firmware using the update_firmware.py script:
    • First I follow the comments in the file and set all my constants to the ones of my device.
    • DEVICE_IP = "192.168.1.17"
      USERNAME = "admin"
      PASSWORD = "admin"
      FIRMWARE_PATH = "/home/user/Downloads/release503.package"
      
    • Then I run the file with python from the PyNetioConf directory: python3 examples/update_firmware.py (with uv, run it as uv run examples/update_firmware.py)
    • If I did all the steps correctly I should see an output simillar to the following:
    • TODO
      
    • To use any of the other scripts, follow the comments in the file for instructions and then run it the same way as this script.

Documentation

Documentation is currently provided for functions as docstrings in the source code. Different forms of documentation are being worked on and will be provided as the library matures.

Issues and Suggestions

If you find a bug or an issue, or have a suggestion, please use the GitHub issue tracker and create a new issue, before doing so, check if your issue isn't listed already. If reporting a bug please turn on logging DEBUG level and include the output in the report.

Metadata

Release files for PyNetioConf 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyNetioConf 0.3.1
File Size Uploaded Provenance Actions
pynetioconf-0.3.1.tar.gz 62.8 kB Without provenance Details for pynetioconf-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyNetioConf 0.3.1
File Interpreter ABI Platform Actions
pynetioconf-0.3.1-py3-none-any.whl Python 3 none any Details for pynetioconf-0.3.1-py3-none-any.whl

Total release size: 136.2 kB

Release files / pynetioconf-0.3.1.tar.gz

Download URL pynetioconf-0.3.1.tar.gz
Size 62.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dab9b0b0bdfad291f4ddc3b7ac76cd1bd79fa811b9ef0d6a6379d978ad3556e5
BLAKE2b-256 checksum
How to use checksums
38959496436c510185849f09b585f35beb77b1221e5f45293e597c22e6c7527c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pynetioconf-0.3.1-py3-none-any.whl

Download URL pynetioconf-0.3.1-py3-none-any.whl
Size 73.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c438f99754aa7fc57fba26002bac817ed5f7a61b69437fd59c8cb64c10ec7d3a
BLAKE2b-256 checksum
How to use checksums
dcaaa0944dd37e3308533743c4dd73a43abc5eefdfa892516654501bc390d9a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for PyNetioConf 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page