Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This repository provides a python library and command line interface for the REST-API of Kostal Plenticore Solar Inverter.
This library is not affiliated with Kostal and is no offical product. It uses the interfaces of the inverter like other libs (eg. https://github.com/kilianknoll/kostal-RESTAPI) and uses information from their swagger documentation (ip-addr/api/v1/).
You will need Python >=3.7.
Packages of this library are released on PyPI and can be
installed with pip
. Alternatively the packages can also be downloaded from
GitHub.
I recommend to use a virtual environment for this, because it installs the dependecies independently from the system. The installed CLI tools can then be called without activating the virtual environment it.
# Install with command line support
$ pip install pykoplenti[CLI]
# Install without command line support
$ pip install pykoplenti
Installing the libray with CLI
provides a new command.
$ pykoplenti --help
Usage: pykoplenti [OPTIONS] COMMAND [ARGS]...
Handling of global arguments with click
Options:
--host TEXT hostname or ip of the inverter
--port INTEGER port of the inverter (default 80)
--password TEXT the password
--password-file TEXT password file (default "secrets" in the current
working directory)
--help Show this message and exit.
Commands:
all-processdata Returns a list of all available process data.
all-settings Returns the ids of all settings.
read-processdata Returns the values of the given process data.
read-settings Read the value of the given settings.
repl Provides a simple REPL for executing API requests to...
write-settings Write the values of the given settings.
Visit Command Line Help for example usage.
The library is fully async, there for you need an async loop and an async ClientSession
. Please refer to the
example directory for full code.
Import the client module:
from pykoplenti import ApiClient
To communicate with the inverter you need to instantiate the client:
# session is a aiohttp ClientSession
client = ApiClient(session, '192.168.1.100')
Login to gain full access to process data and settings:
await client.login(passwd)
Now you can access the API. For example to read process data values:
data = await client.get_process_data_values('devices:local', ['Inverter:State', 'Home_P'])
device_local = data['devices:local']
inverter_state = device_local['Inverter:State']
home_p = device_local['Home_P']
See the full example here: read_process_data.py.
If you should need installer access use the master key (printed on a label at the side of the inverter) and additionally pass your service code:
await client.login(my_master_key, service_code=my_service_code)
apache-2.0
FAQs
Python REST-Client for Kostal Plenticore Solar Inverters
We found that pykoplenti demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.