Python module to communicate with WKS EKO Circle inverters.
$ python -m pip install 'git+https://github.com/BoboTiG/[email protected]'
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)
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 follow:
$ 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"
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 theQLD
command (it will automatically fill the date using the current time);daily-pv
for theQED
command (it will automatically fill the date using the current time);metrics
for theQPGS0
command;monthly-load
for theQLM
command (it will automatically fill the date using the current time);monthly-pv
for theQEM
command (it will automatically fill the date using the current time);ratings
for theQPIRI
command;serial-no
for theQID
command;status
for theQPIGS
command;time
for theQT
command;total-load
for theQLT
command;total-pv
for theQET
command;warnings
for theQPIWS
command;yearly-load
for theQLY
command (it will automatically fill the date using the current time);yearly-pv
for theQEY
command (it will automatically fill the date using the current time);
When the inverter does not understand a command, it will respond with NAK
.
Setup 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