Skip to main content

Python Inverter COM

PyPI Version PyPI Status PyPI Python Versions Tests Github License

Python module to communicate with WKS EKO Circle inverters.

Installation

$ python -m pip install -U wks-com

Module

You can use the module directly from your code:

from wks_com import constants
from wks_com.inverter import Inverter


# Init the inverter (default port is /dev/ttyUSB0, several optional keyword-arguments are available)
# Example: inverter = Inverter("/dev/ttyAMA0", timeout=5.0)
inverter = Inverter()

# Send a command to the inverter
response = inverter.send("QID")

# The same command via an alias
response = inverter.send("serial-no")

# The same command using a constant
response = inverter.send(constants.CMD_SERIAL_NO)

Program

The module comes with the wks-read program. You can use it to send commands to inverters, and see what data you can get from.

The usage is as follows:

$ wks-read [--port SERIAL_PORT] [--debug] COMMAND_OR_ALIAS [COMMAND_OR_ALIAS...]

As an example, here is how to retrieve the inverter serial number:

$ wks-read QID
"96332309100452"

# The same command via an alias
$ wks-read serial-no
"96332309100452"

When enabling debug logs, it will likely show:

$ wks-read --debug serial-no
DEBUG:wks_com.inverter:/dev/ttyUSB0 > SEND 'QIDÖê\r'
DEBUG:wks_com.inverter:/dev/ttyUSB0 > WRITTEN 6 chars (OK)
DEBUG:wks_com.inverter:/dev/ttyUSB0 < RAW b'(96332309100452?\xf3\r'
DEBUG:wks_com.inverter:/dev/ttyUSB0 < DECODED '96332309100452'
"96332309100452"

The default port is /dev/ttyUSB0, you can change that:

$ wks-read --port /dev/ttyAMA0 serial-no
"96332309100452"

Commands and Aliases

You can send any commands as defined in the official documentation, and even unknown commands.

There are also aliases you could use:

  • daily-load for the QLD command (it will automatically fill the date using the current time);
  • daily-pv for the QED command (it will automatically fill the date using the current time);
  • metrics for the QPGS0 command;
  • monthly-load for the QLM command (it will automatically fill the date using the current time);
  • monthly-pv for the QEM command (it will automatically fill the date using the current time);
  • ratings for the QPIRI command;
  • serial-no for the QID command;
  • status for the QPIGS command;
  • time for the QT command;
  • total-load for the QLT command;
  • total-pv for the QET command;
  • warnings for the QPIWS command;
  • yearly-load for the QLY command (it will automatically fill the date using the current time);
  • yearly-pv for the QEY command (it will automatically fill the date using the current time);

When the inverter does not understand a command, it will respond with NAK.

Development

Set up a virtual environment:

$ python -m venv venv
$ . venv/bin/activate

Install, or update, dependencies:

$ python -m pip install -U pip
$ python -m pip install -e '.[dev]'

Run tests:

$ python -Wd -m pytest --doctest-modules src

Run linters, and quality checkers:

$ ./checks.sh

Release files for wks-com 1.2.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 wks-com 1.2.1
File Size Uploaded
wks_com-1.2.1.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wks-com 1.2.1
File Interpreter ABI Platform
wks_com-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / wks_com-1.2.1.tar.gz

Download URL wks_com-1.2.1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
34739d0d42745c2683f16a4edc067c1ca0cdaa687bc1345586c87bfa1be87725
BLAKE2b-256 checksum
How to use checksums
dfbcfbfaabb3622837bc8c9a4f11cbcc219405d5ae5f5c4d4386d677632a2632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2024.

Transparency log

Release files / wks_com-1.2.1-py3-none-any.whl

Download URL wks_com-1.2.1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b4f19e8e390196baaacfcd7d552aa9abb8ff75fddb1c460bd919499a29e275c
BLAKE2b-256 checksum
How to use checksums
f01ecf25c0ff24b722a4c0e6c3ff61c7c0716ea9f6b62a11d5a3210da4d31790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

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